From 216c6c8a62e063ca263fbe65179d2928549c9c4e Mon Sep 17 00:00:00 2001 From: Troy Kessler Date: Wed, 7 Dec 2022 14:39:36 +0100 Subject: [PATCH] init kyvejs --- .eslintignore | 6 + .eslintrc | 49 + .github/workflows/integration-release.yaml | 85 + .github/workflows/kysor-release.yaml | 79 + .github/workflows/lint-checks.yaml | 25 + .github/workflows/package-release.yaml | 80 + .github/workflows/unit-tests.yaml | 25 + .gitignore | 146 + .npmignore | 144 + .prettierignore | 144 + LICENSE | 201 + README.md | 65 + common/protocol/.gitignore | 667 + common/protocol/.prettierignore | 667 + common/protocol/LICENSE | 201 + common/protocol/README.md | 88 + common/protocol/jest.config.js | 5 + common/protocol/package.json | 58 + common/protocol/src/commander/index.ts | 1 + common/protocol/src/commander/parser.ts | 52 + common/protocol/src/index.ts | 312 + .../methods/checks/validateIsNodeValidator.ts | 36 + .../methods/checks/validateIsPoolActive.ts | 46 + .../src/methods/checks/validateRuntime.ts | 32 + .../methods/checks/validateStorageBalance.ts | 48 + .../src/methods/checks/validateVersion.ts | 36 + .../methods/factories/compressionFactory.ts | 29 + .../factories/storageProviderFactory.ts | 33 + .../src/methods/helpers/continueRound.ts | 14 + .../src/methods/helpers/getProxyAuth.ts | 30 + .../helpers/saveGetTransformDataItem.ts | 69 + common/protocol/src/methods/index.ts | 54 + common/protocol/src/methods/main/runCache.ts | 251 + common/protocol/src/methods/main/runNode.ts | 96 + .../src/methods/queries/canPropose.ts | 108 + .../protocol/src/methods/queries/canVote.ts | 90 + .../src/methods/queries/getBalances.ts | 86 + .../src/methods/queries/syncPoolConfig.ts | 47 + .../src/methods/queries/syncPoolState.ts | 48 + .../src/methods/setups/setupCacheProvider.ts | 49 + .../src/methods/setups/setupLogger.ts | 88 + .../src/methods/setups/setupMetrics.ts | 420 + .../protocol/src/methods/setups/setupSDK.ts | 44 + .../src/methods/setups/setupValidator.ts | 65 + .../methods/timeouts/waitForAuthorization.ts | 117 + .../timeouts/waitForCacheContinuation.ts | 22 + .../timeouts/waitForNextBundleProposal.ts | 48 + .../methods/timeouts/waitForUploadInterval.ts | 51 + .../src/methods/txs/claimUploaderRole.ts | 57 + .../src/methods/txs/skipUploaderRole.ts | 63 + .../src/methods/txs/submitBundleProposal.ts | 81 + .../src/methods/txs/voteBundleProposal.ts | 82 + .../methods/upload/createBundleProposal.ts | 267 + .../methods/validate/saveBundleDecompress.ts | 46 + .../methods/validate/saveBundleDownload.ts | 117 + .../validate/saveLoadValidationBundle.ts | 107 + .../validate/validateBundleProposal.ts | 261 + .../reactors/cacheProvider/JsonFileCache.ts | 40 + .../src/reactors/cacheProvider/MemoryCache.ts | 40 + .../src/reactors/cacheProvider/index.ts | 2 + .../protocol/src/reactors/compression/Gzip.ts | 16 + .../src/reactors/compression/NoCompression.ts | 14 + .../src/reactors/storageProviders/Arweave.ts | 66 + .../src/reactors/storageProviders/Bundlr.ts | 68 + .../storageProviders/NoStorageProvider.ts | 33 + common/protocol/src/scripts/checksum.ts | 35 + common/protocol/src/types/dto.ts | 4 + common/protocol/src/types/index.ts | 3 + .../src/types/interfaces/cache.interface.ts | 82 + .../types/interfaces/compression.interface.ts | 44 + common/protocol/src/types/interfaces/index.ts | 4 + .../src/types/interfaces/runtime.interface.ts | 114 + .../interfaces/storageProvider.interface.ts | 83 + common/protocol/src/types/metrics.ts | 100 + common/protocol/src/utils/constants.ts | 16 + common/protocol/src/utils/helpers.ts | 170 + common/protocol/src/utils/index.ts | 2 + common/protocol/test/cache.test.ts | 1641 +++ common/protocol/test/genesis.test.ts | 517 + common/protocol/test/mocks/cache.mock.ts | 28 + common/protocol/test/mocks/client.mock.ts | 42 + .../protocol/test/mocks/compression.mock.ts | 25 + common/protocol/test/mocks/constants.ts | 61 + common/protocol/test/mocks/lcd.mock.ts | 17 + common/protocol/test/mocks/runtime.mock.ts | 39 + .../test/mocks/storageProvider.mock.ts | 44 + common/protocol/test/multiple_sources.test.ts | 1850 +++ common/protocol/test/no_storage.test.ts | 877 ++ common/protocol/test/propose_bundle.test.ts | 1618 +++ common/protocol/test/vote_abstain.test.ts | 1918 +++ common/protocol/test/vote_invalid.test.ts | 1768 +++ common/protocol/test/vote_valid.test.ts | 1105 ++ common/protocol/tsconfig.json | 12 + common/protocol/typedoc.json | 11 + common/protocol/yarn.lock | 0 common/sdk/.eslintrc | 9 + common/sdk/.gitignore | 5 + common/sdk/.prettierignore | 1 + common/sdk/LICENSE | 201 + common/sdk/README.md | 5 + common/sdk/jest.config.js | 6 + common/sdk/package.json | 54 + common/sdk/src/clients/full-client.ts | 42 + common/sdk/src/clients/lcd-client/client.ts | 17 + .../clients/lcd-client/lcd-client.abstract.ts | 28 + .../clients/lcd-client/query/v1beta1/query.ts | 252 + common/sdk/src/clients/rpc-client/client.ts | 77 + .../rpc-client/kyve/base/v1beta1/base.ts | 72 + .../kyve/bundles/v1beta1/bundles.ts | 87 + .../kyve/delegation/v1beta1/delegation.ts | 86 + .../src/clients/rpc-client/kyve/gov/v1/gov.ts | 326 + .../rpc-client/kyve/pool/v1beta1/pool.ts | 87 + .../kyve/stakers/v1beta1/stakers.ts | 105 + .../sdk/src/clients/rpc-client/web.client.ts | 21 + common/sdk/src/constants.ts | 103 + common/sdk/src/index.ts | 6 + common/sdk/src/registry/tx.registry.ts | 402 + common/sdk/src/sdk.ts | 243 + common/sdk/src/types/global.ts | 23 + common/sdk/src/utils/cosmostation-helper.ts | 117 + common/sdk/src/utils/helper.ts | 88 + common/sdk/src/utils/keplr-helper.ts | 56 + common/sdk/test/helper.ts | 52 + common/sdk/test/integrations/lcd.test.ts | 460 + common/sdk/test/tsconfig.json | 10 + common/sdk/test/unit/kyve-client.test.ts | 403 + common/sdk/test/unit/sign-string.test.ts | 165 + common/sdk/tsconfig.json | 11 + common/sdk/typedoc.json | 11 + common/types/.gitignore | 666 + common/types/LICENSE | 201 + common/types/README.md | 5 + common/types/package.json | 35 + common/types/scripts/prepare-publishing.sh | 10 + common/types/scripts/proto-gen.sh | 35 + .../src/client/cosmos/app/v1alpha1/config.ts | 167 + .../src/client/cosmos/app/v1alpha1/module.ts | 288 + .../src/client/cosmos/app/v1alpha1/query.ts | 143 + .../src/client/cosmos/auth/v1beta1/auth.ts | 304 + .../src/client/cosmos/auth/v1beta1/genesis.ts | 93 + .../src/client/cosmos/auth/v1beta1/query.ts | 900 ++ .../src/client/cosmos/authz/v1beta1/authz.ts | 325 + .../src/client/cosmos/authz/v1beta1/event.ts | 175 + .../client/cosmos/authz/v1beta1/genesis.ts | 78 + .../src/client/cosmos/authz/v1beta1/query.ts | 518 + .../src/client/cosmos/authz/v1beta1/tx.ts | 495 + .../src/client/cosmos/bank/v1beta1/authz.ts | 79 + .../src/client/cosmos/bank/v1beta1/bank.ts | 604 + .../src/client/cosmos/bank/v1beta1/genesis.ts | 201 + .../src/client/cosmos/bank/v1beta1/query.ts | 1356 +++ .../src/client/cosmos/bank/v1beta1/tx.ts | 291 + .../client/cosmos/base/abci/v1beta1/abci.ts | 1035 ++ .../src/client/cosmos/base/kv/v1beta1/kv.ts | 185 + .../cosmos/base/query/v1beta1/pagination.ts | 283 + .../base/reflection/v1beta1/reflection.ts | 280 + .../base/reflection/v2alpha1/reflection.ts | 1750 +++ .../cosmos/base/snapshots/v1beta1/snapshot.ts | 734 ++ .../cosmos/base/store/v1beta1/commit_info.ts | 282 + .../cosmos/base/store/v1beta1/listening.ts | 157 + .../cosmos/base/tendermint/v1beta1/query.ts | 1137 ++ .../src/client/cosmos/base/v1beta1/coin.ts | 261 + .../cosmos/capability/v1beta1/capability.ts | 210 + .../cosmos/capability/v1beta1/genesis.ts | 172 + .../client/cosmos/crisis/v1beta1/genesis.ts | 79 + .../src/client/cosmos/crisis/v1beta1/tx.ts | 161 + .../src/client/cosmos/crypto/ed25519/keys.ts | 178 + .../src/client/cosmos/crypto/hd/v1/hd.ts | 121 + .../client/cosmos/crypto/keyring/v1/record.ts | 357 + .../src/client/cosmos/crypto/multisig/keys.ts | 92 + .../crypto/multisig/v1beta1/multisig.ts | 195 + .../client/cosmos/crypto/secp256k1/keys.ts | 175 + .../client/cosmos/crypto/secp256r1/keys.ts | 176 + .../distribution/v1beta1/distribution.ts | 926 ++ .../cosmos/distribution/v1beta1/genesis.ts | 822 ++ .../cosmos/distribution/v1beta1/query.ts | 1269 ++ .../client/cosmos/distribution/v1beta1/tx.ts | 550 + .../cosmos/evidence/v1beta1/evidence.ts | 139 + .../client/cosmos/evidence/v1beta1/genesis.ts | 73 + .../client/cosmos/evidence/v1beta1/query.ts | 345 + .../src/client/cosmos/evidence/v1beta1/tx.ts | 215 + .../cosmos/feegrant/v1beta1/feegrant.ts | 405 + .../client/cosmos/feegrant/v1beta1/genesis.ts | 76 + .../client/cosmos/feegrant/v1beta1/query.ts | 477 + .../src/client/cosmos/feegrant/v1beta1/tx.ts | 296 + .../client/cosmos/genutil/v1beta1/genesis.ts | 116 + .../types/src/client/cosmos/gov/v1/genesis.ts | 182 + common/types/src/client/cosmos/gov/v1/gov.ts | 905 ++ .../types/src/client/cosmos/gov/v1/query.ts | 1178 ++ common/types/src/client/cosmos/gov/v1/tx.ts | 741 ++ .../src/client/cosmos/gov/v1beta1/genesis.ts | 180 + .../src/client/cosmos/gov/v1beta1/gov.ts | 1016 ++ .../src/client/cosmos/gov/v1beta1/query.ts | 1176 ++ .../types/src/client/cosmos/gov/v1beta1/tx.ts | 592 + .../src/client/cosmos/group/v1/events.ts | 533 + .../src/client/cosmos/group/v1/genesis.ts | 204 + .../types/src/client/cosmos/group/v1/query.ts | 1869 +++ common/types/src/client/cosmos/group/v1/tx.ts | 2070 ++++ .../types/src/client/cosmos/group/v1/types.ts | 1394 +++ .../src/client/cosmos/mint/v1beta1/genesis.ts | 90 + .../src/client/cosmos/mint/v1beta1/mint.ts | 212 + .../src/client/cosmos/mint/v1beta1/query.ts | 414 + common/types/src/client/cosmos/msg/v1/msg.ts | 3 + .../src/client/cosmos/nft/v1beta1/event.ts | 251 + .../src/client/cosmos/nft/v1beta1/genesis.ts | 163 + .../src/client/cosmos/nft/v1beta1/nft.ts | 240 + .../src/client/cosmos/nft/v1beta1/query.ts | 944 ++ .../types/src/client/cosmos/nft/v1beta1/tx.ts | 175 + common/types/src/client/cosmos/orm/v1/orm.ts | 356 + .../src/client/cosmos/orm/v1alpha1/schema.ts | 314 + .../client/cosmos/params/v1beta1/params.ts | 174 + .../src/client/cosmos/params/v1beta1/query.ts | 356 + .../client/cosmos/slashing/v1beta1/genesis.ts | 341 + .../client/cosmos/slashing/v1beta1/query.ts | 414 + .../cosmos/slashing/v1beta1/slashing.ts | 348 + .../src/client/cosmos/slashing/v1beta1/tx.ts | 143 + .../client/cosmos/staking/v1beta1/authz.ts | 244 + .../client/cosmos/staking/v1beta1/genesis.ts | 321 + .../client/cosmos/staking/v1beta1/query.ts | 2090 ++++ .../client/cosmos/staking/v1beta1/staking.ts | 1787 +++ .../src/client/cosmos/staking/v1beta1/tx.ts | 818 ++ .../cosmos/tx/signing/v1beta1/signing.ts | 532 + .../src/client/cosmos/tx/v1beta1/service.ts | 1002 ++ .../types/src/client/cosmos/tx/v1beta1/tx.ts | 1338 +++ .../client/cosmos/upgrade/v1beta1/query.ts | 723 ++ .../src/client/cosmos/upgrade/v1beta1/tx.ts | 284 + .../client/cosmos/upgrade/v1beta1/upgrade.ts | 410 + .../src/client/cosmos/vesting/v1beta1/tx.ts | 506 + .../client/cosmos/vesting/v1beta1/vesting.ts | 509 + .../types/src/client/cosmos_proto/cosmos.ts | 247 + common/types/src/client/gogoproto/gogo.ts | 3 + .../src/client/google/api/annotations.ts | 3 + common/types/src/client/google/api/http.ts | 655 + .../types/src/client/google/protobuf/any.ts | 237 + .../src/client/google/protobuf/descriptor.ts | 3714 ++++++ .../src/client/google/protobuf/duration.ts | 165 + .../types/src/client/google/protobuf/empty.ts | 68 + .../src/client/google/protobuf/timestamp.ts | 186 + .../client/kyve/bundles/v1beta1/bundles.ts | 545 + .../src/client/kyve/bundles/v1beta1/events.ts | 889 ++ .../client/kyve/bundles/v1beta1/genesis.ts | 112 + .../src/client/kyve/bundles/v1beta1/params.ts | 117 + .../src/client/kyve/bundles/v1beta1/query.ts | 143 + .../src/client/kyve/bundles/v1beta1/tx.ts | 865 ++ .../kyve/delegation/v1beta1/delegation.ts | 688 ++ .../client/kyve/delegation/v1beta1/events.ts | 452 + .../client/kyve/delegation/v1beta1/genesis.ts | 221 + .../client/kyve/delegation/v1beta1/params.ts | 149 + .../client/kyve/delegation/v1beta1/query.ts | 143 + .../src/client/kyve/delegation/v1beta1/tx.ts | 685 ++ .../src/client/kyve/fees/v1beta1/fees.ts | 273 + .../src/client/kyve/fees/v1beta1/genesis.ts | 75 + .../src/client/kyve/fees/v1beta1/query.ts | 143 + .../types/src/client/kyve/fees/v1beta1/tx.ts | 156 + .../src/client/kyve/pool/v1beta1/events.ts | 541 + .../src/client/kyve/pool/v1beta1/genesis.ts | 100 + .../src/client/kyve/pool/v1beta1/pool.ts | 634 + .../types/src/client/kyve/pool/v1beta1/tx.ts | 1233 ++ .../src/client/kyve/query/v1beta1/account.ts | 880 ++ .../src/client/kyve/query/v1beta1/bundles.ts | 1097 ++ .../client/kyve/query/v1beta1/delegation.ts | 698 ++ .../src/client/kyve/query/v1beta1/params.ts | 212 + .../src/client/kyve/query/v1beta1/pools.ts | 485 + .../src/client/kyve/query/v1beta1/query.ts | 668 + .../src/client/kyve/query/v1beta1/stakers.ts | 707 ++ .../client/kyve/registry/v1beta1/genesis.ts | 394 + .../src/client/kyve/registry/v1beta1/gov.ts | 694 ++ .../client/kyve/registry/v1beta1/registry.ts | 2398 ++++ .../src/client/kyve/stakers/v1beta1/events.ts | 418 + .../client/kyve/stakers/v1beta1/genesis.ts | 187 + .../src/client/kyve/stakers/v1beta1/params.ts | 95 + .../src/client/kyve/stakers/v1beta1/query.ts | 143 + .../client/kyve/stakers/v1beta1/stakers.ts | 512 + .../src/client/kyve/stakers/v1beta1/tx.ts | 800 ++ .../types/src/client/tendermint/abci/types.ts | 4121 +++++++ .../src/client/tendermint/crypto/keys.ts | 129 + .../src/client/tendermint/crypto/proof.ts | 436 + .../src/client/tendermint/libs/bits/types.ts | 105 + .../types/src/client/tendermint/p2p/types.ts | 532 + .../src/client/tendermint/types/block.ts | 112 + .../src/client/tendermint/types/evidence.ts | 394 + .../src/client/tendermint/types/params.ts | 492 + .../src/client/tendermint/types/types.ts | 1445 +++ .../src/client/tendermint/types/validator.ts | 305 + .../src/client/tendermint/version/types.ts | 165 + .../src/lcd/cosmos/app/v1alpha1/config.ts | 167 + .../src/lcd/cosmos/app/v1alpha1/module.ts | 288 + .../src/lcd/cosmos/app/v1alpha1/query.ts | 143 + .../types/src/lcd/cosmos/auth/v1beta1/auth.ts | 304 + .../src/lcd/cosmos/auth/v1beta1/genesis.ts | 93 + .../src/lcd/cosmos/auth/v1beta1/query.ts | 900 ++ .../src/lcd/cosmos/authz/v1beta1/authz.ts | 325 + .../src/lcd/cosmos/authz/v1beta1/event.ts | 175 + .../src/lcd/cosmos/authz/v1beta1/genesis.ts | 78 + .../src/lcd/cosmos/authz/v1beta1/query.ts | 518 + .../types/src/lcd/cosmos/authz/v1beta1/tx.ts | 495 + .../src/lcd/cosmos/bank/v1beta1/authz.ts | 79 + .../types/src/lcd/cosmos/bank/v1beta1/bank.ts | 604 + .../src/lcd/cosmos/bank/v1beta1/genesis.ts | 201 + .../src/lcd/cosmos/bank/v1beta1/query.ts | 1356 +++ .../types/src/lcd/cosmos/bank/v1beta1/tx.ts | 291 + .../src/lcd/cosmos/base/abci/v1beta1/abci.ts | 1035 ++ .../src/lcd/cosmos/base/kv/v1beta1/kv.ts | 185 + .../cosmos/base/query/v1beta1/pagination.ts | 283 + .../base/reflection/v1beta1/reflection.ts | 280 + .../base/reflection/v2alpha1/reflection.ts | 1750 +++ .../cosmos/base/snapshots/v1beta1/snapshot.ts | 734 ++ .../cosmos/base/store/v1beta1/commit_info.ts | 282 + .../cosmos/base/store/v1beta1/listening.ts | 157 + .../cosmos/base/tendermint/v1beta1/query.ts | 1137 ++ .../types/src/lcd/cosmos/base/v1beta1/coin.ts | 261 + .../cosmos/capability/v1beta1/capability.ts | 210 + .../lcd/cosmos/capability/v1beta1/genesis.ts | 172 + .../src/lcd/cosmos/crisis/v1beta1/genesis.ts | 79 + .../types/src/lcd/cosmos/crisis/v1beta1/tx.ts | 161 + .../src/lcd/cosmos/crypto/ed25519/keys.ts | 178 + .../types/src/lcd/cosmos/crypto/hd/v1/hd.ts | 121 + .../lcd/cosmos/crypto/keyring/v1/record.ts | 357 + .../src/lcd/cosmos/crypto/multisig/keys.ts | 92 + .../crypto/multisig/v1beta1/multisig.ts | 195 + .../src/lcd/cosmos/crypto/secp256k1/keys.ts | 175 + .../src/lcd/cosmos/crypto/secp256r1/keys.ts | 176 + .../distribution/v1beta1/distribution.ts | 926 ++ .../cosmos/distribution/v1beta1/genesis.ts | 822 ++ .../lcd/cosmos/distribution/v1beta1/query.ts | 1269 ++ .../src/lcd/cosmos/distribution/v1beta1/tx.ts | 550 + .../lcd/cosmos/evidence/v1beta1/evidence.ts | 139 + .../lcd/cosmos/evidence/v1beta1/genesis.ts | 73 + .../src/lcd/cosmos/evidence/v1beta1/query.ts | 345 + .../src/lcd/cosmos/evidence/v1beta1/tx.ts | 215 + .../lcd/cosmos/feegrant/v1beta1/feegrant.ts | 405 + .../lcd/cosmos/feegrant/v1beta1/genesis.ts | 76 + .../src/lcd/cosmos/feegrant/v1beta1/query.ts | 477 + .../src/lcd/cosmos/feegrant/v1beta1/tx.ts | 296 + .../src/lcd/cosmos/genutil/v1beta1/genesis.ts | 116 + common/types/src/lcd/cosmos/gov/v1/genesis.ts | 182 + common/types/src/lcd/cosmos/gov/v1/gov.ts | 943 ++ common/types/src/lcd/cosmos/gov/v1/query.ts | 1186 ++ common/types/src/lcd/cosmos/gov/v1/tx.ts | 741 ++ .../src/lcd/cosmos/gov/v1beta1/genesis.ts | 180 + .../types/src/lcd/cosmos/gov/v1beta1/gov.ts | 1054 ++ .../types/src/lcd/cosmos/gov/v1beta1/query.ts | 1184 ++ common/types/src/lcd/cosmos/gov/v1beta1/tx.ts | 592 + .../types/src/lcd/cosmos/group/v1/events.ts | 540 + .../types/src/lcd/cosmos/group/v1/genesis.ts | 204 + common/types/src/lcd/cosmos/group/v1/query.ts | 1869 +++ common/types/src/lcd/cosmos/group/v1/tx.ts | 2088 ++++ common/types/src/lcd/cosmos/group/v1/types.ts | 1470 +++ .../src/lcd/cosmos/mint/v1beta1/genesis.ts | 90 + .../types/src/lcd/cosmos/mint/v1beta1/mint.ts | 212 + .../src/lcd/cosmos/mint/v1beta1/query.ts | 414 + common/types/src/lcd/cosmos/msg/v1/msg.ts | 3 + .../types/src/lcd/cosmos/nft/v1beta1/event.ts | 251 + .../src/lcd/cosmos/nft/v1beta1/genesis.ts | 163 + .../types/src/lcd/cosmos/nft/v1beta1/nft.ts | 240 + .../types/src/lcd/cosmos/nft/v1beta1/query.ts | 944 ++ common/types/src/lcd/cosmos/nft/v1beta1/tx.ts | 175 + common/types/src/lcd/cosmos/orm/v1/orm.ts | 356 + .../src/lcd/cosmos/orm/v1alpha1/schema.ts | 334 + .../src/lcd/cosmos/params/v1beta1/params.ts | 174 + .../src/lcd/cosmos/params/v1beta1/query.ts | 356 + .../lcd/cosmos/slashing/v1beta1/genesis.ts | 341 + .../src/lcd/cosmos/slashing/v1beta1/query.ts | 414 + .../lcd/cosmos/slashing/v1beta1/slashing.ts | 348 + .../src/lcd/cosmos/slashing/v1beta1/tx.ts | 143 + .../src/lcd/cosmos/staking/v1beta1/authz.ts | 267 + .../src/lcd/cosmos/staking/v1beta1/genesis.ts | 321 + .../src/lcd/cosmos/staking/v1beta1/query.ts | 2090 ++++ .../src/lcd/cosmos/staking/v1beta1/staking.ts | 1803 +++ .../src/lcd/cosmos/staking/v1beta1/tx.ts | 818 ++ .../lcd/cosmos/tx/signing/v1beta1/signing.ts | 550 + .../src/lcd/cosmos/tx/v1beta1/service.ts | 1032 ++ common/types/src/lcd/cosmos/tx/v1beta1/tx.ts | 1338 +++ .../src/lcd/cosmos/upgrade/v1beta1/query.ts | 723 ++ .../src/lcd/cosmos/upgrade/v1beta1/tx.ts | 284 + .../src/lcd/cosmos/upgrade/v1beta1/upgrade.ts | 410 + .../src/lcd/cosmos/vesting/v1beta1/tx.ts | 506 + .../src/lcd/cosmos/vesting/v1beta1/vesting.ts | 509 + common/types/src/lcd/cosmos_proto/cosmos.ts | 261 + common/types/src/lcd/gogoproto/gogo.ts | 3 + .../types/src/lcd/google/api/annotations.ts | 3 + common/types/src/lcd/google/api/http.ts | 655 + common/types/src/lcd/google/protobuf/any.ts | 237 + .../src/lcd/google/protobuf/descriptor.ts | 3844 ++++++ .../types/src/lcd/google/protobuf/duration.ts | 165 + common/types/src/lcd/google/protobuf/empty.ts | 68 + .../src/lcd/google/protobuf/timestamp.ts | 186 + .../src/lcd/kyve/bundles/v1beta1/bundles.ts | 563 + .../src/lcd/kyve/bundles/v1beta1/events.ts | 889 ++ .../src/lcd/kyve/bundles/v1beta1/genesis.ts | 112 + .../src/lcd/kyve/bundles/v1beta1/params.ts | 117 + .../src/lcd/kyve/bundles/v1beta1/query.ts | 143 + .../types/src/lcd/kyve/bundles/v1beta1/tx.ts | 881 ++ .../lcd/kyve/delegation/v1beta1/delegation.ts | 704 ++ .../src/lcd/kyve/delegation/v1beta1/events.ts | 452 + .../lcd/kyve/delegation/v1beta1/genesis.ts | 221 + .../src/lcd/kyve/delegation/v1beta1/params.ts | 149 + .../src/lcd/kyve/delegation/v1beta1/query.ts | 143 + .../src/lcd/kyve/delegation/v1beta1/tx.ts | 685 ++ .../types/src/lcd/kyve/fees/v1beta1/fees.ts | 273 + .../src/lcd/kyve/fees/v1beta1/genesis.ts | 75 + .../types/src/lcd/kyve/fees/v1beta1/query.ts | 143 + common/types/src/lcd/kyve/fees/v1beta1/tx.ts | 156 + .../types/src/lcd/kyve/pool/v1beta1/events.ts | 541 + .../src/lcd/kyve/pool/v1beta1/genesis.ts | 100 + .../types/src/lcd/kyve/pool/v1beta1/pool.ts | 654 + common/types/src/lcd/kyve/pool/v1beta1/tx.ts | 1233 ++ .../src/lcd/kyve/query/v1beta1/account.ts | 880 ++ .../src/lcd/kyve/query/v1beta1/bundles.ts | 1097 ++ .../src/lcd/kyve/query/v1beta1/delegation.ts | 698 ++ .../src/lcd/kyve/query/v1beta1/params.ts | 212 + .../types/src/lcd/kyve/query/v1beta1/pools.ts | 485 + .../types/src/lcd/kyve/query/v1beta1/query.ts | 668 + .../src/lcd/kyve/query/v1beta1/stakers.ts | 721 ++ .../src/lcd/kyve/registry/v1beta1/genesis.ts | 394 + .../src/lcd/kyve/registry/v1beta1/gov.ts | 694 ++ .../src/lcd/kyve/registry/v1beta1/registry.ts | 2434 ++++ .../src/lcd/kyve/stakers/v1beta1/events.ts | 418 + .../src/lcd/kyve/stakers/v1beta1/genesis.ts | 187 + .../src/lcd/kyve/stakers/v1beta1/params.ts | 95 + .../src/lcd/kyve/stakers/v1beta1/query.ts | 143 + .../src/lcd/kyve/stakers/v1beta1/stakers.ts | 512 + .../types/src/lcd/kyve/stakers/v1beta1/tx.ts | 800 ++ common/types/src/lcd/tendermint/abci/types.ts | 4193 +++++++ .../types/src/lcd/tendermint/crypto/keys.ts | 129 + .../types/src/lcd/tendermint/crypto/proof.ts | 436 + .../src/lcd/tendermint/libs/bits/types.ts | 105 + common/types/src/lcd/tendermint/p2p/types.ts | 532 + .../types/src/lcd/tendermint/types/block.ts | 112 + .../src/lcd/tendermint/types/evidence.ts | 394 + .../types/src/lcd/tendermint/types/params.ts | 492 + .../types/src/lcd/tendermint/types/types.ts | 1484 +++ .../src/lcd/tendermint/types/validator.ts | 305 + .../types/src/lcd/tendermint/version/types.ts | 165 + common/types/tsconfig.json | 15 + integrations/bitcoin/.gitignore | 667 + integrations/bitcoin/LICENSE | 201 + integrations/bitcoin/README.md | 1 + integrations/bitcoin/package.json | 38 + integrations/bitcoin/src/index.ts | 7 + integrations/bitcoin/src/runtime.ts | 78 + integrations/bitcoin/src/types.ts | 12 + integrations/bitcoin/src/utils.ts | 44 + integrations/bitcoin/tsconfig.json | 11 + integrations/celo/.gitignore | 667 + integrations/celo/LICENSE | 201 + integrations/celo/README.md | 1 + integrations/celo/package.json | 40 + integrations/celo/src/index.ts | 7 + integrations/celo/src/runtime.ts | 57 + integrations/celo/src/utils.ts | 26 + integrations/celo/tsconfig.json | 11 + integrations/cosmos/.gitignore | 667 + integrations/cosmos/LICENSE | 201 + integrations/cosmos/README.md | 1 + integrations/cosmos/package.json | 34 + integrations/cosmos/src/index.ts | 6 + integrations/cosmos/src/runtime.ts | 59 + integrations/cosmos/src/types.ts | 6 + integrations/cosmos/tsconfig.json | 11 + integrations/evm/.gitignore | 667 + integrations/evm/LICENSE | 201 + integrations/evm/README.md | 1 + integrations/evm/package.json | 40 + integrations/evm/src/index.ts | 7 + integrations/evm/src/runtime.ts | 85 + integrations/evm/tsconfig.json | 11 + lerna.json | 17 + nx.json | 10 + package.json | 40 + tools/kysor/.gitignore | 216 + tools/kysor/README.md | 151 + tools/kysor/package.json | 60 + tools/kysor/src/commands/init.ts | 61 + tools/kysor/src/commands/start.ts | 14 + tools/kysor/src/commands/valaccounts.ts | 148 + tools/kysor/src/index.ts | 24 + tools/kysor/src/kysor.ts | 355 + tools/kysor/src/types/interfaces.ts | 15 + tools/kysor/src/utils.ts | 102 + tools/kysor/tsconfig.json | 11 + tsconfig.json | 15 + yarn.lock | 10030 ++++++++++++++++ 482 files changed, 198063 insertions(+) create mode 100644 .eslintignore create mode 100644 .eslintrc create mode 100644 .github/workflows/integration-release.yaml create mode 100644 .github/workflows/kysor-release.yaml create mode 100644 .github/workflows/lint-checks.yaml create mode 100644 .github/workflows/package-release.yaml create mode 100644 .github/workflows/unit-tests.yaml create mode 100644 .gitignore create mode 100644 .npmignore create mode 100644 .prettierignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 common/protocol/.gitignore create mode 100644 common/protocol/.prettierignore create mode 100644 common/protocol/LICENSE create mode 100644 common/protocol/README.md create mode 100644 common/protocol/jest.config.js create mode 100644 common/protocol/package.json create mode 100644 common/protocol/src/commander/index.ts create mode 100644 common/protocol/src/commander/parser.ts create mode 100644 common/protocol/src/index.ts create mode 100644 common/protocol/src/methods/checks/validateIsNodeValidator.ts create mode 100644 common/protocol/src/methods/checks/validateIsPoolActive.ts create mode 100644 common/protocol/src/methods/checks/validateRuntime.ts create mode 100644 common/protocol/src/methods/checks/validateStorageBalance.ts create mode 100644 common/protocol/src/methods/checks/validateVersion.ts create mode 100644 common/protocol/src/methods/factories/compressionFactory.ts create mode 100644 common/protocol/src/methods/factories/storageProviderFactory.ts create mode 100644 common/protocol/src/methods/helpers/continueRound.ts create mode 100644 common/protocol/src/methods/helpers/getProxyAuth.ts create mode 100644 common/protocol/src/methods/helpers/saveGetTransformDataItem.ts create mode 100644 common/protocol/src/methods/index.ts create mode 100644 common/protocol/src/methods/main/runCache.ts create mode 100644 common/protocol/src/methods/main/runNode.ts create mode 100644 common/protocol/src/methods/queries/canPropose.ts create mode 100644 common/protocol/src/methods/queries/canVote.ts create mode 100644 common/protocol/src/methods/queries/getBalances.ts create mode 100644 common/protocol/src/methods/queries/syncPoolConfig.ts create mode 100644 common/protocol/src/methods/queries/syncPoolState.ts create mode 100644 common/protocol/src/methods/setups/setupCacheProvider.ts create mode 100644 common/protocol/src/methods/setups/setupLogger.ts create mode 100644 common/protocol/src/methods/setups/setupMetrics.ts create mode 100644 common/protocol/src/methods/setups/setupSDK.ts create mode 100644 common/protocol/src/methods/setups/setupValidator.ts create mode 100644 common/protocol/src/methods/timeouts/waitForAuthorization.ts create mode 100644 common/protocol/src/methods/timeouts/waitForCacheContinuation.ts create mode 100644 common/protocol/src/methods/timeouts/waitForNextBundleProposal.ts create mode 100644 common/protocol/src/methods/timeouts/waitForUploadInterval.ts create mode 100644 common/protocol/src/methods/txs/claimUploaderRole.ts create mode 100644 common/protocol/src/methods/txs/skipUploaderRole.ts create mode 100644 common/protocol/src/methods/txs/submitBundleProposal.ts create mode 100644 common/protocol/src/methods/txs/voteBundleProposal.ts create mode 100644 common/protocol/src/methods/upload/createBundleProposal.ts create mode 100644 common/protocol/src/methods/validate/saveBundleDecompress.ts create mode 100644 common/protocol/src/methods/validate/saveBundleDownload.ts create mode 100644 common/protocol/src/methods/validate/saveLoadValidationBundle.ts create mode 100644 common/protocol/src/methods/validate/validateBundleProposal.ts create mode 100644 common/protocol/src/reactors/cacheProvider/JsonFileCache.ts create mode 100644 common/protocol/src/reactors/cacheProvider/MemoryCache.ts create mode 100644 common/protocol/src/reactors/cacheProvider/index.ts create mode 100644 common/protocol/src/reactors/compression/Gzip.ts create mode 100644 common/protocol/src/reactors/compression/NoCompression.ts create mode 100644 common/protocol/src/reactors/storageProviders/Arweave.ts create mode 100644 common/protocol/src/reactors/storageProviders/Bundlr.ts create mode 100644 common/protocol/src/reactors/storageProviders/NoStorageProvider.ts create mode 100644 common/protocol/src/scripts/checksum.ts create mode 100644 common/protocol/src/types/dto.ts create mode 100644 common/protocol/src/types/index.ts create mode 100644 common/protocol/src/types/interfaces/cache.interface.ts create mode 100644 common/protocol/src/types/interfaces/compression.interface.ts create mode 100644 common/protocol/src/types/interfaces/index.ts create mode 100644 common/protocol/src/types/interfaces/runtime.interface.ts create mode 100644 common/protocol/src/types/interfaces/storageProvider.interface.ts create mode 100644 common/protocol/src/types/metrics.ts create mode 100644 common/protocol/src/utils/constants.ts create mode 100644 common/protocol/src/utils/helpers.ts create mode 100644 common/protocol/src/utils/index.ts create mode 100644 common/protocol/test/cache.test.ts create mode 100644 common/protocol/test/genesis.test.ts create mode 100644 common/protocol/test/mocks/cache.mock.ts create mode 100644 common/protocol/test/mocks/client.mock.ts create mode 100644 common/protocol/test/mocks/compression.mock.ts create mode 100644 common/protocol/test/mocks/constants.ts create mode 100644 common/protocol/test/mocks/lcd.mock.ts create mode 100644 common/protocol/test/mocks/runtime.mock.ts create mode 100644 common/protocol/test/mocks/storageProvider.mock.ts create mode 100644 common/protocol/test/multiple_sources.test.ts create mode 100644 common/protocol/test/no_storage.test.ts create mode 100644 common/protocol/test/propose_bundle.test.ts create mode 100644 common/protocol/test/vote_abstain.test.ts create mode 100644 common/protocol/test/vote_invalid.test.ts create mode 100644 common/protocol/test/vote_valid.test.ts create mode 100644 common/protocol/tsconfig.json create mode 100644 common/protocol/typedoc.json create mode 100644 common/protocol/yarn.lock create mode 100644 common/sdk/.eslintrc create mode 100644 common/sdk/.gitignore create mode 100644 common/sdk/.prettierignore create mode 100644 common/sdk/LICENSE create mode 100644 common/sdk/README.md create mode 100644 common/sdk/jest.config.js create mode 100644 common/sdk/package.json create mode 100644 common/sdk/src/clients/full-client.ts create mode 100644 common/sdk/src/clients/lcd-client/client.ts create mode 100644 common/sdk/src/clients/lcd-client/lcd-client.abstract.ts create mode 100644 common/sdk/src/clients/lcd-client/query/v1beta1/query.ts create mode 100644 common/sdk/src/clients/rpc-client/client.ts create mode 100644 common/sdk/src/clients/rpc-client/kyve/base/v1beta1/base.ts create mode 100644 common/sdk/src/clients/rpc-client/kyve/bundles/v1beta1/bundles.ts create mode 100644 common/sdk/src/clients/rpc-client/kyve/delegation/v1beta1/delegation.ts create mode 100644 common/sdk/src/clients/rpc-client/kyve/gov/v1/gov.ts create mode 100644 common/sdk/src/clients/rpc-client/kyve/pool/v1beta1/pool.ts create mode 100644 common/sdk/src/clients/rpc-client/kyve/stakers/v1beta1/stakers.ts create mode 100644 common/sdk/src/clients/rpc-client/web.client.ts create mode 100644 common/sdk/src/constants.ts create mode 100644 common/sdk/src/index.ts create mode 100644 common/sdk/src/registry/tx.registry.ts create mode 100644 common/sdk/src/sdk.ts create mode 100644 common/sdk/src/types/global.ts create mode 100644 common/sdk/src/utils/cosmostation-helper.ts create mode 100644 common/sdk/src/utils/helper.ts create mode 100644 common/sdk/src/utils/keplr-helper.ts create mode 100644 common/sdk/test/helper.ts create mode 100644 common/sdk/test/integrations/lcd.test.ts create mode 100644 common/sdk/test/tsconfig.json create mode 100644 common/sdk/test/unit/kyve-client.test.ts create mode 100644 common/sdk/test/unit/sign-string.test.ts create mode 100644 common/sdk/tsconfig.json create mode 100644 common/sdk/typedoc.json create mode 100644 common/types/.gitignore create mode 100644 common/types/LICENSE create mode 100644 common/types/README.md create mode 100644 common/types/package.json create mode 100755 common/types/scripts/prepare-publishing.sh create mode 100755 common/types/scripts/proto-gen.sh create mode 100644 common/types/src/client/cosmos/app/v1alpha1/config.ts create mode 100644 common/types/src/client/cosmos/app/v1alpha1/module.ts create mode 100644 common/types/src/client/cosmos/app/v1alpha1/query.ts create mode 100644 common/types/src/client/cosmos/auth/v1beta1/auth.ts create mode 100644 common/types/src/client/cosmos/auth/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/auth/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/authz/v1beta1/authz.ts create mode 100644 common/types/src/client/cosmos/authz/v1beta1/event.ts create mode 100644 common/types/src/client/cosmos/authz/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/authz/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/authz/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/bank/v1beta1/authz.ts create mode 100644 common/types/src/client/cosmos/bank/v1beta1/bank.ts create mode 100644 common/types/src/client/cosmos/bank/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/bank/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/bank/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/base/abci/v1beta1/abci.ts create mode 100644 common/types/src/client/cosmos/base/kv/v1beta1/kv.ts create mode 100644 common/types/src/client/cosmos/base/query/v1beta1/pagination.ts create mode 100644 common/types/src/client/cosmos/base/reflection/v1beta1/reflection.ts create mode 100644 common/types/src/client/cosmos/base/reflection/v2alpha1/reflection.ts create mode 100644 common/types/src/client/cosmos/base/snapshots/v1beta1/snapshot.ts create mode 100644 common/types/src/client/cosmos/base/store/v1beta1/commit_info.ts create mode 100644 common/types/src/client/cosmos/base/store/v1beta1/listening.ts create mode 100644 common/types/src/client/cosmos/base/tendermint/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/base/v1beta1/coin.ts create mode 100644 common/types/src/client/cosmos/capability/v1beta1/capability.ts create mode 100644 common/types/src/client/cosmos/capability/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/crisis/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/crisis/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/crypto/ed25519/keys.ts create mode 100644 common/types/src/client/cosmos/crypto/hd/v1/hd.ts create mode 100644 common/types/src/client/cosmos/crypto/keyring/v1/record.ts create mode 100644 common/types/src/client/cosmos/crypto/multisig/keys.ts create mode 100644 common/types/src/client/cosmos/crypto/multisig/v1beta1/multisig.ts create mode 100644 common/types/src/client/cosmos/crypto/secp256k1/keys.ts create mode 100644 common/types/src/client/cosmos/crypto/secp256r1/keys.ts create mode 100644 common/types/src/client/cosmos/distribution/v1beta1/distribution.ts create mode 100644 common/types/src/client/cosmos/distribution/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/distribution/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/distribution/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/evidence/v1beta1/evidence.ts create mode 100644 common/types/src/client/cosmos/evidence/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/evidence/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/evidence/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/feegrant/v1beta1/feegrant.ts create mode 100644 common/types/src/client/cosmos/feegrant/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/feegrant/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/feegrant/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/genutil/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/gov/v1/genesis.ts create mode 100644 common/types/src/client/cosmos/gov/v1/gov.ts create mode 100644 common/types/src/client/cosmos/gov/v1/query.ts create mode 100644 common/types/src/client/cosmos/gov/v1/tx.ts create mode 100644 common/types/src/client/cosmos/gov/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/gov/v1beta1/gov.ts create mode 100644 common/types/src/client/cosmos/gov/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/gov/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/group/v1/events.ts create mode 100644 common/types/src/client/cosmos/group/v1/genesis.ts create mode 100644 common/types/src/client/cosmos/group/v1/query.ts create mode 100644 common/types/src/client/cosmos/group/v1/tx.ts create mode 100644 common/types/src/client/cosmos/group/v1/types.ts create mode 100644 common/types/src/client/cosmos/mint/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/mint/v1beta1/mint.ts create mode 100644 common/types/src/client/cosmos/mint/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/msg/v1/msg.ts create mode 100644 common/types/src/client/cosmos/nft/v1beta1/event.ts create mode 100644 common/types/src/client/cosmos/nft/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/nft/v1beta1/nft.ts create mode 100644 common/types/src/client/cosmos/nft/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/nft/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/orm/v1/orm.ts create mode 100644 common/types/src/client/cosmos/orm/v1alpha1/schema.ts create mode 100644 common/types/src/client/cosmos/params/v1beta1/params.ts create mode 100644 common/types/src/client/cosmos/params/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/slashing/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/slashing/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/slashing/v1beta1/slashing.ts create mode 100644 common/types/src/client/cosmos/slashing/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/staking/v1beta1/authz.ts create mode 100644 common/types/src/client/cosmos/staking/v1beta1/genesis.ts create mode 100644 common/types/src/client/cosmos/staking/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/staking/v1beta1/staking.ts create mode 100644 common/types/src/client/cosmos/staking/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/tx/signing/v1beta1/signing.ts create mode 100644 common/types/src/client/cosmos/tx/v1beta1/service.ts create mode 100644 common/types/src/client/cosmos/tx/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/upgrade/v1beta1/query.ts create mode 100644 common/types/src/client/cosmos/upgrade/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/upgrade/v1beta1/upgrade.ts create mode 100644 common/types/src/client/cosmos/vesting/v1beta1/tx.ts create mode 100644 common/types/src/client/cosmos/vesting/v1beta1/vesting.ts create mode 100644 common/types/src/client/cosmos_proto/cosmos.ts create mode 100644 common/types/src/client/gogoproto/gogo.ts create mode 100644 common/types/src/client/google/api/annotations.ts create mode 100644 common/types/src/client/google/api/http.ts create mode 100644 common/types/src/client/google/protobuf/any.ts create mode 100644 common/types/src/client/google/protobuf/descriptor.ts create mode 100644 common/types/src/client/google/protobuf/duration.ts create mode 100644 common/types/src/client/google/protobuf/empty.ts create mode 100644 common/types/src/client/google/protobuf/timestamp.ts create mode 100644 common/types/src/client/kyve/bundles/v1beta1/bundles.ts create mode 100644 common/types/src/client/kyve/bundles/v1beta1/events.ts create mode 100644 common/types/src/client/kyve/bundles/v1beta1/genesis.ts create mode 100644 common/types/src/client/kyve/bundles/v1beta1/params.ts create mode 100644 common/types/src/client/kyve/bundles/v1beta1/query.ts create mode 100644 common/types/src/client/kyve/bundles/v1beta1/tx.ts create mode 100644 common/types/src/client/kyve/delegation/v1beta1/delegation.ts create mode 100644 common/types/src/client/kyve/delegation/v1beta1/events.ts create mode 100644 common/types/src/client/kyve/delegation/v1beta1/genesis.ts create mode 100644 common/types/src/client/kyve/delegation/v1beta1/params.ts create mode 100644 common/types/src/client/kyve/delegation/v1beta1/query.ts create mode 100644 common/types/src/client/kyve/delegation/v1beta1/tx.ts create mode 100644 common/types/src/client/kyve/fees/v1beta1/fees.ts create mode 100644 common/types/src/client/kyve/fees/v1beta1/genesis.ts create mode 100644 common/types/src/client/kyve/fees/v1beta1/query.ts create mode 100644 common/types/src/client/kyve/fees/v1beta1/tx.ts create mode 100644 common/types/src/client/kyve/pool/v1beta1/events.ts create mode 100644 common/types/src/client/kyve/pool/v1beta1/genesis.ts create mode 100644 common/types/src/client/kyve/pool/v1beta1/pool.ts create mode 100644 common/types/src/client/kyve/pool/v1beta1/tx.ts create mode 100644 common/types/src/client/kyve/query/v1beta1/account.ts create mode 100644 common/types/src/client/kyve/query/v1beta1/bundles.ts create mode 100644 common/types/src/client/kyve/query/v1beta1/delegation.ts create mode 100644 common/types/src/client/kyve/query/v1beta1/params.ts create mode 100644 common/types/src/client/kyve/query/v1beta1/pools.ts create mode 100644 common/types/src/client/kyve/query/v1beta1/query.ts create mode 100644 common/types/src/client/kyve/query/v1beta1/stakers.ts create mode 100644 common/types/src/client/kyve/registry/v1beta1/genesis.ts create mode 100644 common/types/src/client/kyve/registry/v1beta1/gov.ts create mode 100644 common/types/src/client/kyve/registry/v1beta1/registry.ts create mode 100644 common/types/src/client/kyve/stakers/v1beta1/events.ts create mode 100644 common/types/src/client/kyve/stakers/v1beta1/genesis.ts create mode 100644 common/types/src/client/kyve/stakers/v1beta1/params.ts create mode 100644 common/types/src/client/kyve/stakers/v1beta1/query.ts create mode 100644 common/types/src/client/kyve/stakers/v1beta1/stakers.ts create mode 100644 common/types/src/client/kyve/stakers/v1beta1/tx.ts create mode 100644 common/types/src/client/tendermint/abci/types.ts create mode 100644 common/types/src/client/tendermint/crypto/keys.ts create mode 100644 common/types/src/client/tendermint/crypto/proof.ts create mode 100644 common/types/src/client/tendermint/libs/bits/types.ts create mode 100644 common/types/src/client/tendermint/p2p/types.ts create mode 100644 common/types/src/client/tendermint/types/block.ts create mode 100644 common/types/src/client/tendermint/types/evidence.ts create mode 100644 common/types/src/client/tendermint/types/params.ts create mode 100644 common/types/src/client/tendermint/types/types.ts create mode 100644 common/types/src/client/tendermint/types/validator.ts create mode 100644 common/types/src/client/tendermint/version/types.ts create mode 100644 common/types/src/lcd/cosmos/app/v1alpha1/config.ts create mode 100644 common/types/src/lcd/cosmos/app/v1alpha1/module.ts create mode 100644 common/types/src/lcd/cosmos/app/v1alpha1/query.ts create mode 100644 common/types/src/lcd/cosmos/auth/v1beta1/auth.ts create mode 100644 common/types/src/lcd/cosmos/auth/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/auth/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/authz/v1beta1/authz.ts create mode 100644 common/types/src/lcd/cosmos/authz/v1beta1/event.ts create mode 100644 common/types/src/lcd/cosmos/authz/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/authz/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/authz/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/bank/v1beta1/authz.ts create mode 100644 common/types/src/lcd/cosmos/bank/v1beta1/bank.ts create mode 100644 common/types/src/lcd/cosmos/bank/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/bank/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/bank/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/base/abci/v1beta1/abci.ts create mode 100644 common/types/src/lcd/cosmos/base/kv/v1beta1/kv.ts create mode 100644 common/types/src/lcd/cosmos/base/query/v1beta1/pagination.ts create mode 100644 common/types/src/lcd/cosmos/base/reflection/v1beta1/reflection.ts create mode 100644 common/types/src/lcd/cosmos/base/reflection/v2alpha1/reflection.ts create mode 100644 common/types/src/lcd/cosmos/base/snapshots/v1beta1/snapshot.ts create mode 100644 common/types/src/lcd/cosmos/base/store/v1beta1/commit_info.ts create mode 100644 common/types/src/lcd/cosmos/base/store/v1beta1/listening.ts create mode 100644 common/types/src/lcd/cosmos/base/tendermint/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/base/v1beta1/coin.ts create mode 100644 common/types/src/lcd/cosmos/capability/v1beta1/capability.ts create mode 100644 common/types/src/lcd/cosmos/capability/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/crisis/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/crisis/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/crypto/ed25519/keys.ts create mode 100644 common/types/src/lcd/cosmos/crypto/hd/v1/hd.ts create mode 100644 common/types/src/lcd/cosmos/crypto/keyring/v1/record.ts create mode 100644 common/types/src/lcd/cosmos/crypto/multisig/keys.ts create mode 100644 common/types/src/lcd/cosmos/crypto/multisig/v1beta1/multisig.ts create mode 100644 common/types/src/lcd/cosmos/crypto/secp256k1/keys.ts create mode 100644 common/types/src/lcd/cosmos/crypto/secp256r1/keys.ts create mode 100644 common/types/src/lcd/cosmos/distribution/v1beta1/distribution.ts create mode 100644 common/types/src/lcd/cosmos/distribution/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/distribution/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/distribution/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/evidence/v1beta1/evidence.ts create mode 100644 common/types/src/lcd/cosmos/evidence/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/evidence/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/evidence/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/feegrant/v1beta1/feegrant.ts create mode 100644 common/types/src/lcd/cosmos/feegrant/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/feegrant/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/feegrant/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/genutil/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/gov/v1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/gov/v1/gov.ts create mode 100644 common/types/src/lcd/cosmos/gov/v1/query.ts create mode 100644 common/types/src/lcd/cosmos/gov/v1/tx.ts create mode 100644 common/types/src/lcd/cosmos/gov/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/gov/v1beta1/gov.ts create mode 100644 common/types/src/lcd/cosmos/gov/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/gov/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/group/v1/events.ts create mode 100644 common/types/src/lcd/cosmos/group/v1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/group/v1/query.ts create mode 100644 common/types/src/lcd/cosmos/group/v1/tx.ts create mode 100644 common/types/src/lcd/cosmos/group/v1/types.ts create mode 100644 common/types/src/lcd/cosmos/mint/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/mint/v1beta1/mint.ts create mode 100644 common/types/src/lcd/cosmos/mint/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/msg/v1/msg.ts create mode 100644 common/types/src/lcd/cosmos/nft/v1beta1/event.ts create mode 100644 common/types/src/lcd/cosmos/nft/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/nft/v1beta1/nft.ts create mode 100644 common/types/src/lcd/cosmos/nft/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/nft/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/orm/v1/orm.ts create mode 100644 common/types/src/lcd/cosmos/orm/v1alpha1/schema.ts create mode 100644 common/types/src/lcd/cosmos/params/v1beta1/params.ts create mode 100644 common/types/src/lcd/cosmos/params/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/slashing/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/slashing/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/slashing/v1beta1/slashing.ts create mode 100644 common/types/src/lcd/cosmos/slashing/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/staking/v1beta1/authz.ts create mode 100644 common/types/src/lcd/cosmos/staking/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/cosmos/staking/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/staking/v1beta1/staking.ts create mode 100644 common/types/src/lcd/cosmos/staking/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/tx/signing/v1beta1/signing.ts create mode 100644 common/types/src/lcd/cosmos/tx/v1beta1/service.ts create mode 100644 common/types/src/lcd/cosmos/tx/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/upgrade/v1beta1/query.ts create mode 100644 common/types/src/lcd/cosmos/upgrade/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/upgrade/v1beta1/upgrade.ts create mode 100644 common/types/src/lcd/cosmos/vesting/v1beta1/tx.ts create mode 100644 common/types/src/lcd/cosmos/vesting/v1beta1/vesting.ts create mode 100644 common/types/src/lcd/cosmos_proto/cosmos.ts create mode 100644 common/types/src/lcd/gogoproto/gogo.ts create mode 100644 common/types/src/lcd/google/api/annotations.ts create mode 100644 common/types/src/lcd/google/api/http.ts create mode 100644 common/types/src/lcd/google/protobuf/any.ts create mode 100644 common/types/src/lcd/google/protobuf/descriptor.ts create mode 100644 common/types/src/lcd/google/protobuf/duration.ts create mode 100644 common/types/src/lcd/google/protobuf/empty.ts create mode 100644 common/types/src/lcd/google/protobuf/timestamp.ts create mode 100644 common/types/src/lcd/kyve/bundles/v1beta1/bundles.ts create mode 100644 common/types/src/lcd/kyve/bundles/v1beta1/events.ts create mode 100644 common/types/src/lcd/kyve/bundles/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/kyve/bundles/v1beta1/params.ts create mode 100644 common/types/src/lcd/kyve/bundles/v1beta1/query.ts create mode 100644 common/types/src/lcd/kyve/bundles/v1beta1/tx.ts create mode 100644 common/types/src/lcd/kyve/delegation/v1beta1/delegation.ts create mode 100644 common/types/src/lcd/kyve/delegation/v1beta1/events.ts create mode 100644 common/types/src/lcd/kyve/delegation/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/kyve/delegation/v1beta1/params.ts create mode 100644 common/types/src/lcd/kyve/delegation/v1beta1/query.ts create mode 100644 common/types/src/lcd/kyve/delegation/v1beta1/tx.ts create mode 100644 common/types/src/lcd/kyve/fees/v1beta1/fees.ts create mode 100644 common/types/src/lcd/kyve/fees/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/kyve/fees/v1beta1/query.ts create mode 100644 common/types/src/lcd/kyve/fees/v1beta1/tx.ts create mode 100644 common/types/src/lcd/kyve/pool/v1beta1/events.ts create mode 100644 common/types/src/lcd/kyve/pool/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/kyve/pool/v1beta1/pool.ts create mode 100644 common/types/src/lcd/kyve/pool/v1beta1/tx.ts create mode 100644 common/types/src/lcd/kyve/query/v1beta1/account.ts create mode 100644 common/types/src/lcd/kyve/query/v1beta1/bundles.ts create mode 100644 common/types/src/lcd/kyve/query/v1beta1/delegation.ts create mode 100644 common/types/src/lcd/kyve/query/v1beta1/params.ts create mode 100644 common/types/src/lcd/kyve/query/v1beta1/pools.ts create mode 100644 common/types/src/lcd/kyve/query/v1beta1/query.ts create mode 100644 common/types/src/lcd/kyve/query/v1beta1/stakers.ts create mode 100644 common/types/src/lcd/kyve/registry/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/kyve/registry/v1beta1/gov.ts create mode 100644 common/types/src/lcd/kyve/registry/v1beta1/registry.ts create mode 100644 common/types/src/lcd/kyve/stakers/v1beta1/events.ts create mode 100644 common/types/src/lcd/kyve/stakers/v1beta1/genesis.ts create mode 100644 common/types/src/lcd/kyve/stakers/v1beta1/params.ts create mode 100644 common/types/src/lcd/kyve/stakers/v1beta1/query.ts create mode 100644 common/types/src/lcd/kyve/stakers/v1beta1/stakers.ts create mode 100644 common/types/src/lcd/kyve/stakers/v1beta1/tx.ts create mode 100644 common/types/src/lcd/tendermint/abci/types.ts create mode 100644 common/types/src/lcd/tendermint/crypto/keys.ts create mode 100644 common/types/src/lcd/tendermint/crypto/proof.ts create mode 100644 common/types/src/lcd/tendermint/libs/bits/types.ts create mode 100644 common/types/src/lcd/tendermint/p2p/types.ts create mode 100644 common/types/src/lcd/tendermint/types/block.ts create mode 100644 common/types/src/lcd/tendermint/types/evidence.ts create mode 100644 common/types/src/lcd/tendermint/types/params.ts create mode 100644 common/types/src/lcd/tendermint/types/types.ts create mode 100644 common/types/src/lcd/tendermint/types/validator.ts create mode 100644 common/types/src/lcd/tendermint/version/types.ts create mode 100644 common/types/tsconfig.json create mode 100644 integrations/bitcoin/.gitignore create mode 100644 integrations/bitcoin/LICENSE create mode 100644 integrations/bitcoin/README.md create mode 100644 integrations/bitcoin/package.json create mode 100644 integrations/bitcoin/src/index.ts create mode 100644 integrations/bitcoin/src/runtime.ts create mode 100644 integrations/bitcoin/src/types.ts create mode 100644 integrations/bitcoin/src/utils.ts create mode 100644 integrations/bitcoin/tsconfig.json create mode 100644 integrations/celo/.gitignore create mode 100644 integrations/celo/LICENSE create mode 100644 integrations/celo/README.md create mode 100644 integrations/celo/package.json create mode 100644 integrations/celo/src/index.ts create mode 100644 integrations/celo/src/runtime.ts create mode 100644 integrations/celo/src/utils.ts create mode 100644 integrations/celo/tsconfig.json create mode 100644 integrations/cosmos/.gitignore create mode 100644 integrations/cosmos/LICENSE create mode 100644 integrations/cosmos/README.md create mode 100644 integrations/cosmos/package.json create mode 100644 integrations/cosmos/src/index.ts create mode 100644 integrations/cosmos/src/runtime.ts create mode 100644 integrations/cosmos/src/types.ts create mode 100644 integrations/cosmos/tsconfig.json create mode 100644 integrations/evm/.gitignore create mode 100644 integrations/evm/LICENSE create mode 100644 integrations/evm/README.md create mode 100644 integrations/evm/package.json create mode 100644 integrations/evm/src/index.ts create mode 100644 integrations/evm/src/runtime.ts create mode 100644 integrations/evm/tsconfig.json create mode 100644 lerna.json create mode 100644 nx.json create mode 100644 package.json create mode 100644 tools/kysor/.gitignore create mode 100644 tools/kysor/README.md create mode 100644 tools/kysor/package.json create mode 100644 tools/kysor/src/commands/init.ts create mode 100644 tools/kysor/src/commands/start.ts create mode 100644 tools/kysor/src/commands/valaccounts.ts create mode 100644 tools/kysor/src/index.ts create mode 100644 tools/kysor/src/kysor.ts create mode 100644 tools/kysor/src/types/interfaces.ts create mode 100644 tools/kysor/src/utils.ts create mode 100644 tools/kysor/tsconfig.json create mode 100644 tsconfig.json create mode 100644 yarn.lock diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..620820fc --- /dev/null +++ b/.eslintignore @@ -0,0 +1,6 @@ +**/dist/** +**/build/** +**/node_modules/** +**/*.test.{js,jsx,ts,tsx} +**/*.spec.{js,jsx,ts,tsx} +**/docs/** \ No newline at end of file diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..e585b59a --- /dev/null +++ b/.eslintrc @@ -0,0 +1,49 @@ +{ + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "./tsconfig.json", + "ecmaVersion": 2018, + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint", + "simple-import-sort", + "prettier" + ], + "extends": [ + "prettier", + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + "prettier/prettier": "error", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-member-accessibility": "off", + "@typescript-eslint/no-explicit-any": "off", + "no-empty": ["error", { "allowEmptyCatch": true }], + "@typescript-eslint/no-unused-vars": ["error", { + "ignoreRestSiblings": true, + "argsIgnorePattern": "^_" + }], + "@typescript-eslint/no-submodule-imports": "off", + "@typescript-eslint/no-unused-expressions": "warn", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/jsx-no-lambda": "off", + "@typescript-eslint/prefer-interface": "off", + "@typescript-eslint/interface-name-prefix": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/camelcase": "off", + "simple-import-sort/imports": "warn", + "simple-import-sort/exports": "warn", + "no-console": "off", + "sort-keys": "off", + "sort-imports": "off", + "import/no-anonymous-default-export": "off" + }, + "env": { + "browser": true, + "es6": true, + "node": true + } +} \ No newline at end of file diff --git a/.github/workflows/integration-release.yaml b/.github/workflows/integration-release.yaml new file mode 100644 index 00000000..e195fa00 --- /dev/null +++ b/.github/workflows/integration-release.yaml @@ -0,0 +1,85 @@ +name: Create release binaries +on: + push: + branches: [ main ] + tags: + - '*' +jobs: + prepare: + runs-on: ubuntu-latest + outputs: + output: ${{ steps.set_env.outputs.test }} + steps: + - name: Checkout the repository + uses: actions/checkout@main + with: + ref: 'main' + - name: featch tags + run: git fetch --tags + - name: collect integrations names + run: | + cd integrations/ + echo "INTEGRATIONS=$(ls | jq --raw-input . | jq --slurp . | jq tostring)" >> $GITHUB_ENV + - name: set tag + run: echo "TAGS=$(git tag --points-at | jq --raw-input . | jq --slurp . | jq tostring)" >> $GITHUB_ENV + - id: output-tags + uses: actions/github-script@master + with: + script: | + const { INTEGRATIONS, TAGS } = process.env; + console.log(INTEGRATIONS); + console.log(TAGS); + const integrations = JSON.parse(JSON.parse(INTEGRATIONS)); + const tags = JSON.parse(JSON.parse(TAGS)); + const selectedTags = tags.filter(it => integrations.includes(it.trim().split('/')[1]?.split('@')[0])) + return JSON.stringify(JSON.stringify(selectedTags)) + result-encoding: string + - name: print var + run: echo ${{steps.output-tags.outputs.result}} + - name: set + id: set_env + run: echo "::set-output name=test::${{steps.output-tags.outputs.result}}" + build: + if: needs.prepare.outputs.output != '[]' + runs-on: ubuntu-latest + needs: prepare + strategy: + matrix: + tag: ${{fromJSON(needs.prepare.outputs.output)}} + steps: + - name: Checkout the repository + uses: actions/checkout@main + with: + ref: 'main' + - name: set integration name + run: echo "INTEGRATION_NAME=$(echo ${{ matrix.tag }} | awk -F'[/@]' '{print $3}' | sed 's/ *$//g')" >> $GITHUB_ENV + - name: install yarn + run: npm install --global yarn + - name: setup lerna + run: yarn setup + - name: print integration name + run: echo ${{ env.INTEGRATION_NAME }} + - name: Build Binaries + run: | + cd integrations/${{ env.INTEGRATION_NAME }} + ls + yarn build:binaries + cd out + zip kyve-linux-arm64.zip kyve-linux-arm64 + rm kyve-linux-arm64 + zip kyve-linux-x64.zip kyve-linux-x64 + rm kyve-linux-x64 + zip kyve-macos-x64.zip kyve-macos-x64 + rm kyve-macos-x64 + cd .. + - name: Generate Release Body + run: npx extract-changelog-release ${{ github.workspace }}/integrations/${{env.INTEGRATION_NAME}}/CHANGELOG.md > RELEASE_BODY.md + - name: Publish the Release + uses: softprops/action-gh-release@v1 + with: + body_path: RELEASE_BODY.md + tag_name: ${{ matrix.tag }} + files: integrations/${{env.INTEGRATION_NAME}}/out/* + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/kysor-release.yaml b/.github/workflows/kysor-release.yaml new file mode 100644 index 00000000..f724b46c --- /dev/null +++ b/.github/workflows/kysor-release.yaml @@ -0,0 +1,79 @@ +name: Create release kysor binaries +on: + push: + branches: [ main ] + tags: + - '*' + +jobs: + prepare: + runs-on: ubuntu-latest + outputs: + output: ${{ steps.set_env.outputs.test }} + steps: + - name: Checkout the repository + uses: actions/checkout@main + with: + ref: 'main' + - name: featch tags + run: git fetch --tags + - name: collect integrations names + run: | + cd integrations/ + echo "INTEGRATIONS=$(ls | jq --raw-input . | jq --slurp . | jq tostring)" >> $GITHUB_ENV + - name: set tag + run: echo "TAGS=$(git tag --points-at | jq --raw-input . | jq --slurp . | jq tostring)" >> $GITHUB_ENV + - id: output-tags + uses: actions/github-script@master + with: + script: | + const { TAGS } = process.env; + const KYSOR_TAG = 'kysor' + const tags = JSON.parse(JSON.parse(TAGS)); + const kysorTag = tags.find(it => it.trim().split('/')[1]?.split('@')[0] === KYSOR_TAG) + return kysorTag?.toString() ?? ''; + result-encoding: string + - name: print var + run: echo ${{steps.output-tags.outputs.result}} + - name: set + id: set_env + run: echo "::set-output name=test::${{steps.output-tags.outputs.result}}" + build: + if: needs.prepare.outputs.output != '' + runs-on: ubuntu-latest + needs: prepare + steps: + - name: Checkout the repository + uses: actions/checkout@main + with: + ref: 'main' + - name: install yarn + run: npm install --global yarn + - name: setup lerna + run: yarn setup + - name: print var + run: echo ${{steps.output-tag.outputs.result}} + - name: Build Binaries + run: | + cd tools/kysor + yarn build:binaries + cd out + zip kysor-linux-arm64.zip kysor-linux-arm64 + rm kysor-linux-arm64 + zip kysor-linux-x64.zip kysor-linux-x64 + rm kysor-linux-x64 + zip kysor-macos-x64.zip kysor-macos-x64 + rm kysor-macos-x64 + ls + + - name: Generate Release Body + run: npx extract-changelog-release ${{ github.workspace }}/tools/kysor/CHANGELOG.md > RELEASE_BODY.md + - name: Publish the Release + uses: softprops/action-gh-release@v1 + with: + body_path: RELEASE_BODY.md + tag_name: ${{ needs.prepare.outputs.output }} + files: ${{ github.workspace }}/tools/kysor/out/* + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/lint-checks.yaml b/.github/workflows/lint-checks.yaml new file mode 100644 index 00000000..74c90032 --- /dev/null +++ b/.github/workflows/lint-checks.yaml @@ -0,0 +1,25 @@ +name: lint checks + +on: + - pull_request + +jobs: + tests: + runs-on: ubuntu-latest + env: + npm_config_user: "root" + steps: + - name: "checkout repo" + uses: actions/checkout@v3 + - name: "nodejs install" + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Install Protoc + uses: arduino/setup-protoc@v1 + - name: install yarn + run: npm install --global yarn + - name: "setup" + run: yarn setup + - name: "lint" + run: yarn lint diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml new file mode 100644 index 00000000..7290f2a6 --- /dev/null +++ b/.github/workflows/package-release.yaml @@ -0,0 +1,80 @@ +name: Create package release +on: + push: + branches: [ main ] + tags: + - '*' +jobs: + prepare: + runs-on: ubuntu-latest + outputs: + output: ${{ steps.set_env.outputs.test }} + steps: + - name: Checkout the repository + uses: actions/checkout@main + with: + ref: 'main' + - name: fetch tags + run: git fetch --tags + - name: collect integrations names + run: | + cd common/ + echo "PACKAGE=$(ls | jq --raw-input . | jq --slurp . | jq tostring)" >> $GITHUB_ENV + - name: set tag + run: echo "TAGS=$(git tag --points-at | jq --raw-input . | jq --slurp . | jq tostring)" >> $GITHUB_ENV + - id: output-tags + uses: actions/github-script@master + with: + script: | + const { PACKAGE, TAGS } = process.env; + console.log(PACKAGE); + console.log(TAGS); + const package = JSON.parse(JSON.parse(PACKAGE)); + const tags = JSON.parse(JSON.parse(TAGS)); + const selectedTags = tags.filter(it => package.includes(it.trim().split('/')[1]?.split('@')[0])) + return JSON.stringify(JSON.stringify(selectedTags)) + result-encoding: string + - name: print var + run: echo ${{steps.output-tags.outputs.result}} + - name: set + id: set_env + run: echo "::set-output name=test::${{steps.output-tags.outputs.result}}" + release: + if: needs.prepare.outputs.output != '[]' + runs-on: ubuntu-latest + needs: prepare + strategy: + matrix: + tag: ${{fromJSON(needs.prepare.outputs.output)}} + steps: + - name: Checkout the repository + uses: actions/checkout@main + with: + ref: 'main' + - name: set integration name + run: echo "PACKAGE_NAME=$(echo ${{ matrix.tag }} | awk -F'[/@]' '{print $3}' | sed 's/ *$//g')" >> $GITHUB_ENV + - uses: actions/setup-node@v3 + with: + node-version: '18.x' + - name: setup lerna + run: yarn setup + - name: print integration name + run: echo ${{ env.PACKAGE_NAME }} + - name: build + run: yarn build +# todo: publish to npm registry +# - name: Publish release +# run: yarn publish +# working-directory: common/${{env.PACKAGE_NAME}} +# env: +# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Generate Release Body + run: npx extract-changelog-release ${{ github.workspace }}/common/${{env.PACKAGE_NAME}}/CHANGELOG.md > RELEASE_BODY.md + - name: Publish the Release + uses: softprops/action-gh-release@v1 + with: + body_path: RELEASE_BODY.md + tag_name: ${{ matrix.tag }} + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml new file mode 100644 index 00000000..51161880 --- /dev/null +++ b/.github/workflows/unit-tests.yaml @@ -0,0 +1,25 @@ +name: unit tests + +on: + - pull_request + +jobs: + tests: + runs-on: ubuntu-latest + env: + npm_config_user: "root" + steps: + - name: "checkout repo" + uses: actions/checkout@v3 + - name: "nodejs install" + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Install Protoc + uses: arduino/setup-protoc@v1 + - name: install yarn + run: npm install --global yarn + - name: "setup" + run: yarn setup + - name: "test" + run: yarn test diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..0456d086 --- /dev/null +++ b/.gitignore @@ -0,0 +1,146 @@ +# Created by https://www.toptal.com/developers/gitignore/api/node +# Edit at https://www.toptal.com/developers/gitignore?templates=node + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* +.DS_Store/ +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache + +# SvelteKit build / generate output +.svelte-kit +.idea +/common/types/client/ +/common/types/lcd/ +# End of https://www.toptal.com/developers/gitignore/api/node \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..3224a903 --- /dev/null +++ b/.npmignore @@ -0,0 +1,144 @@ +# Created by https://www.toptal.com/developers/gitignore/api/node +# Edit at https://www.toptal.com/developers/gitignore?templates=node + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache + +# SvelteKit build / generate output +.svelte-kit + +# End of https://www.toptal.com/developers/gitignore/api/node \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..3224a903 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,144 @@ +# Created by https://www.toptal.com/developers/gitignore/api/node +# Edit at https://www.toptal.com/developers/gitignore?templates=node + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache + +# SvelteKit build / generate output +.svelte-kit + +# End of https://www.toptal.com/developers/gitignore/api/node \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..21e34717 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2022 BCP Innovations UG (haftungsbeschränkt) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 00000000..3a112b39 --- /dev/null +++ b/README.md @@ -0,0 +1,65 @@ +
+

@kyvejs

+
+ +![banner](https://arweave.net/RkC-azeak1eOQGOLSaPNzHo-ORc-cWgnmdJnSScedFE) + +

+Tools for building applications on KYVE +

+ +KYVE, the Web3 data lake solution, is a protocol that enables data providers to standardize, validate, and permanently store blockchain data streams. By leveraging permanent data storage solutions like Arweave, KYVE’s Cosmos SDK chain creates permanent backups and ensures the scalability, immutability, and availability of these resources over time. + +## Project Overview + +**Common:** + +- [@kyvejs/types](common/types/README.md) - holds all types for the KYVE application in typescript +- [@kyvejs/sdk](common/sdk/README.md) - development kit for communicating with the KYVE blockchain +- [@kyvejs/protocol](common/protocol/README.md) - core functionality for running validators on the KYVE network + +**Tools:** + +- [@kyvejs/kysor](tools/kysor/README.md) - The Cosmovisor of KYVE + +**Integrations:** + +- [@kyvejs/bitcoin](integrations/bitcoin/README.md) - The official KYVE Bitcoin integration +- [@kyvejs/celo](integrations/celo/README.md) - The official KYVE Celo integration +- [@kyvejs/cosmos](integrations/cosmos/README.md) - The official KYVE Cosmos integration +- [@kyvejs/evm](integrations/evm/README.md) - The official KYVE EVM integration + +## How to contribute + +Clone the repository: + +```bash +git clone git@github.com:KYVENetwork/kyvejs.git +``` + +Checkout repository: + +```bash +cd kyvejs +``` + +Checkout new branch to implement new features/fixes there + +```bash +git checkout -b [feat/fix]/[my-branch-name] +``` + +Install dependencies with yarn: + +```bash +yarn install +``` + +Bootstrap and build project: + +``` +yarn setup +``` + +Apply your changes and create a Pull Request to `main`. Once the team has +reviewed and approved your PR it can be merged and used. diff --git a/common/protocol/.gitignore b/common/protocol/.gitignore new file mode 100644 index 00000000..31cb8bcb --- /dev/null +++ b/common/protocol/.gitignore @@ -0,0 +1,667 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,macos,windows,node,webstorm+all + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +# dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache +.stylelintcache + +# SvelteKit build / generate output +.svelte-kit + +### WebStorm+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### WebStorm+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Nuget personal access tokens and Credentials +# nuget.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs + +# JetBrains Rider +*.sln.iml + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all \ No newline at end of file diff --git a/common/protocol/.prettierignore b/common/protocol/.prettierignore new file mode 100644 index 00000000..31cb8bcb --- /dev/null +++ b/common/protocol/.prettierignore @@ -0,0 +1,667 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,macos,windows,node,webstorm+all + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +# dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache +.stylelintcache + +# SvelteKit build / generate output +.svelte-kit + +### WebStorm+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### WebStorm+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Nuget personal access tokens and Credentials +# nuget.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs + +# JetBrains Rider +*.sln.iml + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all \ No newline at end of file diff --git a/common/protocol/LICENSE b/common/protocol/LICENSE new file mode 100644 index 00000000..21e34717 --- /dev/null +++ b/common/protocol/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2022 BCP Innovations UG (haftungsbeschränkt) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/common/protocol/README.md b/common/protocol/README.md new file mode 100644 index 00000000..4d3c0005 --- /dev/null +++ b/common/protocol/README.md @@ -0,0 +1,88 @@ +
+

@kyvejs/protocol

+
+ +![banner](https://arweave.net/WK6XCKv12mV8bN9KTJtQDR73_B0BVDfxA4MD0G5AlpE) + +# Architecture Overview + +The KYVE protocol node is in general responsible for collecting data from various sources and submitting them +for validation to the KYVE network. It does that by transforming the data, packaging it in bundles and storing +them on permanent storage providers like Arweave, where other protocol nodes can retrieve and validate them +for their correctness. + +During all that time KYVE protocol nodes are communicating with the KYVE blockchain, a cosmos-sdk based PoS chain +providing the main KYVE logic of registering bundle proposals and keeping track of votes. + +## General protocol node architecture + +The basic architecture of a protocol node can be found below: + +
+
+ +

+ +

+ +
+
+ +**Overview** + +- **KYVE blockchain** - a cosmos-sdk based PoS blockchain which has all the KYVE logic and is responsible for scheduling bundle proposal rounds and keeping track of bundle proposals and their respected votes from protocol nodes +- **Permanent Storage** - usually web3 permanent storage providers like Arweave. This is the place where all validated data from KYVE will be archived +- **Local Node Cache** - a local Key-Value-Store on the protocol node for caching all the data which is currently in the validation process +- **Data Sources** - data sources defined by the storage pool. There can be multiple data sources or only one. Examples for data sources can be blockchain rpc endpoints or web2 api endpoints which need to be validated and archived +- **Proposal Round Cyclic Updates** - schedules both main threads when to start collecting data or when to start validating/uploading bundle proposals. This schedule is dictated by the KYVE blockchain +- **Data Collection Thread** - the main thread collecting the required data for the current proposal round. It requests all given data sources defined on the storage pool and writes them to the local node cache +- **Data Indexing Thread** - the main thread validating proposed bundles proposals from other protocol nodes and proposing new bundle proposals to the network. It communicates closely with the KYVE blockchain and reads all the cached items for validation and proposition. Also for validation and proposition it reads and writes data to the permanent storage provider + +
+
+ +## Data collection thread overview + +A more detailed architecture overview of the data collection thread can be found below: + +
+
+ +

+ +

+ +
+
+ +- **core logic (red)** - all the logic controlled by `@kyve/core` +- **runtime logic (blue)** - all the custom logic defined by the `runtime`. This is very application specific +- **external data sources (green)** - data sources defined on the storage pool which should be validated and archived +- **Key-Value-Store (yellow)** - a local Key-Value-Store which serves as cache for the protocol node + +
+
+ +## Data indexing thread overview + +A more detailed architecture overview of the data indexing thread can be found below: + +
+
+ +

+ +

+ +
+
+ +- **core logic (red)** - all the logic controlled by `@kyve/core` +- **runtime logic (blue)** - all the custom logic defined by the `runtime`. This is very application specific +- **external data sources (green)** - data sources defined on the storage pool which should be validated and archived +- **Key-Value-Store (yellow)** - a local Key-Value-Store which serves as cache for the protocol node +- **Permanent Storage (grey)** - a web3 permanent storage provider like Arweave where all the validated data from KYVE gets archived +- **KYVE blockchain (orange)** - the KYVE chain which keeps track of bundle proposals and votes + +
+
diff --git a/common/protocol/jest.config.js b/common/protocol/jest.config.js new file mode 100644 index 00000000..21a1e973 --- /dev/null +++ b/common/protocol/jest.config.js @@ -0,0 +1,5 @@ +/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ +module.exports = { + preset: "ts-jest", + testEnvironment: "node", +}; diff --git a/common/protocol/package.json b/common/protocol/package.json new file mode 100644 index 00000000..20e30229 --- /dev/null +++ b/common/protocol/package.json @@ -0,0 +1,58 @@ +{ + "name": "@kyvejs/protocol", + "version": "1.0.0-beta.0", + "main": "./dist/src/index.js", + "types": "./dist/src/index.d.ts", + "repository": { + "type": "git", + "url": "git+https://github.com/KYVENetwork/kyvejs.git" + }, + "author": "Troy Kessler , John Letey , ruslan glaznyov ", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "rimraf dist && yarn format && tsc", + "test": "jest", + "format": "prettier --write .", + "doc": "typedoc" + }, + "dependencies": { + "@bundlr-network/client": "^0.8.9", + "@cosmjs/proto-signing": "^0.27.1", + "@cosmjs/stargate": "^0.27.1", + "@kyvejs/sdk": "1.0.0-beta.0", + "@kyvejs/types": "1.0.0-beta.0", + "@types/cli-progress": "^3.9.2", + "@types/jsonfile": "^6.0.1", + "arweave": "^1.10.17", + "axios": "^0.24.0", + "bignumber.js": "^9.0.1", + "commander": "^9.4.1", + "fs-extra": "^10.0.1", + "jsonfile": "^6.1.0", + "level": "^8.0.0", + "prando": "^6.0.1", + "prom-client": "^14.1.0", + "protobufjs": "^6.11.2", + "seedrandom": "^3.0.5", + "tslog": "^3.2.2", + "unique-names-generator": "^4.6.0" + }, + "devDependencies": { + "@types/fs-extra": "^9.0.13", + "@types/jest": "^28.1.7", + "@types/node": "^18.11.9", + "@types/node-fetch": "^2.6.2", + "@types/object-hash": "^2.2.1", + "@types/seedrandom": "^3.0.2", + "@types/semver": "^7.3.9", + "jest": "^28.1.3", + "prettier": "^2.4.1", + "rimraf": "^3.0.2", + "ts-jest": "^28.0.8", + "typedoc": "^0.22.17", + "typescript": "^4.4.3" + } +} diff --git a/common/protocol/src/commander/index.ts b/common/protocol/src/commander/index.ts new file mode 100644 index 00000000..5c58fd8f --- /dev/null +++ b/common/protocol/src/commander/index.ts @@ -0,0 +1 @@ +export * from "./parser"; diff --git a/common/protocol/src/commander/parser.ts b/common/protocol/src/commander/parser.ts new file mode 100644 index 00000000..d32796d4 --- /dev/null +++ b/common/protocol/src/commander/parser.ts @@ -0,0 +1,52 @@ +import commander from "commander"; +import { existsSync } from "fs"; + +export const parsePoolId = (value: string): number => { + const parsedValue = parseInt(value); + + if (isNaN(parsedValue)) { + throw new commander.InvalidArgumentError("PoolId must be of type number."); + } + return parsedValue; +}; + +export const parseMnemonic = (value: string): string => { + const parsedValue = value.split(" "); + + if (!(parsedValue.length === 12 || parsedValue.length === 24)) { + throw new commander.InvalidArgumentError( + "Mnemonic must have 12 or 24 words." + ); + } + return value; +}; + +export const parseKeyfile = (value: string): string => { + if (!existsSync(value)) { + throw new commander.InvalidArgumentError( + `Keyfile does not exist in path ${value}.` + ); + } + + return value; +}; + +export const parseNetwork = (value: string): string => { + if (!["local", "alpha", "beta", "korellia"].includes(value)) { + throw new commander.InvalidArgumentError( + "Network must be either 'local', 'alpha', 'beta' or 'korellia'." + ); + } + + return value; +}; + +export const parseCache = (value: string): string => { + if (!["memory", "jsonfile"].includes(value)) { + throw new commander.InvalidArgumentError( + "Cache must be either 'memory' or 'jsonfile'." + ); + } + + return value; +}; diff --git a/common/protocol/src/index.ts b/common/protocol/src/index.ts new file mode 100644 index 00000000..a38ce908 --- /dev/null +++ b/common/protocol/src/index.ts @@ -0,0 +1,312 @@ +import { PoolResponse } from "@kyvejs/types/lcd/kyve/query/v1beta1/pools"; +import KyveSDK, { KyveClient, KyveLCDClientType } from "@kyvejs/sdk"; +import { Command, OptionValues } from "commander"; +import os from "os"; +import { Logger } from "tslog"; + +import { version as protocolVersion } from "../package.json"; +import { + parseCache, + parseMnemonic, + parseNetwork, + parsePoolId, +} from "./commander"; +import { + canPropose, + canVote, + claimUploaderRole, + compressionFactory, + continueRound, + createBundleProposal, + getBalances, + runCache, + runNode, + saveBundleDecompress, + saveBundleDownload, + saveGetTransformDataItem, + saveLoadValidationBundle, + setupCacheProvider, + setupLogger, + setupMetrics, + setupSDK, + setupValidator, + skipUploaderRole, + storageProviderFactory, + submitBundleProposal, + syncPoolConfig, + syncPoolState, + validateBundleProposal, + validateIsNodeValidator, + validateIsPoolActive, + validateRuntime, + validateStorageBalance, + validateVersion, + voteBundleProposal, + waitForAuthorization, + waitForCacheContinuation, + waitForNextBundleProposal, + waitForUploadInterval, + getProxyAuth, +} from "./methods"; +import { ICacheProvider, IMetrics, IRuntime } from "./types"; +import { standardizeJSON } from "./utils"; + +/** + * Main class of KYVE protocol nodes representing a validator node. + * + * @class Validator + * @constructor + */ +export class Validator { + // reactor attributes + protected runtime!: IRuntime; + protected cacheProvider!: ICacheProvider; + + // sdk attributes + public sdk!: KyveSDK; + public client!: KyveClient; + public lcd!: KyveLCDClientType; + + // node attributes + public protocolVersion!: string; + public pool!: PoolResponse; + public poolConfig!: any; + public name!: string; + + // logger attributes + public logger!: Logger; + + // metrics attributes + public m!: IMetrics; + + // node option attributes + protected poolId!: number; + protected staker!: string; + protected valaccount!: string; + protected storagePriv!: string; + protected network!: string; + protected rpc!: string; + protected rest!: string; + protected cache!: string; + protected debug!: boolean; + protected metrics!: boolean; + protected metricsPort!: number; + protected home!: string; + + // setups + protected setupLogger = setupLogger; + protected setupCacheProvider = setupCacheProvider; + protected setupMetrics = setupMetrics; + protected setupSDK = setupSDK; + protected setupValidator = setupValidator; + + // checks + protected validateRuntime = validateRuntime; + protected validateVersion = validateVersion; + protected validateIsNodeValidator = validateIsNodeValidator; + protected validateIsPoolActive = validateIsPoolActive; + + // timeouts + protected waitForAuthorization = waitForAuthorization; + protected waitForUploadInterval = waitForUploadInterval; + protected waitForNextBundleProposal = waitForNextBundleProposal; + protected waitForCacheContinuation = waitForCacheContinuation; + + // helpers + protected continueRound = continueRound; + protected saveGetTransformDataItem = saveGetTransformDataItem; + public getProxyAuth = getProxyAuth; + + // factories + protected storageProviderFactory = storageProviderFactory; + protected compressionFactory = compressionFactory; + + // txs + protected claimUploaderRole = claimUploaderRole; + protected skipUploaderRole = skipUploaderRole; + protected voteBundleProposal = voteBundleProposal; + protected submitBundleProposal = submitBundleProposal; + + // queries + protected syncPoolState = syncPoolState; + protected syncPoolConfig = syncPoolConfig; + protected getBalances = getBalances; + protected canVote = canVote; + protected canPropose = canPropose; + + // validate + protected saveBundleDownload = saveBundleDownload; + protected saveBundleDecompress = saveBundleDecompress; + protected saveLoadValidationBundle = saveLoadValidationBundle; + protected validateBundleProposal = validateBundleProposal; + protected validateStorageBalance = validateStorageBalance; + + // upload + protected createBundleProposal = createBundleProposal; + + // main + protected runNode = runNode; + protected runCache = runCache; + + /** + * Constructor for the validator class. It is required to provide the + * runtime class here in order to run the + * + * @method constructor + * @param {IRuntime} runtime which implements the interface IRuntime + */ + constructor(runtime: IRuntime) { + // set provided runtime + this.runtime = runtime; + + // set @kyvejs/protocol version + this.protocolVersion = protocolVersion; + } + + /** + * Bootstrap method for protocol node. It initializes all commands including + * the main program which can be called with "start" + * + * @method bootstrap + * @return {void} + */ + public bootstrap(): void { + // define main program + const program = new Command(); + + // define version command + program + .command("version") + .description("Print runtime and protocol version") + .action(() => { + console.log(`${this.runtime.name} version: ${this.runtime.version}`); + console.log(`@kyvejs/protocol version: ${this.protocolVersion}`); + console.log(`Validator version: ${process.version}`); + console.log(); + console.log(`Platform: ${os.platform()}`); + console.log(`Arch: ${os.arch()}`); + }); + + // define start command + program + .command("start") + .description("Run the protocol node") + .requiredOption( + "--pool ", + "The ID of the pool this valaccount should participate as a validator", + parsePoolId + ) + .requiredOption( + "--valaccount ", + "The mnemonic of the valaccount", + parseMnemonic + ) + .requiredOption( + "--storage-priv ", + "The private key of the storage provider" + ) + .requiredOption( + "--network ", + "The network of the KYVE chain", + parseNetwork + ) + .option( + "--rpc", + "Custom rpc endpoint the node uses for submitting transactions to chain" + ) + .option( + "--rest", + "Custom rest api endpoint the node uses for querying from chain" + ) + .option( + "--cache ", + "The cache this node should use", + parseCache, + "jsonfile" + ) + .option("--debug", "Run the validator node in debug mode") + .option( + "--verbose", + "[DEPRECATED] Run the validator node in verbose logging mode" + ) + .option( + "--metrics", + "Start a prometheus metrics server on http://localhost:8080/metrics" + ) + .option( + "--metrics-port ", + "Specify the port of the metrics server. Only considered if '--metrics' is set [default = 8080]", + "8080" + ) + .option( + "--home ", + "Specify the home directory of the node where logs and the cache should save their data. [default current directory]", + "./" + ) + .action((options) => { + this.start(options); + }); + + // bootstrap program + program.parse(); + } + + /** + * Main method of @kyvejs/protocol. By running this method the node will start and run. + * For this method to run the Runtime, Storage Provider and the Cache have to be added first. + * + * This method will run indefinetely and only exits on specific exit conditions like running + * an incorrect runtime or version. + * + * @method start + * @param {OptionValues} options contains all node options defined in bootstrap + * @return {Promise} + */ + private async start(options: OptionValues): Promise { + // assign program options + // to node instance + this.poolId = options.pool; + this.valaccount = options.valaccount; + this.storagePriv = options.storagePriv; + this.network = options.network; + this.rpc = options.rpc; + this.rest = options.rest; + this.cache = options.cache; + this.debug = options.debug; + this.metrics = options.metrics; + this.metricsPort = options.metricsPort; + this.home = options.home; + + // perform setups + this.setupLogger(); + this.setupMetrics(); + + // perform async setups + await this.setupSDK(); + await this.syncPoolState(); + await this.validateStorageBalance(); + await this.setupValidator(); + await this.setupCacheProvider(); + + // start the node process. Validator and cache should run at the same time. + // Thats why, although they are async they are called synchronously + try { + this.runNode(); + this.runCache(); + } catch (err) { + this.logger.fatal(`Unexpected runtime error. Exiting ...`); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } + } +} + +// export commander +export * from "./commander"; + +// export types +export * from "./types"; + +// export utils +export * from "./utils"; diff --git a/common/protocol/src/methods/checks/validateIsNodeValidator.ts b/common/protocol/src/methods/checks/validateIsNodeValidator.ts new file mode 100644 index 00000000..07f28c4b --- /dev/null +++ b/common/protocol/src/methods/checks/validateIsNodeValidator.ts @@ -0,0 +1,36 @@ +import { Validator, standardizeJSON } from "../.."; + +/** + * validateIsNodeValidator checks if the staker of the node is in the + * active validator set of the pool. If the staker is not a validator + * the node will exit. + * + * @method validateIsNodeValidator + * @param {Validator} this + * @return {void} + */ +export function validateIsNodeValidator(this: Validator): void { + try { + this.logger.debug( + `Validating if node operator is included in pool stakers` + ); + + if (!this.pool.stakers.includes(this.staker)) { + this.logger.fatal( + `Validator is not in the active validator set! Exiting ...` + ); + process.exit(1); + } + + this.logger.info( + `Validator running as validator in storage pool = ${this.pool.data!.name}` + ); + } catch (err) { + this.logger.fatal( + `Error while validating if node is a validator. Exiting ...` + ); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } +} diff --git a/common/protocol/src/methods/checks/validateIsPoolActive.ts b/common/protocol/src/methods/checks/validateIsPoolActive.ts new file mode 100644 index 00000000..9572aca1 --- /dev/null +++ b/common/protocol/src/methods/checks/validateIsPoolActive.ts @@ -0,0 +1,46 @@ +import { PoolStatus } from "@kyvejs/types/lcd/kyve/pool/v1beta1/pool"; + +import { Validator } from "../.."; + +/** + * validateIsPoolActive checks if the pool is active or not. + * It returns true or false, wether it is active or not. + * + * @method validateIsPoolActive + * @param {Validator} this + * @return {boolean} + */ +export function validateIsPoolActive(this: Validator): boolean { + this.logger.debug(`Validating if pool is active: ${this.pool.status}`); + + switch (this.pool.status as PoolStatus) { + case PoolStatus.POOL_STATUS_ACTIVE: + return false; + case PoolStatus.POOL_STATUS_PAUSED: + this.logger.info( + "Pool is paused. Waiting for pool being unpaused. Idling ..." + ); + return true; + case PoolStatus.POOL_STATUS_NO_FUNDS: + this.logger.info( + "Pool is out of funds. Waiting for additional funds. Idling ..." + ); + return true; + case PoolStatus.POOL_STATUS_NOT_ENOUGH_DELEGATION: + this.logger.info( + "Not enough delegation in pool. Waiting for additional delegation. Idling ..." + ); + return true; + case PoolStatus.POOL_STATUS_UPGRADING: + this.logger.info( + "Pool is currently upgrading. Waiting for upgrade being applied. Idling ..." + ); + return true; + case PoolStatus.POOL_STATUS_UNSPECIFIED: + this.logger.info("Pool status is currently unspecified. Idling ..."); + return true; + default: + this.logger.info("Pool status is currently unknown. Idling ..."); + return true; + } +} diff --git a/common/protocol/src/methods/checks/validateRuntime.ts b/common/protocol/src/methods/checks/validateRuntime.ts new file mode 100644 index 00000000..b88f5bc1 --- /dev/null +++ b/common/protocol/src/methods/checks/validateRuntime.ts @@ -0,0 +1,32 @@ +import { Validator, standardizeJSON } from "../.."; + +/** + * validateRuntime checks if the runtime of the pool matches with the runtime of + * the node. If it does not match the node will exit. + * + * @method validateRuntime + * @param {Validator} this + * @return {void} + */ +export function validateRuntime(this: Validator): void { + try { + this.logger.debug(`Comparing pool runtime with protocol node runtime`); + + if (this.pool.data!.runtime !== this.runtime.name) { + this.logger.fatal( + `Specified pool does not match the integration runtime! Exiting ...` + ); + this.logger.fatal( + `Found = ${this.runtime.name} required = ${this.pool.data!.runtime}` + ); + process.exit(1); + } + + this.logger.info(`Validator running on runtime = ${this.runtime.name}`); + } catch (err) { + this.logger.fatal(`Error while validating runtime. Exiting ...`); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } +} diff --git a/common/protocol/src/methods/checks/validateStorageBalance.ts b/common/protocol/src/methods/checks/validateStorageBalance.ts new file mode 100644 index 00000000..834b4e22 --- /dev/null +++ b/common/protocol/src/methods/checks/validateStorageBalance.ts @@ -0,0 +1,48 @@ +import BigNumber from "bignumber.js"; +import { Validator, standardizeJSON } from "../.."; + +/** + * validateStorageBalance checks if the account of the storage provider + * has more than 0$ funds available + * + * @method validateStorageBalance + * @param {Validator} this + * @return {Promise} + */ +export async function validateStorageBalance(this: Validator): Promise { + try { + const storageProvider = await this.storageProviderFactory( + this.pool.data?.current_storage_provider_id ?? 0 + ); + + this.logger.info( + `Checking account balance on StorageProvider:${storageProvider.name}` + ); + + const address = await storageProvider.getAddress(); + const balance = await storageProvider.getBalance(); + + this.logger.debug(`Account "${address}" has "${balance}" balance`); + + if (new BigNumber(balance).isZero()) { + this.logger.fatal( + `Account on StorageProvider:${storageProvider.name} has zero funds! Exiting ...` + ); + this.logger.fatal( + `Provide some funds to the following account: ${address}` + ); + process.exit(1); + } + + this.logger.info( + `Account has available funds on StorageProvider:${storageProvider.name}` + ); + } catch (err) { + this.logger.fatal( + `Error while validating storage provider funds. Exiting ...` + ); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } +} diff --git a/common/protocol/src/methods/checks/validateVersion.ts b/common/protocol/src/methods/checks/validateVersion.ts new file mode 100644 index 00000000..5923d3e0 --- /dev/null +++ b/common/protocol/src/methods/checks/validateVersion.ts @@ -0,0 +1,36 @@ +import { Validator, standardizeJSON } from "../.."; + +/** + * validateVersion checks if the version of the pool matches with the runtime + * version of the node. If it does not match the node will exit. + * + * @method validateVersion + * @param {Validator} this + * @return {void} + */ +export function validateVersion(this: Validator): void { + try { + this.logger.debug( + `Comparing pool runtime version with protocol node runtime version` + ); + + if (this.pool.data!.protocol!.version !== this.runtime.version) { + this.logger.fatal(`Running an invalid version. Exiting ...`); + this.logger.fatal( + `Found Runtime version = ${this.runtime.version} required = ${ + this.pool.data!.protocol!.version + }` + ); + process.exit(1); + } + + this.logger.info( + `Validator running on runtime version = ${this.runtime.version}` + ); + } catch (err) { + this.logger.fatal(`Error while validating runtime version. Exiting ...`); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } +} diff --git a/common/protocol/src/methods/factories/compressionFactory.ts b/common/protocol/src/methods/factories/compressionFactory.ts new file mode 100644 index 00000000..db6ab454 --- /dev/null +++ b/common/protocol/src/methods/factories/compressionFactory.ts @@ -0,0 +1,29 @@ +import { Validator } from "../.."; +import { ICompression } from "../.."; +import { Gzip } from "../../reactors/compression/Gzip"; +import { NoCompression } from "../../reactors/compression/NoCompression"; + +/** + * compressionFactory creates the correct compression class + * from the specified id. Current compression types are: + * + * 0 - NoCompression + * 1 - Gzip + * x - NoCompression (default) + * + * @method compressionFactory + * @param {Validator} this + * @param {number} compressionId the id of the compression + * @return {ICompression} + */ +export function compressionFactory( + this: Validator, + compressionId: number +): ICompression { + switch (compressionId) { + case 1: + return new Gzip(); + default: + return new NoCompression(); + } +} diff --git a/common/protocol/src/methods/factories/storageProviderFactory.ts b/common/protocol/src/methods/factories/storageProviderFactory.ts new file mode 100644 index 00000000..0e6f6412 --- /dev/null +++ b/common/protocol/src/methods/factories/storageProviderFactory.ts @@ -0,0 +1,33 @@ +import { Validator } from "../.."; +import { IStorageProvider } from "../.."; +import { Arweave } from "../../reactors/storageProviders/Arweave"; +import { Bundlr } from "../../reactors/storageProviders/Bundlr"; +import { NoStorageProvider } from "../../reactors/storageProviders/NoStorageProvider"; + +/** + * storageProviderFactory creates the correct storage provider class + * from the specified id. Current storage providers are: + * + * 0 - NoStorageProvider + * 1 - Arweave + * 2 - Bundlr + * x - NoStorageProvider (default) + * + * @method storageProviderFactory + * @param {Validator} this + * @param {number} storageProviderId the id of the storage provider + * @return {Promise} + */ +export async function storageProviderFactory( + this: Validator, + storageProviderId: number +): Promise { + switch (storageProviderId) { + case 1: + return await new Arweave().init(this.storagePriv); + case 2: + return await new Bundlr().init(this.storagePriv); + default: + return await new NoStorageProvider().init(this.storagePriv); + } +} diff --git a/common/protocol/src/methods/helpers/continueRound.ts b/common/protocol/src/methods/helpers/continueRound.ts new file mode 100644 index 00000000..8632213d --- /dev/null +++ b/common/protocol/src/methods/helpers/continueRound.ts @@ -0,0 +1,14 @@ +import { Validator } from "../.."; + +/** + * continueRound is only used for test purposes to allow easier unit testing. + * It will always return true and is mocked in unit tests to control the number + * of proposal rounds. + * + * @method continueRound + * @param {Validator} this + * @return {boolean} + */ +export function continueRound(this: Validator): boolean { + return true; +} diff --git a/common/protocol/src/methods/helpers/getProxyAuth.ts b/common/protocol/src/methods/helpers/getProxyAuth.ts new file mode 100644 index 00000000..c4aaa16a --- /dev/null +++ b/common/protocol/src/methods/helpers/getProxyAuth.ts @@ -0,0 +1,30 @@ +import { Validator } from "../.."; + +/** + * getProxyAuth is used for authenticating the protocol node + * for the proxy by signing messages including the pool id + * the validator is currently in + * + * @method getProxyAuth + * @param {Validator} this + * @return {Promise<{ [key: string]: string | number; }>} + */ +export async function getProxyAuth( + this: Validator +): Promise<{ [key: string]: string | number }> { + const address = this.client.account.address; + const timestamp = new Date().valueOf().toString(); + const poolId = this.pool.id; + + const { signature, pub_key } = await this.client.signString( + `${address}//${poolId}//${timestamp}` + ); + + return { + "Content-Type": "application/json", + Signature: `${signature}`, + "Public-Key": pub_key.value, + "Pool-ID": poolId, + Timestamp: timestamp, + }; +} diff --git a/common/protocol/src/methods/helpers/saveGetTransformDataItem.ts b/common/protocol/src/methods/helpers/saveGetTransformDataItem.ts new file mode 100644 index 00000000..b801c2bb --- /dev/null +++ b/common/protocol/src/methods/helpers/saveGetTransformDataItem.ts @@ -0,0 +1,69 @@ +import { + callWithBackoffStrategy, + DataItem, + Validator, + standardizeJSON, +} from "../.."; + +/** + * saveGetTransformDataItem gets the data item with a backoff strategy + * + * @method saveGetTransformDataItem + * @param {Validator} this + * @param {string} source + * @param {string} key + * @return {Promise} + */ +export async function saveGetTransformDataItem( + this: Validator, + source: string, + key: string +): Promise { + // if item does not exist in cache yet collect it + return await callWithBackoffStrategy( + async () => { + // collect data item from runtime source + this.logger.debug(`this.runtime.getDataItem($THIS,${source},${key})`); + let item = await this.runtime.getDataItem(this, source, key); + + this.m.runtime_get_data_item_successful.inc(); + + // prevalidate data item and reject if it fails + this.logger.debug(`this.runtime.prevalidateDataItem($THIS,$ITEM)`); + const valid = await this.runtime.prevalidateDataItem(this, item); + + if (!valid) { + throw new Error( + `Prevalidation of data item with key ${key} and source ${source} failed.` + ); + } + + // transform data item + try { + this.logger.debug(`this.runtime.transformDataItem($ITEM)`); + item = await this.runtime.transformDataItem(this, item); + } catch (err) { + this.logger.error( + `Unexpected error transforming data item. Skipping transformation ...` + ); + this.logger.error(standardizeJSON(err)); + } + + return standardizeJSON(item); + }, + { + limitTimeoutMs: 5 * 60 * 1000, + increaseByMs: 10 * 1000, + }, + (err, ctx) => { + this.logger.info( + `Requesting getDataItem from source ${source} was unsuccessful. Retrying in ${( + ctx.nextTimeoutInMs / 1000 + ).toFixed(2)}s ...` + ); + this.logger.debug(standardizeJSON(err)); + + this.m.runtime_get_data_item_failed.inc(); + } + ); +} diff --git a/common/protocol/src/methods/index.ts b/common/protocol/src/methods/index.ts new file mode 100644 index 00000000..5ee03cd7 --- /dev/null +++ b/common/protocol/src/methods/index.ts @@ -0,0 +1,54 @@ +// setups +export * from "./setups/setupCacheProvider"; +export * from "./setups/setupLogger"; +export * from "./setups/setupMetrics"; +export * from "./setups/setupSDK"; +export * from "./setups/setupValidator"; + +// checks +export * from "./checks/validateIsNodeValidator"; +export * from "./checks/validateIsPoolActive"; +export * from "./checks/validateRuntime"; +export * from "./checks/validateVersion"; +export * from "./checks/validateStorageBalance"; + +// timeouts +export * from "./timeouts/waitForAuthorization"; +export * from "./timeouts/waitForCacheContinuation"; +export * from "./timeouts/waitForNextBundleProposal"; +export * from "./timeouts/waitForUploadInterval"; + +// helpers +export * from "./helpers/continueRound"; +export * from "./helpers/saveGetTransformDataItem"; +export * from "./helpers/getProxyAuth"; + +// factories +export * from "./factories/compressionFactory"; +export * from "./factories/storageProviderFactory"; + +// txs +export * from "./txs/claimUploaderRole"; +export * from "./txs/skipUploaderRole"; +export * from "./txs/submitBundleProposal"; +export * from "./txs/voteBundleProposal"; + +// queries +export * from "./queries/canPropose"; +export * from "./queries/canVote"; +export * from "./queries/getBalances"; +export * from "./queries/syncPoolConfig"; +export * from "./queries/syncPoolState"; + +// validate +export * from "./validate/saveBundleDecompress"; +export * from "./validate/saveBundleDownload"; +export * from "./validate/saveLoadValidationBundle"; +export * from "./validate/validateBundleProposal"; + +// upload +export * from "./upload/createBundleProposal"; + +// main +export * from "./main/runCache"; +export * from "./main/runNode"; diff --git a/common/protocol/src/methods/main/runCache.ts b/common/protocol/src/methods/main/runCache.ts new file mode 100644 index 00000000..71471be1 --- /dev/null +++ b/common/protocol/src/methods/main/runCache.ts @@ -0,0 +1,251 @@ +import seedrandom from "seedrandom"; + +import { DataItem, Validator } from "../.."; +import { generateIndexPairs, sleep, standardizeJSON } from "../../utils"; + +/** + * runCache is the other main execution thread for collecting data items + * which will get packed into bundles and submitted to the network + * in order to archive them. This method should run indefinitely. + * + * This method stays in sync with the bundle proposal rounds + * where the other main method "runNode" takes part. It works + * by running in parallel to the validation and submission of + * bundle proposals. When data needs to be validated or proposed + * the other method simply looks in the globally available cache + * and checks if this method already added some items into it. + * + * It starts by getting the current pool index and checking at + * from which index to which the node has to collect the data items + * in order to participate in the current proposal round. + * + * After a bundle proposal got finalized the cache gets cleared of + * all finalized data items since they are not needed anymore and + * starts collecting the data items which are needed for the + * following round. + * + * @method runCache + * @param {Validator} this + * @return {Promise} + */ +export async function runCache(this: Validator): Promise { + // run rounds indefinitely, continueRound returns always + // true and is only used by unit tests to control the termination of + // rounds by mocking it + while (this.continueRound()) { + try { + // if there is no storage id we can assume that the last + // bundle has been dropped or invalidated. In that case we + // reset the cache + if (!this.pool.bundle_proposal!.storage_id) { + this.logger.debug(`this.cacheProvider.drop()`); + await this.cacheProvider.drop(); + + this.m.cache_current_items.set(0); + } + + // determine the creation time of the current bundle proposal + // if the creation time ever increases this means a new bundle + // proposal is available + const updatedAt = parseInt(this.pool.bundle_proposal!.updated_at); + + // determine the current index of the pool. All data items + // before the current index can be deleted since they are already + // finalized. Data items should always be cached from this index + // and not before + const currentIndex = parseInt(this.pool.data!.current_index); + + // determine the target index. Here the target index is the + // index the cache should collect data in this particular round. + // We start from the current index and first index all the way + // to the current bundle proposal. Since the next uploader + // creates a bundle starting from the current bundle proposal + // we further index to the maximum possible bundle size ahead + const targetIndex = + currentIndex + + parseInt(this.pool.bundle_proposal!.bundle_size) + + parseInt(this.pool.data!.max_bundle_size); + + // delete all data items which came before the current index + // because they got finalized and are not needed anymore + this.logger.debug( + `Deleting data from index ${Math.max( + 0, + currentIndex - parseInt(this.pool.data!.max_bundle_size) + )} to index ${currentIndex}` + ); + + for ( + let i = Math.max( + 0, + currentIndex - parseInt(this.pool.data!.max_bundle_size) + ); + i < currentIndex; + i++ + ) { + try { + this.logger.debug(`this.cacheProvider.exists(${i.toString()})`); + const itemFound = await this.cacheProvider.exists(i.toString()); + + if (itemFound) { + this.logger.debug(`this.cacheProvider.del(${i.toString()})`); + await this.cacheProvider.del(i.toString()); + + this.m.cache_current_items.dec(); + } + } catch (err) { + this.logger.error( + `Unexpected error deleting data item ${i.toString()} from local cache. Continuing ...` + ); + this.logger.error(standardizeJSON(err)); + continue; + } + } + + this.m.cache_index_tail.set(Math.max(0, currentIndex - 1)); + + // determine the start key for the current caching round + // this key gets increased overtime to temp save the + // current key while collecting the data items + let key = this.pool.data!.current_key; + + // collect all data items from current pool index to + // the target index + this.logger.debug( + `Caching from index ${currentIndex} to index ${targetIndex}` + ); + + for (let i = currentIndex; i < targetIndex; i++) { + // if there are no sources abort + if ((this.poolConfig?.sources ?? []).length === 0) { + this.logger.info( + `Abort collecting data items. No sources found on pool config` + ); + break; + } + + // check if data item was already collected. If it was + // already collected we don't need to retrieve it again + this.logger.debug(`this.cacheProvider.exists(${i.toString()})`); + const itemFound = await this.cacheProvider.exists(i.toString()); + + // retrieve the next key from the deterministic runtime + // specific implementation. If the start key is not defined + // the pool is in genesis state and therefore the pool + // specific start key should be used + if (key) { + this.logger.debug(`this.runtime.nextKey(${key})`); + } + + const nextKey = key + ? await this.runtime.nextKey(this, key) + : this.pool.data!.start_key; + + if (!itemFound) { + // collect and transform data from every source at once + const results: DataItem[] = await Promise.all( + (this.poolConfig?.sources ?? []).map((source: string) => + this.saveGetTransformDataItem(source, nextKey) + ) + ); + + // validate if data items from those multiple sources are + // valid against each other + let valid = true; + + // we generate all possible index pairs so we can cross-validate + // each data item with every other data item to ensure that + // everything is correct + const indexPairs = generateIndexPairs(results.length); + + // validate every data item for each possible index pair + for (const pair of indexPairs) { + try { + // validate pair of data items + valid = await this.runtime.validateDataItem( + this, + results[pair[0]], + results[pair[1]] + ); + + // if an invalid data item pair was found abort and don't save + // to cache + if (!valid) { + this.logger.info( + `Found mismatching data item between sources ${ + this.poolConfig.sources[pair[0]] + } and ${this.poolConfig.sources[pair[1]]}` + ); + break; + } + } catch (err) { + this.logger.error( + `Unexpected error validating data items between sources ${ + this.poolConfig.sources[pair[0]] + } and ${this.poolConfig.sources[pair[1]]}` + ); + this.logger.error(standardizeJSON(err)); + + // if data item validation fails abort and don't save to cache + valid = false; + break; + } + } + + // if validation between sources fails we abort further data collection + if (!valid) { + break; + } + + // a random item from the result gets chosen. seed is the current item key + const seed = i.toString(); + // calculate randIndex in results range + const randIndex = Math.floor( + seedrandom(seed).quick() * results.length + ); + + this.logger.debug( + `Choosing item from seed:${seed} index:${randIndex} source:${this.poolConfig.sources[randIndex]}` + ); + + // add this data item to the cache + this.logger.debug(`this.cacheProvider.put(${i.toString()},$ITEM)`); + await this.cacheProvider.put(i.toString(), results[randIndex]); + + this.m.cache_current_items.inc(); + this.m.cache_index_head.set(i); + + // add a timeout so that the runtime data source + // is not overloaded with requests + await sleep(500); + } + + // assign the next key for the next round + key = nextKey; + } + + // wait until a new bundle proposal is available. We don't need + // to sync the pool here because the pool state already gets + // synced in the other main function "runNode" so we only listen + await this.waitForCacheContinuation(updatedAt); + } catch (err) { + this.logger.error( + `Unexpected error collecting data items to local cache. Continuing ...` + ); + this.logger.error(standardizeJSON(err)); + + try { + // drop cache if an unexpected error occurs during caching + this.logger.debug(`this.cacheProvider.drop()`); + await this.cacheProvider.drop(); + + this.m.cache_current_items.set(0); + } catch (dropError) { + this.logger.error( + `Unexpected error dropping local cache. Continuing ...` + ); + this.logger.error(standardizeJSON(dropError)); + } + } + } +} diff --git a/common/protocol/src/methods/main/runNode.ts b/common/protocol/src/methods/main/runNode.ts new file mode 100644 index 00000000..726a35a7 --- /dev/null +++ b/common/protocol/src/methods/main/runNode.ts @@ -0,0 +1,96 @@ +import { Validator } from "../.."; +import { IDLE_TIME, sleep } from "../../utils"; + +/** + * runNode is the main execution thread for validating and proposing bundles. + * It runs indefintitely in rounds and should only exit when basic validation + * checks fail. + * + * Each round looks the same. It starts by retrieving the latest + * state from the chain and checking if the pool is still active. After that + * it tries to claim the uploader role, then it tries to validate the current + * bundle proposal and last but not least it tries to upload the next bundle + * proposal. Between those actions are special waiting times and timeouts to + * stay in sync with the network. + * + * @method runNode + * @param {Validator} this + * @return {Promise} + */ +export async function runNode(this: Validator): Promise { + // run rounds indefinitely, continueRound returns always + // true and is only used by unit tests to control the termination of + // rounds by mocking it + while (this.continueRound()) { + // record entire proposal round time for metrics + const endTimeRound = this.m.bundles_round_time.startTimer(); + + // get latest state of the chain to start round + await this.syncPoolState(); + await this.getBalances(); + + // perform basic validation checks, if one fails exit + this.validateRuntime(); + this.validateVersion(); + this.validateIsNodeValidator(); + + // perform basic logic checks if pool is up and running, if it fails + // idle until pool is active again + if (this.validateIsPoolActive()) { + await sleep(IDLE_TIME); + endTimeRound(); + continue; + } + + // temp save proposal creation time to detect if a new proposal is + // available in the meantime + const updatedAt = parseInt(this.pool.bundle_proposal!.updated_at); + + // try to claim the uploader role of the current proposal round + if (await this.claimUploaderRole()) { + // get newest state of the chain if the claim was successful + await this.syncPoolState(); + } + + // log out the role of this node in this particular round + if (this.pool.bundle_proposal!.next_uploader === this.staker) { + this.logger.info( + `Participating in bundle proposal round ${ + this.pool.data!.total_bundles + } as UPLOADER` + ); + } else { + this.logger.info( + `Participating in bundle proposal round ${ + this.pool.data!.total_bundles + } as VALIDATOR` + ); + } + + // checks if the node is able to vote on the current bundle proposal + // by calling a special query from chain + if (await this.canVote(updatedAt)) { + // if the node can vote the node validates the current bundle proposal + await this.validateBundleProposal(updatedAt); + } + + // wait until the upload interval has passed to continue with the proposal + // of a new bundle. the node waits because a new round won't start during + // that time + await this.waitForUploadInterval(); + + // checks if the node is able to propose the bundle for the next round + // by calling a special query from chain + if (await this.canPropose(updatedAt)) { + // if node can propose the next bundle a proposal gets assembled, + // uploaded and submitted to the network + await this.createBundleProposal(); + } + + // wait until next bundle proposal is actually registered, until then idle + await this.waitForNextBundleProposal(updatedAt); + + // end bundle round time for metrics + endTimeRound(); + } +} diff --git a/common/protocol/src/methods/queries/canPropose.ts b/common/protocol/src/methods/queries/canPropose.ts new file mode 100644 index 00000000..dbb870f5 --- /dev/null +++ b/common/protocol/src/methods/queries/canPropose.ts @@ -0,0 +1,108 @@ +import { Validator } from "../.."; +import { callWithBackoffStrategy, sleep, standardizeJSON } from "../../utils"; +const INFINITY_LOOP = true; +/** + * canPropose checks if the node is able to propose the next + * bundle proposal by calling a special chain query called "canPropose". + * It runs indefinitely until the query returns a valid response + * + * @method canPropose + * @param {Validator} this + * @param {number} updatedAt the last update time of the current bundle proposal + * @return {Promise} + */ +export async function canPropose( + this: Validator, + updatedAt: number +): Promise { + try { + const canPropose = await callWithBackoffStrategy( + async () => { + await this.syncPoolState(); + + // get the index from where the bundle should get created + const fromIndex = + parseInt(this.pool.data!.current_index) + + parseInt(this.pool.bundle_proposal!.bundle_size); + + // abort if staker is the current uploader + if (this.pool.bundle_proposal!.next_uploader !== this.staker) { + return { + possible: false, + reason: "Validator is not next uploader of this bundle proposal", + }; + } + + // abort if a new bundle proposal was found + if (parseInt(this.pool.bundle_proposal!.updated_at) > updatedAt) { + return { + possible: false, + reason: "New bundle proposal was found", + }; + } + + // loop until a valid response has been returned. The invalid + // response here is the "upload interval not surpassed". If the query + // returns an "upload interval not surpassed" that usually + // means we have to wait for the next block in the blockchain + // because the chain time only updates on every new block + while (INFINITY_LOOP) { + this.logger.debug( + `this.lcd.kyve.query.v1beta1.canPropose({pool_id: ${this.poolId.toString()},staker: ${ + this.staker + },proposer: ${ + this.client.account.address + },from_index: ${fromIndex.toString()}})` + ); + + const canPropose = await this.lcd.kyve.query.v1beta1.canPropose({ + pool_id: this.poolId.toString(), + staker: this.staker, + proposer: this.client.account.address, + from_index: fromIndex.toString(), + }); + + // wait until a new block with an updated block time has been + // produced by the blockchain + if ( + !canPropose.possible && + canPropose.reason.endsWith("upload interval not surpassed") + ) { + await sleep(1000); + continue; + } + + return canPropose; + } + }, + { limitTimeoutMs: 5 * 60 * 1000, increaseByMs: 10 * 1000 }, + async (err: any, ctx) => { + this.logger.info( + `Requesting query canPropose was unsuccessful. Retrying in ${( + ctx.nextTimeoutInMs / 1000 + ).toFixed(2)}s ...` + ); + this.logger.debug(standardizeJSON(err)); + this.m.query_can_propose_failed.inc(); + } + ); + + this.logger.debug(JSON.stringify(canPropose)); + this.m.query_can_propose_successful.inc(); + + if (canPropose?.possible) { + this.logger.info(`Can propose next bundle proposal`); + return true; + } else { + this.logger.info( + `Skipping proposal. Reason: ${canPropose?.reason ?? "unknown"}` + ); + return false; + } + } catch (err) { + this.logger.error(`Failed to call canPropose`); + this.logger.error(standardizeJSON(err)); + + return false; + } +} diff --git a/common/protocol/src/methods/queries/canVote.ts b/common/protocol/src/methods/queries/canVote.ts new file mode 100644 index 00000000..d15f47b2 --- /dev/null +++ b/common/protocol/src/methods/queries/canVote.ts @@ -0,0 +1,90 @@ +import { Validator } from "../.."; +import { callWithBackoffStrategy, standardizeJSON } from "../../utils"; + +/** + * canVote checks if the node is able to vote on the current + * bundle proposal by calling a special chain query called "canVote". + * It runs indefinitely until the query returns a valid response + * + * @method canVote + * @param {Validator} this + * @param {number} updatedAt the last update time of the current bundle proposal + * @return {Promise} + */ +export async function canVote( + this: Validator, + updatedAt: number +): Promise { + try { + const canVote = await callWithBackoffStrategy( + async () => { + await this.syncPoolState(); + + // abort if staker is the current uploader + if (this.pool.bundle_proposal!.uploader === this.staker) { + return { + possible: false, + reason: "Validator is uploader of this bundle proposal", + }; + } + + // abort if bundle proposal is empty + if (!this.pool.bundle_proposal!.storage_id) { + return { + possible: false, + reason: "Current bundle proposal is empty", + }; + } + + // abort if a new bundle proposal was found + if (parseInt(this.pool.bundle_proposal!.updated_at) > updatedAt) { + return { + possible: false, + reason: "New bundle proposal was found", + }; + } + + this.logger.debug( + `this.lcd.kyve.query.v1beta1.canVote({pool_id: ${this.poolId.toString()},staker: ${ + this.staker + },voter: ${this.client.account.address},storage_id: ${ + this.pool.bundle_proposal!.storage_id + }})` + ); + + return await this.lcd.kyve.query.v1beta1.canVote({ + pool_id: this.poolId.toString(), + staker: this.staker, + voter: this.client.account.address, + storage_id: this.pool.bundle_proposal!.storage_id, + }); + }, + { limitTimeoutMs: 5 * 60 * 1000, increaseByMs: 10 * 1000 }, + async (err: any, ctx) => { + this.logger.info( + `Requesting query canVote was unsuccessful. Retrying in ${( + ctx.nextTimeoutInMs / 1000 + ).toFixed(2)}s ...` + ); + this.logger.debug(standardizeJSON(err)); + this.m.query_can_vote_failed.inc(); + } + ); + + this.logger.debug(JSON.stringify(canVote)); + this.m.query_can_vote_successful.inc(); + + if (canVote.possible) { + this.logger.info(`Can vote on bundle proposal`); + return true; + } else { + this.logger.info(`Skipping vote. Reason: ${canVote.reason}`); + return false; + } + } catch (err) { + this.logger.error(`Failed to call canVote`); + this.logger.error(standardizeJSON(err)); + + return false; + } +} diff --git a/common/protocol/src/methods/queries/getBalances.ts b/common/protocol/src/methods/queries/getBalances.ts new file mode 100644 index 00000000..e4490af1 --- /dev/null +++ b/common/protocol/src/methods/queries/getBalances.ts @@ -0,0 +1,86 @@ +import { DENOM, KYVE_DECIMALS } from "@kyvejs/sdk/dist/constants"; +import BigNumber from "bignumber.js"; + +import { Validator, standardizeJSON } from "../.."; + +/** + * getBalances tries to retrieve the $KYVE balance of the staker account, the $KYVE + * balance of the valaccount and the balance of the storage provider which + * can be of any currency for metrics + * + * @method getBalances + * @param {Validator} this + * @return {Promise} + */ +export async function getBalances(this: Validator): Promise { + try { + this.logger.debug( + `this.client.nativeClient.getBalance(${this.staker},${DENOM})` + ); + + const stakerBalanceRaw = await this.client.nativeClient.getBalance( + this.staker, + DENOM + ); + + this.logger.debug(JSON.stringify(stakerBalanceRaw)); + + const stakerBalance = new BigNumber(stakerBalanceRaw.amount) + .dividedBy(new BigNumber(10).exponentiatedBy(KYVE_DECIMALS)) + .toNumber(); + + this.m.balance_staker.set(stakerBalance); + } catch (err) { + this.logger.error(`Failed to get $KYVE balance of staker`); + this.logger.error(standardizeJSON(err)); + } + + try { + this.logger.debug( + `this.client.nativeClient.getBalance(${this.client.account.address},${DENOM})` + ); + + const valaccountBalanceRaw = await this.client.nativeClient.getBalance( + this.client.account.address, + DENOM + ); + + this.logger.debug(JSON.stringify(valaccountBalanceRaw)); + + const valaccountBalance = new BigNumber(valaccountBalanceRaw.amount) + .dividedBy(new BigNumber(10).exponentiatedBy(KYVE_DECIMALS)) + .toNumber(); + + this.m.balance_valaccount.set(valaccountBalance); + } catch (err) { + this.logger.error(`Failed to get $KYVE balance of valaccount`); + this.logger.error(standardizeJSON(err)); + } + + try { + // get current storage provider defined on pool + this.logger.debug( + `storageProviderFactory(${ + this.pool.data?.current_storage_provider_id ?? 0 + }, $STORAGE_PRIV)` + ); + const storageProvider = await this.storageProviderFactory( + this.pool.data?.current_storage_provider_id ?? 0 + ); + + this.logger.debug(`this.storageProvider.getBalance()`); + + const storageProviderBalanceRaw = await storageProvider.getBalance(); + + this.logger.debug(JSON.stringify(storageProviderBalanceRaw)); + + const storageProviderBalance = new BigNumber(storageProviderBalanceRaw) + .dividedBy(new BigNumber(10).exponentiatedBy(storageProvider.decimals)) + .toNumber(); + + this.m.balance_storage_provider.set(storageProviderBalance); + } catch (err) { + this.logger.error(`Failed to get balance of storage provider`); + this.logger.error(standardizeJSON(err)); + } +} diff --git a/common/protocol/src/methods/queries/syncPoolConfig.ts b/common/protocol/src/methods/queries/syncPoolConfig.ts new file mode 100644 index 00000000..46442cb3 --- /dev/null +++ b/common/protocol/src/methods/queries/syncPoolConfig.ts @@ -0,0 +1,47 @@ +import axios from "axios"; + +import { Validator } from "../.."; +import { standardizeJSON } from "../../utils"; + +/** + * syncPoolConfig fetches the pool config from the provided link + * and parses it into a json config + * + * @method syncPoolConfig + * @param {Validator} this + * @return {Promise} + */ +export async function syncPoolConfig(this: Validator): Promise { + try { + this.logger.debug(this.pool.data!.config); + + try { + this.poolConfig = JSON.parse(this.pool.data!.config); + return; + } catch {} + + let url: string; + + // allow ipfs:// or ar:// as external config urls + if (this.pool.data!.config.startsWith("ipfs://")) { + url = this.pool.data!.config.replace("ipfs://", "https://ipfs.io/"); + } else if (this.pool.data!.config.startsWith("ar://")) { + url = this.pool.data!.config.replace("ar://", "https://arweave.net/"); + } else { + throw Error("Unsupported config link protocol"); + } + + this.logger.debug(url); + const { data } = await axios.get(url); + + this.logger.debug(JSON.stringify(data)); + this.poolConfig = data; + } catch (err) { + this.logger.error(`Failed to sync pool config`); + this.logger.error(standardizeJSON(err)); + + if (!this.poolConfig) { + this.poolConfig = {}; + } + } +} diff --git a/common/protocol/src/methods/queries/syncPoolState.ts b/common/protocol/src/methods/queries/syncPoolState.ts new file mode 100644 index 00000000..b07d0177 --- /dev/null +++ b/common/protocol/src/methods/queries/syncPoolState.ts @@ -0,0 +1,48 @@ +import { Validator } from "../.."; +import { callWithBackoffStrategy, standardizeJSON } from "../../utils"; + +/** + * syncPoolState fetches the state of the pool the node is running on. + * The query gets called with a backoff strategy which increases by + * 10 seconds with every failed call. + * This method will run indefinitely if the query fails all the time + * because without the newest state the node can't continue. + * + * @method syncPoolState + * @param {Validator} this + * @return {Promise} + */ +export async function syncPoolState(this: Validator): Promise { + await callWithBackoffStrategy( + async () => { + this.logger.debug( + `this.lcd.kyve.query.v1beta1.pool({id: ${this.poolId.toString()}})` + ); + + const prevPoolConfig = this.pool?.data?.config ?? ""; + + const { pool } = await this.lcd.kyve.query.v1beta1.pool({ + id: this.poolId.toString(), + }); + this.pool = pool!; + + this.m.query_pool_successful.inc(); + + // if config link has changed sync the config + if (prevPoolConfig !== this.pool.data!.config) { + await this.syncPoolConfig(); + } + }, + { limitTimeoutMs: 5 * 60 * 1000, increaseByMs: 10 * 1000 }, + (err: any, ctx) => { + this.logger.info( + `Requesting query pool was unsuccessful. Retrying in ${( + ctx.nextTimeoutInMs / 1000 + ).toFixed(2)}s ...` + ); + this.logger.debug(standardizeJSON(err)); + + this.m.query_pool_failed.inc(); + } + ); +} diff --git a/common/protocol/src/methods/setups/setupCacheProvider.ts b/common/protocol/src/methods/setups/setupCacheProvider.ts new file mode 100644 index 00000000..d4929826 --- /dev/null +++ b/common/protocol/src/methods/setups/setupCacheProvider.ts @@ -0,0 +1,49 @@ +import path from "path"; + +import { Validator, standardizeJSON } from "../.."; +import * as cacheProvider from "../../reactors/cacheProvider"; +import fse from "fs-extra"; + +/** + * setupCacheProvider creates the cache provider for the node + * + * @method setupCacheProvider + * @param {Validator} this + * @return {Promise} + */ +export async function setupCacheProvider(this: Validator): Promise { + try { + // define cache path where the cached data is saved + // depending on work dir "home" + const cachePath = path.join(this.home, "cache"); + + this.logger.debug(`Initializing cache provider with path ${cachePath}`); + + // create cache provider depending on chosen cache type. + // Default is leveldb cache + switch (this.cache) { + case "memory": + this.cacheProvider = new cacheProvider.MemoryCache(); + break; + case "jsonfile": + this.cacheProvider = new cacheProvider.JsonFileCache(); + break; + default: + this.cacheProvider = new cacheProvider.JsonFileCache(); + } + + // delete all contents of cache directory + await fse.emptyDir(`${cachePath}/`); + + // init cache with work dir + this.logger.debug(`this.cacheProvider.init(${cachePath})`); + await this.cacheProvider.init(cachePath); + + this.logger.info(`Using cache provider: ${this.cacheProvider.name}`); + } catch (err) { + this.logger.fatal(`Failed to setup cache provider. Exiting ...`); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } +} diff --git a/common/protocol/src/methods/setups/setupLogger.ts b/common/protocol/src/methods/setups/setupLogger.ts new file mode 100644 index 00000000..111d1450 --- /dev/null +++ b/common/protocol/src/methods/setups/setupLogger.ts @@ -0,0 +1,88 @@ +import { appendFileSync, existsSync, mkdirSync } from "fs"; +import path from "path"; +import { ILogObject, Logger } from "tslog"; + +import { Validator, standardizeJSON } from "../.."; + +/** + * setupLogger creates the logger instance and defines the home and file + * where logs are saved for debugging. + * + * @method setupLogger + * @param {Validator} this + * @return {void} + */ +export function setupLogger(this: Validator): void { + try { + // if "logs" folder under target path does not exist create it + if (!existsSync(path.join(this.home, "logs"))) { + mkdirSync(path.join(this.home, "logs"), { recursive: true }); + } + + // name the log file after the time the node got started + const logFile = `${new Date().toISOString()}.log`; + + const logToTransport = (log: ILogObject) => { + const message = log.argumentsArray[0]; + + if (typeof message === "string") { + // don't save cache logs because this would bloat + // the local storage + if (message.startsWith("this.cache")) { + return; + } + + // don't save runtime logs because this would bloat + // the local storage + if (message.startsWith("this.runtime")) { + return; + } + } + + // format log message + let format = `${log.date.toISOString()} ${log.logLevel.toUpperCase()}\t[${ + log.fileName + }:${log.lineNumber}]`; + + for (const arg of log.argumentsArray) { + if (typeof arg === "string") { + format += ` ${arg}`; + } else { + format += ` ${JSON.stringify(arg)}`; + } + } + + // save logs to specified path target + appendFileSync(path.join(this.home, `logs`, logFile), format + "\n"); + }; + + // hide verbose logging information + const logger = new Logger({ + displayFilePath: "hidden", + displayFunctionName: this.debug, + }); + + // set log level depending on debug mode + // TODO @regenisis: remove deprecated "--verbose" option flag + logger.setSettings({ + minLevel: this.debug ? undefined : "info", + }); + + logger.attachTransport({ + silly: logToTransport, + debug: logToTransport, + trace: logToTransport, + info: logToTransport, + warn: logToTransport, + error: logToTransport, + fatal: logToTransport, + }); + + this.logger = logger; + } catch (err) { + this.logger.fatal(`Failed to init logger. Exiting ...`); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } +} diff --git a/common/protocol/src/methods/setups/setupMetrics.ts b/common/protocol/src/methods/setups/setupMetrics.ts new file mode 100644 index 00000000..648271a0 --- /dev/null +++ b/common/protocol/src/methods/setups/setupMetrics.ts @@ -0,0 +1,420 @@ +import http from "http"; +import prom_client, { register } from "prom-client"; +import url from "url"; + +import { IMetrics, Validator, standardizeJSON } from "../.."; + +/** + * setupMetrics initiates all metrics and starts if enabled a local prometheus + * metrics server + * + * @method setupMetrics + * @param {Validator} this + * @return {Promise} + */ +export function setupMetrics(this: Validator): void { + try { + // init metric parameters + this.m = {} as IMetrics; + + this.logger.debug(`Initializing metrics: prometheus default metrics`); + prom_client.collectDefaultMetrics({ + labels: { app: "kyve-validator" }, + }); + + // TX METRICS + + // MsgClaimUploaderRole metrics + this.logger.debug( + `Initializing metrics: tx_claim_uploader_role_successful` + ); + + this.m.tx_claim_uploader_role_successful = new prom_client.Counter({ + name: "tx_claim_uploader_role_successful", + help: "The amount of MsgClaimUploaderRole txs with receipt code = 0.", + }); + + this.logger.debug( + `Initializing metrics: tx_claim_uploader_role_unsuccessful` + ); + + this.m.tx_claim_uploader_role_unsuccessful = new prom_client.Counter({ + name: "tx_claim_uploader_role_unsuccessful", + help: "The amount of MsgClaimUploaderRole txs with receipt code != 0.", + }); + + this.logger.debug(`Initializing metrics: tx_claim_uploader_role_failed`); + + this.m.tx_claim_uploader_role_failed = new prom_client.Counter({ + name: "tx_claim_uploader_role_failed", + help: "The amount of MsgClaimUploaderRole txs that failed with an error", + }); + + // MsgVoteBundleProposal metrics + this.logger.debug( + `Initializing metrics: tx_vote_bundle_proposal_successful` + ); + + this.m.tx_vote_bundle_proposal_successful = new prom_client.Counter({ + name: "tx_vote_bundle_proposal_successful", + help: "The amount of MsgVoteBundleProposal txs with receipt code = 0.", + }); + + this.logger.debug( + `Initializing metrics: tx_vote_bundle_proposal_unsuccessful` + ); + + this.m.tx_vote_bundle_proposal_unsuccessful = new prom_client.Counter({ + name: "tx_vote_bundle_proposal_unsuccessful", + help: "The amount of MsgVoteBundleProposal txs with receipt code != 0.", + }); + + this.logger.debug(`Initializing metrics: tx_vote_bundle_proposal_failed`); + + this.m.tx_vote_bundle_proposal_failed = new prom_client.Counter({ + name: "tx_vote_bundle_proposal_failed", + help: "The amount of MsgVoteBundleProposal txs that failed with an error", + }); + + // MsgSubmitBundleProposal metrics + this.logger.debug( + `Initializing metrics: tx_submit_bundle_proposal_successful` + ); + + this.m.tx_submit_bundle_proposal_successful = new prom_client.Counter({ + name: "tx_submit_bundle_proposal_successful", + help: "The amount of MsgSubmitBundleProposal txs with receipt code = 0.", + }); + + this.logger.debug( + `Initializing metrics: tx_submit_bundle_proposal_unsuccessful` + ); + + this.m.tx_submit_bundle_proposal_unsuccessful = new prom_client.Counter({ + name: "tx_submit_bundle_proposal_unsuccessful", + help: "The amount of MsgSubmitBundleProposal txs with receipt code != 0.", + }); + + this.logger.debug(`Initializing metrics: tx_submit_bundle_proposal_failed`); + + this.m.tx_submit_bundle_proposal_failed = new prom_client.Counter({ + name: "tx_submit_bundle_proposal_failed", + help: "The amount of MsgSubmitBundleProposal txs that failed with an error", + }); + + // MsgSkipUploaderRole metrics + this.logger.debug(`Initializing metrics: tx_skip_uploader_role_successful`); + + this.m.tx_skip_uploader_role_successful = new prom_client.Counter({ + name: "tx_skip_uploader_role_successful", + help: "The amount of MsgSkipUploaderRole txs with receipt code = 0.", + }); + + this.logger.debug( + `Initializing metrics: tx_skip_uploader_role_unsuccessful` + ); + + this.m.tx_skip_uploader_role_unsuccessful = new prom_client.Counter({ + name: "tx_skip_uploader_role_unsuccessful", + help: "The amount of MsgSkipUploaderRole txs with receipt code != 0.", + }); + + this.logger.debug(`Initializing metrics: tx_skip_uploader_role_failed`); + + this.m.tx_skip_uploader_role_failed = new prom_client.Counter({ + name: "tx_skip_uploader_role_failed", + help: "The amount of MsgSkipUploaderRole txs that failed with an error", + }); + + // QUERY METRICS + + // QueryPool metrics + this.logger.debug(`Initializing metrics: query_pool_successful`); + + this.m.query_pool_successful = new prom_client.Counter({ + name: "query_pool_successful", + help: "The amount of QueryPool /kyve/query/v1beta1/pool/{id} calls that succeeded.", + }); + + this.logger.debug(`Initializing metrics: query_pool_failed`); + + this.m.query_pool_failed = new prom_client.Counter({ + name: "query_pool_failed", + help: "The amount of QueryPool /kyve/query/v1beta1/pool/{id} calls that failed.", + }); + + // QueryCanValidate metrics + this.logger.debug(`Initializing metrics: query_can_validate_successful`); + + this.m.query_can_validate_successful = new prom_client.Counter({ + name: "query_can_validate_successful", + help: "The amount of QueryCanValidate /kyve/query/v1beta1/can_validate/{pool_id}/{valaddress} calls that succeeded.", + }); + + this.logger.debug(`Initializing metrics: query_can_validate_failed`); + + this.m.query_can_validate_failed = new prom_client.Counter({ + name: "query_can_validate_failed", + help: "The amount of QueryCanValidate /kyve/query/v1beta1/can_validate/{pool_id}/{valaddress} calls that failed.", + }); + + this.logger.debug(`Initializing metrics: query_can_propose_successful`); + + // QueryCanPropose metrics + this.m.query_can_propose_successful = new prom_client.Counter({ + name: "query_can_propose_successful", + help: "The amount of QueryCanPropose /kyve/query/v1beta1/can_propose/{pool_id}/{staker}/{proposer}/{from_index} calls that succeeded.", + }); + + this.logger.debug(`Initializing metrics: query_can_propose_failed`); + + this.m.query_can_propose_failed = new prom_client.Counter({ + name: "query_can_propose_failed", + help: "The amount of QueryCanPropose /kyve/query/v1beta1/can_propose/{pool_id}/{staker}/{proposer}/{from_index} calls that failed.", + }); + + // QueryCanVote metrics + this.logger.debug(`Initializing metrics: query_can_vote_successful`); + + this.m.query_can_vote_successful = new prom_client.Counter({ + name: "query_can_vote_successful", + help: "The amount of QueryCanVote /kyve/query/v1beta1/can_vote/{pool_id}/{staker}/{voter}/{storage_id} calls that succeeded.", + }); + + this.logger.debug(`Initializing metrics: query_can_vote_failed`); + + this.m.query_can_vote_failed = new prom_client.Counter({ + name: "query_can_vote_failed", + help: "The amount of QueryCanVote /kyve/query/v1beta1/can_vote/{pool_id}/{staker}/{voter}/{storage_id} calls that failed.", + }); + + // STORAGE PROVIDER METRICS + + // retrieve bundle + this.logger.debug( + `Initializing metrics: storage_provider_retrieve_successful` + ); + + this.m.storage_provider_retrieve_successful = new prom_client.Counter({ + name: "storage_provider_retrieve_successful", + help: "The amount of calls to the storage provider to retrieve a bundle that succeeded.", + }); + + this.logger.debug(`Initializing metrics: storage_provider_retrieve_failed`); + + this.m.storage_provider_retrieve_failed = new prom_client.Counter({ + name: "storage_provider_retrieve_failed", + help: "The amount of calls to the storage provider to retrieve a bundle that failed.", + }); + + // save bundle + this.logger.debug(`Initializing metrics: storage_provider_save_successful`); + + this.m.storage_provider_save_successful = new prom_client.Counter({ + name: "storage_provider_save_successful", + help: "The amount of calls to the storage provider to save a bundle that succeeded.", + }); + + this.logger.debug(`Initializing metrics: storage_provider_save_failed`); + + this.m.storage_provider_save_failed = new prom_client.Counter({ + name: "storage_provider_save_failed", + help: "The amount of calls to the storage provider to save a bundle that failed.", + }); + + // BUNDLE METRICS + + // bundle votes + this.logger.debug(`Initializing metrics: bundles_voted_valid`); + + this.m.bundles_voted_valid = new prom_client.Counter({ + name: "bundles_voted_valid", + help: "The amount the validator voted valid.", + }); + + this.logger.debug(`Initializing metrics: bundles_voted_invalid`); + + this.m.bundles_voted_invalid = new prom_client.Counter({ + name: "bundles_voted_invalid", + help: "The amount the validator voted invalid.", + }); + + this.logger.debug(`Initializing metrics: bundles_voted_abstain`); + + this.m.bundles_voted_abstain = new prom_client.Counter({ + name: "bundles_voted_abstain", + help: "The amount the validator voted abstain.", + }); + + // bundle proposals + this.logger.debug(`Initializing metrics: bundles_proposed`); + + this.m.bundles_proposed = new prom_client.Counter({ + name: "bundles_proposed", + help: "The amount of bundles the validator proposed.", + }); + + this.logger.debug(`Initializing metrics: bundles_round_time`); + + this.m.bundles_round_time = new prom_client.Gauge({ + name: "bundles_round_time", + help: "The time for a bundle proposal round.", + }); + + this.logger.debug( + `Initializing metrics: bundles_remaining_upload_interval_time` + ); + + this.m.bundles_remaining_upload_interval_time = new prom_client.Gauge({ + name: "bundles_remaining_upload_interval_time", + help: "The time for the remaining upload interval.", + }); + + this.logger.debug(`Initializing metrics: bundles_wait_for_next_round_time`); + + this.m.bundles_wait_for_next_round_time = new prom_client.Gauge({ + name: "bundles_wait_for_next_round_time", + help: "The time to wait for the next proposal round.", + }); + + this.logger.debug(`Initializing metrics: bundles_amount`); + + this.m.bundles_amount = new prom_client.Gauge({ + name: "bundles_amount", + help: "The amount of bundles the validator participated in.", + }); + + this.logger.debug(`Initializing metrics: bundles_data_items`); + + this.m.bundles_data_items = new prom_client.Gauge({ + name: "bundles_data_items", + help: "The amount of data items the validator participated in.", + }); + + this.logger.debug(`Initializing metrics: bundles_byte_size`); + + this.m.bundles_byte_size = new prom_client.Gauge({ + name: "bundles_byte_size", + help: "The amount of data in bytes the validator participated in.", + }); + + // RUNTIME METRICS + + this.logger.debug(`Initializing metrics: runtime_get_data_item_successful`); + + this.m.runtime_get_data_item_successful = new prom_client.Counter({ + name: "runtime_get_data_item_successful", + help: "The amount of successful returned data items from the runtime.", + }); + + this.logger.debug(`Initializing metrics: runtime_get_data_item_failed`); + + this.m.runtime_get_data_item_failed = new prom_client.Counter({ + name: "runtime_get_data_item_failed", + help: "The amount of failed returned data items from the runtime.", + }); + + // BALANCE METRICS + + this.logger.debug(`Initializing metrics: balance_staker`); + + this.m.balance_staker = new prom_client.Gauge({ + name: "balance_staker", + help: "The current $KYVE balance of the staker.", + }); + + this.logger.debug(`Initializing metrics: balance_valaccount`); + + this.m.balance_valaccount = new prom_client.Gauge({ + name: "balance_valaccount", + help: "The current $KYVE balance of the valaccount.", + }); + + this.logger.debug(`Initializing metrics: balance_storage_provider`); + + this.m.balance_storage_provider = new prom_client.Gauge({ + name: "balance_storage_provider", + help: "The current balance of the storage provider.", + }); + + // CACHE METRICS + + this.logger.debug(`Initializing metrics: cache_current_items`); + + this.m.cache_current_items = new prom_client.Gauge({ + name: "cache_current_items", + help: "The amount of data items currently in the cache.", + }); + + this.logger.debug(`Initializing metrics: cache_index_tail`); + + this.m.cache_index_tail = new prom_client.Gauge({ + name: "cache_index_tail", + help: "The current index of the last data item in the cache.", + }); + + this.logger.debug(`Initializing metrics: cache_index_head`); + + this.m.cache_index_head = new prom_client.Gauge({ + name: "cache_index_head", + help: "The current index of the first data item in the cache.", + }); + + // GAS METRICS + + this.logger.debug(`Initializing metrics: gas_claim_uploader_role`); + + this.m.gas_claim_uploader_role = new prom_client.Gauge({ + name: "gas_claim_uploader_role", + help: "The current gas costs of tx claim uploader role metrics", + }); + + this.logger.debug(`Initializing metrics: gas_vote_bundle_proposal`); + + this.m.gas_vote_bundle_proposal = new prom_client.Gauge({ + name: "gas_vote_bundle_proposal", + help: "The current gas costs of tx vote bundle proposal metrics", + }); + + this.logger.debug(`Initializing metrics: gas_submit_bundle_proposal`); + + this.m.gas_submit_bundle_proposal = new prom_client.Gauge({ + name: "gas_submit_bundle_proposal", + help: "The current gas costs of tx submit bundle proposal metrics", + }); + + this.logger.debug(`Initializing metrics: gas_skip_uploader_role`); + + this.m.gas_skip_uploader_role = new prom_client.Gauge({ + name: "gas_skip_uploader_role", + help: "The current gas costs of tx skip uploader role metrics", + }); + + // start local metrics server + if (this.metrics) { + this.logger.info( + `Starting metric server on: http://localhost:${this.metricsPort}/metrics` + ); + + // HTTP server which exposes the metrics on http://localhost:8080/metrics + http + .createServer(async (req: any, res: any) => { + // Retrieve route from request object + const route = url.parse(req.url).pathname; + + if (route === "/metrics") { + // Return all metrics the Prometheus exposition format + res.setHeader("Content-Type", register.contentType); + const metrics = await prom_client.register.metrics(); + res.end(metrics); + } + }) + .listen(this.metricsPort, "0.0.0.0"); + } + } catch (err) { + this.logger.fatal(`Failed to setup metrics. Exiting ...`); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } +} diff --git a/common/protocol/src/methods/setups/setupSDK.ts b/common/protocol/src/methods/setups/setupSDK.ts new file mode 100644 index 00000000..98c58241 --- /dev/null +++ b/common/protocol/src/methods/setups/setupSDK.ts @@ -0,0 +1,44 @@ +import KyveSDK, { constants } from "@kyvejs/sdk"; +import { KYVE_NETWORK } from "@kyvejs/sdk/dist/constants"; + +import { Validator, standardizeJSON } from "../.."; + +/** + * setupSDK creates the main KYVE SDK and the client which is used for transactions + * and the lcd client which is used for queries + * + * @method setupSDK + * @param {Validator} this + * @return {Promise} + */ +export async function setupSDK(this: Validator): Promise { + try { + this.logger.debug(`Initializing KyveSDK with network ${this.network}`); + + // get KYVE network settings from network parameter + // TODO @regenisis: use chain-id as new network property + let network = constants.KYVE_ENDPOINTS[this.network as KYVE_NETWORK]; + + if (this.rpc) { + network = { ...network, rpc: this.rpc }; + } + + if (this.rest) { + network = { ...network, rest: this.rest }; + } + + this.sdk = new KyveSDK(network); + + this.logger.debug(`Initializing KyveClient from valaccount mnemonic`); + + this.client = await this.sdk.fromMnemonic(this.valaccount); + + this.logger.debug(`Initializing KyveLCD from sdk`); + this.lcd = this.sdk.createLCDClient(); + } catch (err) { + this.logger.fatal(`Failed to init KYVE SDK. Exiting ...`); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } +} diff --git a/common/protocol/src/methods/setups/setupValidator.ts b/common/protocol/src/methods/setups/setupValidator.ts new file mode 100644 index 00000000..baa0be6b --- /dev/null +++ b/common/protocol/src/methods/setups/setupValidator.ts @@ -0,0 +1,65 @@ +import Prando from "prando"; +import { + adjectives, + animals, + colors, + uniqueNamesGenerator, +} from "unique-names-generator"; + +import { Validator, standardizeJSON } from "../.."; + +/** + * setupValidator ensures the node starts as a valid validator + * and logs some basic validator starting information + * + * @method setupValidator + * @param {Validator} this + * @return {Promise} + */ +export async function setupValidator(this: Validator): Promise { + try { + // generate deterministic valname based on network, pool id, + // runtime, runtime version and valaddress + const valnameSeed = `${this.network}-${this.poolId}-${this.runtime.name}-${this.runtime.version}-${this.client.account.address}`; + + this.logger.debug(`Creating seed for valname generation`); + this.logger.debug(valnameSeed); + + const r = new Prando(valnameSeed); + + this.logger.debug(`Generate valname with seed`); + + this.name = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + separator: "-", + length: 3, + style: "lowerCase", + seed: r.nextInt(0, adjectives.length * colors.length * animals.length), + }).replace(" ", "-"); + + this.logger.debug(`Valname "${this.name}" got created`); + + // check if valaccount was already authorized by a validator + await this.waitForAuthorization(); + + // log basic node info on startup + this.logger.info("Starting node ...\n"); + this.logger.info(`Valaddress \t = ${this.client.account.address}`); + this.logger.info(`Staker \t\t = ${this.staker}`); + this.logger.info(`Valname \t\t = ${this.name}\n`); + + this.logger.info(`Pool ID \t\t = ${this.poolId}`); + this.logger.info(`Runtime \t\t = ${this.runtime.name}`); + this.logger.info(`Network \t\t = ${this.network}\n`); + + this.logger.info(`@kyvejs/protocol \t = v${this.protocolVersion}`); + this.logger.info(`${this.runtime.name} \t = v${this.runtime.version}\n`); + + this.m.cache_current_items.set(0); + } catch (err) { + this.logger.fatal(`Failed to setup validator. Exiting ...`); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } +} diff --git a/common/protocol/src/methods/timeouts/waitForAuthorization.ts b/common/protocol/src/methods/timeouts/waitForAuthorization.ts new file mode 100644 index 00000000..d773c830 --- /dev/null +++ b/common/protocol/src/methods/timeouts/waitForAuthorization.ts @@ -0,0 +1,117 @@ +import { Validator } from "../.."; +import { + callWithBackoffStrategy, + REFRESH_TIME, + sleep, + standardizeJSON, +} from "../../utils"; +const INFINITY_LOOP = true; +/** + * waitForAuthorization ensures that the node starts with a valid validator + * who authorized this valaccount. If the valaccount was not authorized + * by the validator yet it logs out the information to authorize it. + * After authorization the node can continue running. + * + * @method waitForAuthorization + * @param {Validator} this + * @return {Promise} + */ +export async function waitForAuthorization(this: Validator): Promise { + try { + // call canValidate query to check if valaccount + // was already authorized to run + const canValidate = await callWithBackoffStrategy( + async () => { + this.logger.debug( + `this.lcd.kyve.query.v1beta1.canValidate({pool_id: ${this.poolId.toString()},valaddress: ${ + this.client.account.address + }})` + ); + + return await this.lcd.kyve.query.v1beta1.canValidate({ + pool_id: this.poolId.toString(), + valaddress: this.client.account.address, + }); + }, + { limitTimeoutMs: 5 * 60 * 1000, increaseByMs: 10 * 1000 }, + (err: any, ctx) => { + this.logger.info( + `Requesting query canValidate was unsuccessful. Retrying in ${( + ctx.nextTimeoutInMs / 1000 + ).toFixed(2)}s ...` + ); + this.logger.debug(standardizeJSON(err)); + this.m.query_can_validate_failed.inc(); + } + ); + + this.logger.debug(JSON.stringify(canValidate)); + this.m.query_can_validate_successful.inc(); + + // assign validator staker address if staker has authorized this valaccount + if (canValidate.possible) { + this.staker = canValidate.reason; + return; + } else { + // log information so that staker can authorize this valaccount + this.logger.info( + `Valaccount ${this.client.account.address} has not joined the pool with id ${this.poolId} yet` + ); + this.logger.info( + `Visit https://app.kyve.network/#/pools/${this.poolId} and add join the pool with the following information:\n` + ); + + this.logger.info(`Valaddress: ${this.client.account.address}`); + this.logger.info(`Valname: ${this.name}\n`); + + this.logger.info( + `The node will not continue until the account is authorized` + ); + + await sleep(REFRESH_TIME); + } + + // wait until valaccount got authorized + while (INFINITY_LOOP) { + const canValidate = await callWithBackoffStrategy( + async () => { + this.logger.debug( + `this.lcd.kyve.query.v1beta1.canValidate({pool_id: ${this.poolId.toString()},valaddress: ${ + this.client.account.address + }})` + ); + + return await this.lcd.kyve.query.v1beta1.canValidate({ + pool_id: this.poolId.toString(), + valaddress: this.client.account.address, + }); + }, + { limitTimeoutMs: 5 * 60 * 1000, increaseByMs: 10 * 1000 }, + (err: any, ctx) => { + this.logger.info( + `Requesting query canValidate was unsuccessful. Retrying in ${( + ctx.nextTimeoutInMs / 1000 + ).toFixed(2)}s ...` + ); + this.logger.debug(standardizeJSON(err)); + this.m.query_can_validate_failed.inc(); + } + ); + + this.logger.debug(JSON.stringify(canValidate)); + this.m.query_can_validate_successful.inc(); + + if (canValidate.possible) { + this.staker = canValidate.reason; + break; + } else { + await sleep(REFRESH_TIME); + } + } + } catch (err) { + this.logger.fatal(`Failed to authorize valaccount. Exiting ...`); + this.logger.fatal(standardizeJSON(err)); + + process.exit(1); + } +} diff --git a/common/protocol/src/methods/timeouts/waitForCacheContinuation.ts b/common/protocol/src/methods/timeouts/waitForCacheContinuation.ts new file mode 100644 index 00000000..035adfcb --- /dev/null +++ b/common/protocol/src/methods/timeouts/waitForCacheContinuation.ts @@ -0,0 +1,22 @@ +import { Validator } from "../.."; +import { sleep } from "../../utils"; + +/** + * waitForCacheContinuation waits until a new bundle proposal is + * available. We don't need to sync the pool because the pool + * state already gets synced in the other main function "runNode" + * so we only listen here + * + * @method waitForCacheContinuation + * @param {Validator} this + * @return {Promise} + */ +export async function waitForCacheContinuation( + this: Validator, + updatedAt: number +): Promise { + // continue if a new proposal is available + while (updatedAt === parseInt(this.pool.bundle_proposal!.updated_at)) { + await sleep(1000); + } +} diff --git a/common/protocol/src/methods/timeouts/waitForNextBundleProposal.ts b/common/protocol/src/methods/timeouts/waitForNextBundleProposal.ts new file mode 100644 index 00000000..e72fed56 --- /dev/null +++ b/common/protocol/src/methods/timeouts/waitForNextBundleProposal.ts @@ -0,0 +1,48 @@ +import { Validator } from "../.."; +import { REFRESH_TIME, sleep, standardizeJSON } from "../../utils"; + +/** + * waitForNextBundleProposal waits until the the next bundle proposal has + * been submitted. It waits because the node has performed all actions + * in this round and is done. The node checks that by comparing the + * creation time of the proposal, if it is bigger than the current one + * the node knows someone submitted a new proposal. + * + * @method waitForNextBundleProposal + * @param {Validator} this + * @param {number} updatedAt + * @return {Promise} + */ +export async function waitForNextBundleProposal( + this: Validator, + updatedAt: number +): Promise { + try { + this.logger.info("Waiting for next bundle proposal"); + + // track waiting time for metrics + const endTimeNextBundleProposal = + this.m.bundles_wait_for_next_round_time.startTimer(); + + // continue if the creation time of the bundle proposal increased + while (parseInt(this.pool.bundle_proposal!.updated_at) <= updatedAt) { + await this.syncPoolState(); + + // if pool got not active in the meantime abort + if (this.validateIsPoolActive()) { + break; + } + + await sleep(REFRESH_TIME); + } + + endTimeNextBundleProposal(); + + this.logger.info(`Found new bundle proposal`); + } catch (err) { + this.logger.error( + `Failed to wait for next bundle proposal. Continuing ...` + ); + this.logger.error(standardizeJSON(err)); + } +} diff --git a/common/protocol/src/methods/timeouts/waitForUploadInterval.ts b/common/protocol/src/methods/timeouts/waitForUploadInterval.ts new file mode 100644 index 00000000..83ab9167 --- /dev/null +++ b/common/protocol/src/methods/timeouts/waitForUploadInterval.ts @@ -0,0 +1,51 @@ +import BigNumber from "bignumber.js"; + +import { Validator } from "../.."; +import { sleep, standardizeJSON } from "../../utils"; + +/** + * waitForUploadInterval waits until the upload interval of the current + * round has passed. The node waits, because during this time no new round + * will start. Only after the upload interval the next uploader can start + * the next round. + * + * @method waitForUploadInterval + * @param {Validator} this + * @return {Promise} + */ +export async function waitForUploadInterval(this: Validator): Promise { + try { + // determine how long the upload interval is still taking + let timeRemaining = new BigNumber(0); + + const unixNow = new BigNumber(Date.now()); + const unixIntervalEnd = new BigNumber(this.pool.bundle_proposal!.updated_at) + .plus(this.pool.data!.upload_interval) + .multipliedBy(1000); + + // if upload interval has already passed just wait zero seconds + if (unixNow.lt(unixIntervalEnd)) { + timeRemaining = unixIntervalEnd.minus(unixNow); + } + + this.logger.info( + `Waiting for remaining upload interval = ${timeRemaining + .dividedBy(1000) + .toFixed(2)}s ...` + ); + + // further track remaining upload interval time for metrics + const endTimeRemaining = + this.m.bundles_remaining_upload_interval_time.startTimer(); + + // wait for the remaining time + await sleep(timeRemaining.toNumber()); + + endTimeRemaining(); + + this.logger.info(`Reached upload interval of current bundle proposal`); + } catch (err) { + this.logger.error(`Failed to wait for upload interval. Continuing ...`); + this.logger.error(standardizeJSON(err)); + } +} diff --git a/common/protocol/src/methods/txs/claimUploaderRole.ts b/common/protocol/src/methods/txs/claimUploaderRole.ts new file mode 100644 index 00000000..ff28cd97 --- /dev/null +++ b/common/protocol/src/methods/txs/claimUploaderRole.ts @@ -0,0 +1,57 @@ +import { Validator, standardizeJSON } from "../.."; + +/** + * claimUploaderRole tries to claim the uploader role for the next bundle proposal + * round. If successfully claimed it returns true, otherwise it will + * return false. The claim is only successful if there is currently no next + * uploader on the bundle proposal, otherwise if already claimed by another + * node the tx will just be ignored. + * + * @method claimUploaderRole + * @param {Validator} this + * @return {Promise} + */ +export async function claimUploaderRole(this: Validator): Promise { + try { + // if next uploader is already defined abort + if (this.pool.bundle_proposal!.next_uploader) { + return false; + } + + this.logger.debug( + `this.client.kyve.bundles.v1beta1.claimUploaderRole({staker: ${ + this.staker + },pool_id: ${this.poolId.toString()}})` + ); + + const tx = await this.client.kyve.bundles.v1beta1.claimUploaderRole({ + staker: this.staker, + pool_id: this.poolId.toString(), + }); + + this.logger.debug(`ClaimUploaderRole = ${tx.txHash}`); + + const receipt = await tx.execute(); + + this.logger.debug(JSON.stringify({ ...receipt, rawLog: null, data: null })); + + if (receipt.code === 0) { + this.logger.info(`Successfully claimed uploader role`); + this.m.tx_claim_uploader_role_successful.inc(); + this.m.gas_claim_uploader_role.set(receipt?.gasUsed ?? 0); + + return true; + } else { + this.logger.info(`Could not claim uploader role. Continuing ...`); + this.m.tx_claim_uploader_role_unsuccessful.inc(); + + return false; + } + } catch (err) { + this.logger.error("Failed to claim uploader role. Continuing ..."); + this.logger.error(standardizeJSON(err)); + this.m.tx_claim_uploader_role_failed.inc(); + + return false; + } +} diff --git a/common/protocol/src/methods/txs/skipUploaderRole.ts b/common/protocol/src/methods/txs/skipUploaderRole.ts new file mode 100644 index 00000000..4ddea7ae --- /dev/null +++ b/common/protocol/src/methods/txs/skipUploaderRole.ts @@ -0,0 +1,63 @@ +import { Validator, standardizeJSON } from "../.."; + +/** + * skipUploaderRole is called by the current next uploader of the + * current bundle proposal and is called when the node is not able + * to create a valid bundle proposal. This can be due to not having + * enough data collected or the storage provider being offline for + * some reason. + * + * The fromIndex of the current bundle proposal is + * included so that the chain can check if the next uploader + * still wants to skip his role on his specified proposal, + * because in rare instances while the tx is mining the next + * proposal can start, thus resulting in an unwanted skip. + * + * @method skipUploaderRole + * @param {Validator} this + * @param {number} fromIndex + * @return {Promise} + */ +export async function skipUploaderRole( + this: Validator, + fromIndex: number +): Promise { + try { + this.logger.debug( + `this.client.kyve.bundles.v1beta1.skipUploaderRole({staker: ${ + this.staker + },pool_id: ${this.poolId.toString()},from_index: ${fromIndex.toString()}})` + ); + + const tx = await this.client.kyve.bundles.v1beta1.skipUploaderRole({ + staker: this.staker, + pool_id: this.poolId.toString(), + from_index: fromIndex.toString(), + }); + + this.logger.debug(`SkipUploaderRole = ${tx.txHash}`); + + const receipt = await tx.execute(); + + this.logger.debug(JSON.stringify({ ...receipt, rawLog: null, data: null })); + + if (receipt.code === 0) { + this.logger.info(`Successfully skipped uploader role`); + this.m.tx_skip_uploader_role_successful.inc(); + this.m.gas_skip_uploader_role.set(receipt?.gasUsed ?? 0); + + return true; + } else { + this.logger.info(`Could not skip uploader role. Continuing ...`); + this.m.tx_skip_uploader_role_unsuccessful.inc(); + + return false; + } + } catch (err) { + this.logger.error("Failed to skip uploader role. Continuing ..."); + this.logger.error(standardizeJSON(err)); + this.m.tx_skip_uploader_role_failed.inc(); + + return false; + } +} diff --git a/common/protocol/src/methods/txs/submitBundleProposal.ts b/common/protocol/src/methods/txs/submitBundleProposal.ts new file mode 100644 index 00000000..42e7cc53 --- /dev/null +++ b/common/protocol/src/methods/txs/submitBundleProposal.ts @@ -0,0 +1,81 @@ +import { Validator, standardizeJSON } from "../.."; + +/** + * submitBundleProposal submits a bundle proposal to the + * network. By submitting a new bundle proposal the current + * one gets finalized and the next uploader is automatically + * chosen. + * + * @method submitBundleProposal + * @param {Validator} this + * @param {string} storageId the storage id of the data stored in storage provider + * @param {number} dataSize the raw byte size of the data stored in storage provider + * @param {string} dataHash the sha256 hash of the raw data stored in storage provider + * @param {number} fromIndex the index from where the bundle was created + * @param {number} bundleSize the size of the bundle + * @param {string} fromKey the start key the bundle got created from + * @param {string} toKey the key of the last data item in the bundle + * @param {string} bundleSummary a summary of the bundle in a short string which gets stored on-chain + * @return {Promise} + */ +export async function submitBundleProposal( + this: Validator, + storageId: string, + dataSize: number, + dataHash: string, + fromIndex: number, + bundleSize: number, + fromKey: string, + toKey: string, + bundleSummary: string +): Promise { + try { + this.logger.debug( + `this.client.kyve.bundles.v1beta1.submitBundleProposal({staker: ${ + this.staker + },pool_id: ${this.poolId.toString()},storage_id: ${storageId},data_size: ${dataSize.toString()},data_hash: ${dataHash},from_index: ${fromIndex.toString()},bundle_size: ${bundleSize.toString()},from_key: ${fromKey},to_key: ${toKey},bundle_summary: ${bundleSummary}})` + ); + + const tx = await this.client.kyve.bundles.v1beta1.submitBundleProposal({ + staker: this.staker, + pool_id: this.poolId.toString(), + storage_id: storageId, + data_size: dataSize.toString(), + data_hash: dataHash, + from_index: fromIndex.toString(), + bundle_size: bundleSize.toString(), + from_key: fromKey, + to_key: toKey, + bundle_summary: bundleSummary, + }); + + this.logger.debug(`SubmitBundleProposal = ${tx.txHash}`); + + const receipt = await tx.execute(); + + this.logger.debug(JSON.stringify({ ...receipt, rawLog: null, data: null })); + + if (receipt.code === 0) { + this.m.tx_submit_bundle_proposal_successful.inc(); + this.m.gas_submit_bundle_proposal.set(receipt?.gasUsed ?? 0); + + this.m.bundles_proposed.inc(); + this.m.bundles_amount.inc(); + this.m.bundles_data_items.set(bundleSize); + this.m.bundles_byte_size.set(dataSize); + + return true; + } else { + this.logger.info(`Could not submit bundle proposal. Continuing ...`); + this.m.tx_submit_bundle_proposal_unsuccessful.inc(); + + return false; + } + } catch (err) { + this.logger.error(`Failed to submit bundle proposal. Continuing ...`); + this.logger.error(standardizeJSON(err)); + this.m.tx_submit_bundle_proposal_failed.inc(); + + return false; + } +} diff --git a/common/protocol/src/methods/txs/voteBundleProposal.ts b/common/protocol/src/methods/txs/voteBundleProposal.ts new file mode 100644 index 00000000..734a9b68 --- /dev/null +++ b/common/protocol/src/methods/txs/voteBundleProposal.ts @@ -0,0 +1,82 @@ +import { Validator, standardizeJSON, VOTE } from "../.."; + +/** + * voteBundleProposal submits a vote on the current bundle proposal. + * The storage id is used to check on chain if the vote is still + * dedicated to that proposal, because in rare instances while + * the tx is mining the next proposal could already start, thus + * resulting in an unwanted vote. + * + * @method voteBundleProposal + * @param {Validator} this + * @param {string} storageId storage id of the current bundle proposal + * @param {number} vote can be 1 = VALID, 2 = INVALID or 3 = ABSTAIN + * @return {Promise} + */ +export async function voteBundleProposal( + this: Validator, + storageId: string, + vote: number +): Promise { + try { + let voteMessage = ""; + + // determine vote type for verbose logging + if (vote === VOTE.VALID) { + voteMessage = "valid"; + } else if (vote === VOTE.INVALID) { + voteMessage = "invalid"; + } else if (vote === VOTE.ABSTAIN) { + voteMessage = "abstain"; + } else { + throw Error(`Invalid vote: ${vote}`); + } + + this.logger.debug( + `this.client.kyve.bundles.v1beta1.voteBundleProposal({staker: ${ + this.staker + },pool_id: ${this.poolId.toString()},storage_id: ${storageId},vote: ${vote}})` + ); + + const tx = await this.client.kyve.bundles.v1beta1.voteBundleProposal({ + staker: this.staker, + pool_id: this.poolId.toString(), + storage_id: storageId, + vote, + }); + + this.logger.debug(`VoteProposal = ${tx.txHash}`); + + const receipt = await tx.execute(); + + this.logger.debug(JSON.stringify({ ...receipt, rawLog: null, data: null })); + + if (receipt.code === 0) { + this.logger.info(`Voted ${voteMessage} on bundle "${storageId}"`); + + this.m.tx_vote_bundle_proposal_successful.inc(); + this.m.gas_vote_bundle_proposal.set(receipt?.gasUsed ?? 0); + + if (vote === 1) { + this.m.bundles_voted_valid.inc(); + } else if (vote === 2) { + this.m.bundles_voted_invalid.inc(); + } else if (vote === 3) { + this.m.bundles_voted_abstain.inc(); + } + + return true; + } else { + this.logger.info(`Could not vote on proposal. Continuing ...`); + this.m.tx_vote_bundle_proposal_unsuccessful.inc(); + + return false; + } + } catch (err) { + this.logger.error(`Failed to vote on bundle proposal. Continuing ...`); + this.logger.error(standardizeJSON(err)); + this.m.tx_vote_bundle_proposal_failed.inc(); + + return false; + } +} diff --git a/common/protocol/src/methods/upload/createBundleProposal.ts b/common/protocol/src/methods/upload/createBundleProposal.ts new file mode 100644 index 00000000..d5f53ed3 --- /dev/null +++ b/common/protocol/src/methods/upload/createBundleProposal.ts @@ -0,0 +1,267 @@ +import { Validator } from "../.."; +import { BundleTag, DataItem } from "../../types"; +import { bundleToBytes, sha256, standardizeJSON } from "../../utils"; + +/** + * createBundleProposal assembles a bundle proposal by loading + * data from the local cache and uploading it to a storage provider. + * After the data was successfully saved the node submits the bundle + * proposal with the storage id and other information to the network + * so that other participants can validate and vote on it. + * + * If one of the steps fails the node should skip it's uploader role + * to prevent slashes. + * + * @method createBundleProposal + * @param {Validator} this + * @return {Promise} + */ +export async function createBundleProposal(this: Validator): Promise { + try { + this.logger.info( + `Creating a new bundle proposal for the next bundle proposal round` + ); + + // create bundle proposal from the current bundle proposal index + const fromIndex = + parseInt(this.pool.data!.current_index) + + parseInt(this.pool.bundle_proposal!.bundle_size); + + // create the bundle proposal from the determined bundle start index + // and index all the way until the maximum bundle size is reached + const toIndex = fromIndex + parseInt(this.pool.data!.max_bundle_size); + + // load bundle proposal from local cache + const bundleProposal: DataItem[] = []; + + // here we try to fetch data items from the current index + // to the proposal index. If we fail before we simply + // abort and and submit the data collected we have available + // right now + this.logger.debug( + `Loading bundle from index ${fromIndex} to index ${toIndex}` + ); + + for (let i = fromIndex; i < toIndex; i++) { + try { + // try to get the data item from local cache + this.logger.debug(`this.cacheProvider.get(${i.toString()})`); + const item = await this.cacheProvider.get(i.toString()); + bundleProposal.push(item); + } catch { + // if the data item was not found simply abort + // and submit what we just have now + break; + } + } + + // if no data was found on the cache skip the uploader role + // so that this node does not receive an upload slash + if (!bundleProposal.length) { + this.logger.info(`No data was found on local cache from required range`); + + await this.skipUploaderRole(fromIndex); + return; + } + + this.logger.info(`Data was found on local cache from required range`); + + // get the first key of the bundle proposal which gets + // included in the bundle proposal and saved on chain + // as from_key + const fromKey = bundleProposal.at(0)?.key ?? ""; + + // get the last key of the bundle proposal which gets + // included in the bundle proposal and saved on chain + // as to_key + const toKey = bundleProposal.at(-1)?.key ?? ""; + + // get the last value of the bundle proposal and format + // it so it can be included in the bundle proposal and + // saved on chain + this.logger.debug(`this.runtime.summarizeDataBundle($BUNDLE_PROPOSAL)`); + const bundleSummary = await this.runtime + .summarizeDataBundle(this, bundleProposal) + .catch((err) => { + this.logger.error( + `Unexpected error summarizing bundle. Skipping Uploader Role ...` + ); + this.logger.error(standardizeJSON(err)); + + return null; + }); + + // skip uploader role if bundleSummary is null + if (bundleSummary === null) { + await this.skipUploaderRole(fromIndex); + return; + } + + // get current compression defined on pool + this.logger.debug( + `compressionFactory(${this.pool.data?.current_compression_id ?? 0})` + ); + const compression = this.compressionFactory( + this.pool.data?.current_compression_id ?? 0 + ); + + // if data was found on the cache proceed with compressing the + // bundle for the upload to the storage provider + this.logger.debug(`this.compression.compress($RAW_BUNDLE_PROPOSAL)`); + const storageProviderData = await compression + .compress(bundleToBytes(bundleProposal)) + .catch((err) => { + this.logger.error( + `Unexpected error compressing bundle. Skipping Uploader Role ...` + ); + this.logger.error(standardizeJSON(err)); + + return null; + }); + + // skip uploader role if compression returns null + if (storageProviderData === null) { + await this.skipUploaderRole(fromIndex); + return; + } + + this.logger.info( + `Successfully compressed bundle with Compression:${compression.name}` + ); + + // create tags for bundle to make it easier to find KYVE data + // on the storage provider itself + const tags: BundleTag[] = [ + { + name: "Content-Type", + value: compression.mimeType, + }, + { + name: "Application", + value: "KYVE", + }, + { + name: "ChainId", + value: await this.client.nativeClient.getChainId(), + }, + { + name: "@kyvejs/protocol", + value: this.protocolVersion, + }, + { + name: this.runtime.name, + value: this.runtime.version, + }, + { + name: "Pool", + value: this.poolId.toString(), + }, + { + name: "Uploader", + value: this.client.account.address, + }, + { + name: "FromIndex", + value: toIndex.toString(), + }, + { + name: "ToIndex", + value: (toIndex + bundleProposal.length).toString(), + }, + { + name: "BundleSize", + value: bundleProposal.length.toString(), + }, + { + name: "FromKey", + value: fromKey, + }, + { + name: "ToKey", + value: toKey, + }, + { + name: "BundleSummary", + value: bundleSummary, + }, + ]; + + // try to upload the bundle proposal to the storage provider + // if the upload fails the node should immediately skip the + // uploader role to prevent upload slashes + try { + // get current storage provider defined on pool + this.logger.debug( + `storageProviderFactory(${ + this.pool.data?.current_storage_provider_id ?? 0 + }, $STORAGE_PRIV)` + ); + const storageProvider = await this.storageProviderFactory( + this.pool.data?.current_storage_provider_id ?? 0 + ); + + // upload the bundle proposal to the storage provider + // and get a storage id. With that other participants in the + // network can retrieve the data again and validate it + this.logger.debug( + `this.storageProvider.saveBundle($STORAGE_PROVIDER_DATA,$TAGS)` + ); + + const { storageId, storageData } = await storageProvider.saveBundle( + storageProviderData, + tags + ); + + // throw error if storage provider returns an empty storage id + if (!storageId) { + throw new Error("Storage Provider returned empty storageId"); + } + + // hash the raw data which gets uploaded to the storage provider + // with sha256 + const dataSize = storageData.byteLength; + + // hash the raw data which gets uploaded to the storage provider + // with sha256 + const dataHash = sha256(storageData); + + this.m.storage_provider_save_successful.inc(); + + this.logger.info( + `Successfully saved bundle on StorageProvider:${storageProvider.name}` + ); + + // if the bundle was successfully uploaded to the storage provider + // the node can finally submit the actual bundle proposal to + // the network + await this.submitBundleProposal( + storageId, + dataSize, + dataHash, + fromIndex, + bundleProposal.length, + fromKey, + toKey, + bundleSummary + ); + + this.logger.info(`Successfully submitted BundleProposal:${storageId}`); + } catch (err) { + this.logger.info( + `Saving bundle proposal on StorageProvider was unsucessful` + ); + this.logger.debug(standardizeJSON(err)); + + this.m.storage_provider_save_failed.inc(); + + // if the bundle fails to the uploaded to the storage provider + // let the node skip the uploader role and continue + await this.skipUploaderRole(fromIndex); + } + } catch (err) { + this.logger.error( + `Unexpected error creating bundle proposal. Skipping proposal ...` + ); + this.logger.error(standardizeJSON(err)); + } +} diff --git a/common/protocol/src/methods/validate/saveBundleDecompress.ts b/common/protocol/src/methods/validate/saveBundleDecompress.ts new file mode 100644 index 00000000..cf150e63 --- /dev/null +++ b/common/protocol/src/methods/validate/saveBundleDecompress.ts @@ -0,0 +1,46 @@ +import { Validator } from "../.."; +import { DataItem } from "../../types"; +import { bytesToBundle, standardizeJSON } from "../../utils"; + +/** + * saveBundleDecompress decompresses a bundle with the specified compression. + * It never throws an error and returns no data if one occurs. + * + * @method saveBundleDecompress + * @param {Validator} this + * @param {Buffer} rawStorageData + * @return {Promise} + */ +export async function saveBundleDecompress( + this: Validator, + rawStorageData: Buffer +): Promise { + try { + // get compression the proposed bundle was compressed with + this.logger.debug( + `compressionFactory(${this.pool.bundle_proposal?.compression_id ?? 0})` + ); + const compression = this.compressionFactory( + this.pool.bundle_proposal?.compression_id ?? 0 + ); + + this.logger.debug(`this.compression.decompress($RAW_STORAGE_DATA)`); + + const storageBundle = bytesToBundle( + await compression.decompress(rawStorageData) + ); + + this.logger.info( + `Successfully decompressed bundle with Compression:${compression.name}` + ); + + return standardizeJSON(storageBundle); + } catch (err) { + this.logger.error( + `Could not decompress bundle with Compression. Continuing ...` + ); + this.logger.error(standardizeJSON(err)); + + return []; + } +} diff --git a/common/protocol/src/methods/validate/saveBundleDownload.ts b/common/protocol/src/methods/validate/saveBundleDownload.ts new file mode 100644 index 00000000..a1aea95e --- /dev/null +++ b/common/protocol/src/methods/validate/saveBundleDownload.ts @@ -0,0 +1,117 @@ +import BigNumber from "bignumber.js"; + +import { Validator } from "../.."; +import { callWithBackoffStrategy, standardizeJSON, VOTE } from "../../utils"; + +/** + * saveBundleDownload downloads a bundle from the storage provider. + * The download should be aborted if the pool is not + * active anymore or a new bundle proposal has been found + * or the node is the current uploader and the upload interval + * has passed. + * + * If there is an error retrieving the bundle from the storage provider + * the node instantly votes with abstain and continues to try to retrieve + * the bundle. + * + * @method saveBundleDownload + * @param {Validator} this + * @param {number} updatedAt + * @return {Promise} + */ +export async function saveBundleDownload( + this: Validator, + updatedAt: number +): Promise { + return await callWithBackoffStrategy( + async () => { + await this.syncPoolState(); + + const unixNow = new BigNumber(Date.now()); + const unixIntervalEnd = new BigNumber( + this.pool.bundle_proposal!.updated_at + ) + .plus(this.pool.data!.upload_interval) + .multipliedBy(1000); + + // check if new proposal is available in the meantime + if (parseInt(this.pool.bundle_proposal!.updated_at) > updatedAt) { + return null; + } + + // check if pool got inactive in the meantime + if (this.validateIsPoolActive()) { + return null; + } + + // check if validator needs to upload + if ( + this.pool.bundle_proposal!.next_uploader === this.staker && + unixNow.gte(unixIntervalEnd) + ) { + return null; + } + + // get storage provider the proposed bundle was saved to + this.logger.debug( + `storageProviderFactory(${ + this.pool.bundle_proposal?.storage_provider_id ?? 0 + }, $STORAGE_PRIV)` + ); + const storageProvider = await this.storageProviderFactory( + this.pool.bundle_proposal?.storage_provider_id ?? 0 + ); + + // calculate download timeout for storage provider + // the timeout should always be 20 seconds less than the upload interval + // so that the node still has enough time to vote abstain when the + // download timeout is reached + const downloadTimeoutSec = Math.max( + 0, + parseInt(this.pool.data!.upload_interval) - 20 + ); + + this.logger.debug( + `this.storageProvider.retrieveBundle(${ + this.pool.bundle_proposal!.storage_id + },${downloadTimeoutSec * 1000})` + ); + + const { storageData } = await storageProvider.retrieveBundle( + this.pool.bundle_proposal!.storage_id, + downloadTimeoutSec * 1000 + ); + + this.m.storage_provider_retrieve_successful.inc(); + + this.logger.info( + `Successfully downloaded bundle with id ${ + this.pool.bundle_proposal!.storage_id + } from StorageProvider:${storageProvider.name}` + ); + + return storageData; + }, + { limitTimeoutMs: 5 * 60 * 1000, increaseByMs: 10 * 1000 }, + async (err: any, ctx) => { + this.logger.info( + `Retrieving bundle from StorageProvider was unsuccessful. Retrying in ${( + ctx.nextTimeoutInMs / 1000 + ).toFixed(2)}s ...` + ); + this.logger.debug(standardizeJSON(err)); + + this.m.storage_provider_retrieve_failed.inc(); + + // vote abstain if bundle could not be retrieved from storage + // provider. With voting abstain the network knows that the node + // is still online but just could not vote + if (!this.pool.bundle_proposal?.voters_abstain.includes(this.staker)) { + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + VOTE.ABSTAIN + ); + } + } + ); +} diff --git a/common/protocol/src/methods/validate/saveLoadValidationBundle.ts b/common/protocol/src/methods/validate/saveLoadValidationBundle.ts new file mode 100644 index 00000000..16c7543c --- /dev/null +++ b/common/protocol/src/methods/validate/saveLoadValidationBundle.ts @@ -0,0 +1,107 @@ +import BigNumber from "bignumber.js"; + +import { Validator } from "../.."; +import { DataItem } from "../../types"; +import { callWithBackoffStrategy, standardizeJSON, VOTE } from "../../utils"; + +/** + * saveLoadValidationBundle loads the bundle from the local + * cache for validation with the proposed bundle. If there is + * an error loading the bundle from cache the node instantly votes + * with abstain and continues to try to load the bundle + * + * @method saveLoadValidationBundle + * @param {Validator} this + * @param {number} updatedAt + * @return {Promise} + */ +export async function saveLoadValidationBundle( + this: Validator, + updatedAt: number +): Promise { + return await callWithBackoffStrategy( + async () => { + await this.syncPoolState(); + + const unixNow = new BigNumber(Date.now()); + const unixIntervalEnd = new BigNumber( + this.pool.bundle_proposal!.updated_at + ) + .plus(this.pool.data!.upload_interval) + .multipliedBy(1000); + + // check if new proposal is available in the meantime + if (parseInt(this.pool.bundle_proposal!.updated_at) > updatedAt) { + return null; + } + + // check if pool got inactive in the meantime + if (this.validateIsPoolActive()) { + return null; + } + + // check if validator needs to upload + if ( + this.pool.bundle_proposal!.next_uploader === this.staker && + unixNow.gte(unixIntervalEnd) + ) { + return null; + } + + // load bundle from current pool current index to proposed index + const proposalStartIndex = parseInt(this.pool.data!.current_index); + const proposalTargetIndex = + proposalStartIndex + parseInt(this.pool.bundle_proposal!.bundle_size); + + // attempt to load bundle from cache + const bundle: DataItem[] = []; + + // in order to get the same bundle for validation as the one + // proposed the bundle is loaded with the proposed heights + this.logger.debug( + `Loading bundle from index ${proposalStartIndex} to index ${proposalTargetIndex}` + ); + + for (let i = proposalStartIndex; i < proposalTargetIndex; i++) { + try { + // try to get the data item from local cache + this.logger.debug(`this.cacheProvider.get(${i.toString()})`); + const item = await this.cacheProvider.get(i.toString()); + bundle.push(item); + } catch { + // if a request data item can not be found abort and + // try again after a backoff time + throw new Error( + `Requested bundle could not be loaded from cache yet.` + ); + } + } + + this.logger.info( + `Successfully loaded validation bundle from CacheProvider:${this.cacheProvider.name}` + ); + + return standardizeJSON(bundle); + }, + { limitTimeoutMs: 5 * 60 * 1000, increaseByMs: 10 * 1000 }, + async (_: any, ctx) => { + this.logger.info( + `Loading validation bundle from CacheProvider:${ + this.cacheProvider.name + } was unsuccessful. Retrying in ${(ctx.nextTimeoutInMs / 1000).toFixed( + 2 + )}s ...` + ); + + // vote abstain if validation bundle could not be loaded from cache. + // With voting abstain the network knows that the node + // is still online but just could not vote + if (!this.pool.bundle_proposal?.voters_abstain.includes(this.staker)) { + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + VOTE.ABSTAIN + ); + } + } + ); +} diff --git a/common/protocol/src/methods/validate/validateBundleProposal.ts b/common/protocol/src/methods/validate/validateBundleProposal.ts new file mode 100644 index 00000000..913024b5 --- /dev/null +++ b/common/protocol/src/methods/validate/validateBundleProposal.ts @@ -0,0 +1,261 @@ +import { VoteType } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; + +import { Validator } from "../.."; +import { sha256, standardizeJSON, VOTE } from "../../utils"; + +/** + * validateBundleProposal validates a proposed bundle proposal + * by first downloading the proposed data bundle from the storage + * provider and then comparing it with a locally created validation + * bundle. Furthermore, custom validation from the runtime is applied + * at the end. + * + * @method validateBundleProposal + * @param {Validator} this + * @param {number} updatedAt + * @return {Promise} + */ +export async function validateBundleProposal( + this: Validator, + updatedAt: number +): Promise { + try { + this.logger.info( + `Validating bundle proposal = ${this.pool.bundle_proposal!.storage_id}` + ); + + // retrieve the data of the bundle proposal in a save way + // by retrying the retrieval if it fails + const storageProviderResult = await this.saveBundleDownload(updatedAt); + + // if no bundle got returned it means that the pool is not active anymore + // or a new bundle proposal round has started + if (storageProviderResult === null) { + return; + } + + // vote invalid if data size does not match with proposed data size + this.logger.debug(`Validating bundle proposal by data size`); + this.logger.debug(`Proposed = ${this.pool.bundle_proposal!.data_size}`); + this.logger.debug(`Actual = ${storageProviderResult.byteLength}`); + + if ( + parseInt(this.pool.bundle_proposal!.data_size) !== + storageProviderResult.byteLength + ) { + this.logger.info( + `Found different byte size on bundle downloaded from storage provider` + ); + + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + VOTE.INVALID + ); + return; + } + + this.logger.info( + `Found matching data size = ${this.pool.bundle_proposal!.data_size} Bytes` + ); + + // vote invalid if data hash does not match with proposed data hash + this.logger.debug(`Validating bundle proposal by data hash`); + this.logger.debug(`Proposed = ${this.pool.bundle_proposal!.data_hash}`); + this.logger.debug(`Actual = ${sha256(storageProviderResult)}`); + + if ( + this.pool.bundle_proposal!.data_hash !== sha256(storageProviderResult) + ) { + this.logger.info( + `Found different hash on bundle downloaded from storage provider` + ); + + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + VOTE.INVALID + ); + return; + } + + this.logger.info( + `Found matching data hash = ${this.pool.bundle_proposal!.data_hash}` + ); + + const validationBundle = await this.saveLoadValidationBundle(updatedAt); + + // if no bundle got returned it means that the pool is not active anymore + // or a new bundle proposal round has started + if (validationBundle === null) { + return; + } + + // vote invalid if bundle key does not match with proposed from key + this.logger.debug(`Validating bundle proposal by bundle from_key`); + this.logger.debug(`Proposed = ${this.pool.bundle_proposal!.from_key}`); + this.logger.debug(`Actual = ${validationBundle.at(0)?.key}`); + + if (this.pool.bundle_proposal!.from_key !== validationBundle.at(0)?.key) { + this.logger.info(`Found different value on proposed bundle from_key`); + + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + VOTE.INVALID + ); + return; + } + + this.logger.info( + `Found matching from key = ${this.pool.bundle_proposal!.from_key}` + ); + + // vote invalid if bundle key does not match with proposed to key + this.logger.debug(`Validating bundle proposal by bundle to_key`); + this.logger.debug(`Proposed = ${this.pool.bundle_proposal!.to_key}`); + this.logger.debug(`Actual = ${validationBundle.at(-1)?.key}`); + + if (this.pool.bundle_proposal!.to_key !== validationBundle.at(-1)?.key) { + this.logger.info(`Found different value on proposed bundle to_key`); + + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + VOTE.INVALID + ); + return; + } + + this.logger.info( + `Found matching to key = ${this.pool.bundle_proposal!.to_key}` + ); + + // vote invalid if bundle summary does not match with proposed summary + this.logger.debug(`Validating bundle proposal by bundle summary`); + this.logger.debug(`this.runtime.summarizeDataBundle($VALIDATION_BUNDLE)`); + + const bundleSummary = await this.runtime + .summarizeDataBundle(this, validationBundle) + .catch((err) => { + this.logger.error( + `Unexpected error summarizing bundle with runtime. Voting abstain ...` + ); + this.logger.error(standardizeJSON(err)); + + return null; + }); + + // vote abstain if bundleSummary is null + if (bundleSummary === null) { + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + VOTE.ABSTAIN + ); + return; + } + + this.logger.debug( + `Proposed = ${this.pool.bundle_proposal!.bundle_summary}` + ); + this.logger.debug(`Actual = ${bundleSummary}`); + + if (this.pool.bundle_proposal!.bundle_summary !== bundleSummary) { + this.logger.info(`Found different value on proposed bundle summary`); + + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + VOTE.INVALID + ); + return; + } + + this.logger.info( + `Found matching bundle summary = ${ + this.pool.bundle_proposal!.bundle_summary + }` + ); + + // if storage provider result is empty skip runtime validation + if (storageProviderResult.byteLength) { + // decompress the bundle with the specified compression type + // and convert the bytes into a JSON format + const proposedBundle = await this.saveBundleDecompress( + storageProviderResult + ); + + try { + // perform custom runtime bundle validation + this.logger.debug( + `Validating bundle proposal by custom runtime validation` + ); + + // validate if bundle size matches + let valid = proposedBundle.length === validationBundle.length; + + // validate each data item in bundle with custom runtime validation + for (let i = 0; i < proposedBundle.length; i++) { + if (valid) { + this.logger.debug( + `this.runtime.validateDataItem($THIS, $PROPOSED_DATA_ITEM, $VALIDATION_DATA_ITEM)` + ); + valid = await this.runtime.validateDataItem( + this, + proposedBundle[i], + validationBundle[i] + ); + this.logger.debug( + `Validated data item: index:${i} - key:${proposedBundle[i].key} - result:${valid}` + ); + } else { + // abort further validation if an invalid data item was + // found in bundle + break; + } + } + + this.logger.debug( + `Finished validating bundle by custom runtime validation. Result = ${valid}` + ); + + // vote with either valid or invalid + const vote = valid + ? VoteType.VOTE_TYPE_VALID + : VoteType.VOTE_TYPE_INVALID; + + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + vote + ); + } catch (err) { + this.logger.error( + `Unexpected error validating data items with runtime. Voting abstain ...` + ); + this.logger.error(standardizeJSON(err)); + + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + VoteType.VOTE_TYPE_ABSTAIN + ); + } + + // update metrics + this.m.bundles_amount.inc(); + this.m.bundles_data_items.set(proposedBundle.length); + this.m.bundles_byte_size.set(storageProviderResult.byteLength); + } else { + await this.voteBundleProposal( + this.pool.bundle_proposal!.storage_id, + VoteType.VOTE_TYPE_VALID + ); + + // update metrics + this.m.bundles_amount.inc(); + this.m.bundles_data_items.set( + parseInt(this.pool.bundle_proposal!.bundle_size) + ); + this.m.bundles_byte_size.set(storageProviderResult.byteLength); + } + } catch (err) { + this.logger.error( + `Unexpected error validating bundle proposal. Skipping validation ...` + ); + this.logger.error(standardizeJSON(err)); + } +} diff --git a/common/protocol/src/reactors/cacheProvider/JsonFileCache.ts b/common/protocol/src/reactors/cacheProvider/JsonFileCache.ts new file mode 100644 index 00000000..bac3085e --- /dev/null +++ b/common/protocol/src/reactors/cacheProvider/JsonFileCache.ts @@ -0,0 +1,40 @@ +import { existsSync, mkdirSync, promises as fs } from "fs"; +import fse from "fs-extra"; +import { readFile, writeFile } from "jsonfile"; + +import { DataItem, ICacheProvider } from "../../types"; + +export class JsonFileCache implements ICacheProvider { + public name = "JsonFileCache"; + public path!: string; + + async init(path: string): Promise { + this.path = path; + + if (!existsSync(this.path)) { + mkdirSync(this.path, { recursive: true }); + } + + await this.drop(); + } + + public async put(key: string, value: DataItem): Promise { + await writeFile(`${this.path}/${key}.json`, value); + } + + public async get(key: string): Promise { + return await readFile(`${this.path}/${key}.json`); + } + + public async exists(key: string): Promise { + return await fse.pathExists(`${this.path}/${key}.json`); + } + + public async del(key: string): Promise { + await fs.unlink(`${this.path}/${key}.json`); + } + + public async drop(): Promise { + await fse.emptyDir(`${this.path}/`); + } +} diff --git a/common/protocol/src/reactors/cacheProvider/MemoryCache.ts b/common/protocol/src/reactors/cacheProvider/MemoryCache.ts new file mode 100644 index 00000000..97891fa1 --- /dev/null +++ b/common/protocol/src/reactors/cacheProvider/MemoryCache.ts @@ -0,0 +1,40 @@ +import { DataItem, ICacheProvider } from "../../types"; + +export class MemoryCache implements ICacheProvider { + public name = "MemoryCache"; + public path!: string; + + private store: any = {}; + + async init(): Promise { + await this.drop(); + } + + public async put(key: string, value: DataItem): Promise { + this.store[key] = value; + } + + public async get(key: string): Promise { + if (!this.store[key]) { + throw new Error(`Entry with key ${key} not found`); + } + + return this.store[key]; + } + + public async exists(key: string): Promise { + return !!this.store[key]; + } + + public async del(key: string): Promise { + if (!this.store[key]) { + throw new Error(`Entry with key ${key} not found`); + } + + delete this.store[key]; + } + + public async drop(): Promise { + this.store = {}; + } +} diff --git a/common/protocol/src/reactors/cacheProvider/index.ts b/common/protocol/src/reactors/cacheProvider/index.ts new file mode 100644 index 00000000..665a79ca --- /dev/null +++ b/common/protocol/src/reactors/cacheProvider/index.ts @@ -0,0 +1,2 @@ +export * from "./JsonFileCache"; +export * from "./MemoryCache"; diff --git a/common/protocol/src/reactors/compression/Gzip.ts b/common/protocol/src/reactors/compression/Gzip.ts new file mode 100644 index 00000000..03665799 --- /dev/null +++ b/common/protocol/src/reactors/compression/Gzip.ts @@ -0,0 +1,16 @@ +import { gunzipSync, gzipSync } from "zlib"; + +import { ICompression } from "../../types"; + +export class Gzip implements ICompression { + public name = "Gzip"; + public mimeType = "application/gzip"; + + async compress(data: Buffer) { + return gzipSync(data); + } + + async decompress(data: Buffer) { + return gunzipSync(data); + } +} diff --git a/common/protocol/src/reactors/compression/NoCompression.ts b/common/protocol/src/reactors/compression/NoCompression.ts new file mode 100644 index 00000000..4f3bb0ad --- /dev/null +++ b/common/protocol/src/reactors/compression/NoCompression.ts @@ -0,0 +1,14 @@ +import { ICompression } from "../../types"; + +export class NoCompression implements ICompression { + public name = "NoCompression"; + public mimeType = "application/json"; + + async compress(data: Buffer) { + return data; + } + + async decompress(data: Buffer) { + return data; + } +} diff --git a/common/protocol/src/reactors/storageProviders/Arweave.ts b/common/protocol/src/reactors/storageProviders/Arweave.ts new file mode 100644 index 00000000..a19aad3f --- /dev/null +++ b/common/protocol/src/reactors/storageProviders/Arweave.ts @@ -0,0 +1,66 @@ +import ArweaveClient from "arweave"; +import { JWKInterface } from "arweave/node/lib/wallet"; +import axios from "axios"; + +import { BundleTag, IStorageProvider } from "../../types"; + +export class Arweave implements IStorageProvider { + public name = "Arweave"; + public decimals = 12; + + private jwk!: JWKInterface; + private client = new ArweaveClient({ + host: "arweave.net", + protocol: "https", + }); + + async init(storagePriv: string) { + this.jwk = JSON.parse(storagePriv); + return this; + } + + async getAddress() { + return await this.client.wallets.getAddress(this.jwk); + } + + async getBalance() { + const account = await this.getAddress(); + return await this.client.wallets.getBalance(account); + } + + async saveBundle(bundle: Buffer, tags: BundleTag[]) { + const transaction = await this.client.createTransaction({ + data: bundle, + }); + + for (const tag of tags) { + transaction.addTag(tag.name, tag.value); + } + + await this.client.transactions.sign(transaction, this.jwk); + + const balance = await this.getBalance(); + + if (parseInt(transaction.reward) > parseInt(balance)) { + throw Error( + `Not enough funds in Arweave wallet. Found = ${balance} required = ${transaction.reward}` + ); + } + + await this.client.transactions.post(transaction); + + return { + storageId: transaction.id, + storageData: Buffer.from(transaction.data), + }; + } + + async retrieveBundle(storageId: string, timeout: number) { + const { data: storageData } = await axios.get( + `https://arweave.net/${storageId}`, + { responseType: "arraybuffer", timeout } + ); + + return { storageId, storageData }; + } +} diff --git a/common/protocol/src/reactors/storageProviders/Bundlr.ts b/common/protocol/src/reactors/storageProviders/Bundlr.ts new file mode 100644 index 00000000..2e376ff8 --- /dev/null +++ b/common/protocol/src/reactors/storageProviders/Bundlr.ts @@ -0,0 +1,68 @@ +import BundlrClient from "@bundlr-network/client"; +import { JWKInterface } from "arweave/node/lib/wallet"; +import axios from "axios"; + +import { BundleTag, IStorageProvider } from "../../types"; + +export class Bundlr implements IStorageProvider { + public name = "Bundlr"; + public decimals = 12; + + private jwk!: JWKInterface; + private client!: BundlrClient; + + async init(storagePriv: string) { + this.jwk = JSON.parse(storagePriv); + + this.client = new BundlrClient( + "http://node1.bundlr.network", + "arweave", + this.jwk + ); + + return this; + } + + async getAddress() { + return this.client.address; + } + + async getBalance() { + const atomicUnits = await this.client.getLoadedBalance(); + return atomicUnits.toString(); + } + + async saveBundle(bundle: Buffer, tags: BundleTag[]) { + const transactionOptions = { + tags: [ + { + name: "Content-Type", + value: "text/plain", + }, + ...tags, + ], + }; + + const transaction = this.client.createTransaction( + bundle, + transactionOptions + ); + + await transaction.sign(); + await transaction.upload(); + + return { + storageId: transaction.id, + storageData: transaction.rawData, + }; + } + + async retrieveBundle(storageId: string, timeout: number) { + const { data: storageData } = await axios.get( + `https://arweave.net/${storageId}`, + { responseType: "arraybuffer", timeout } + ); + + return { storageId, storageData }; + } +} diff --git a/common/protocol/src/reactors/storageProviders/NoStorageProvider.ts b/common/protocol/src/reactors/storageProviders/NoStorageProvider.ts new file mode 100644 index 00000000..0febcd11 --- /dev/null +++ b/common/protocol/src/reactors/storageProviders/NoStorageProvider.ts @@ -0,0 +1,33 @@ +import { sha256 } from "../.."; +import { BundleTag, IStorageProvider } from "../../types"; + +export class NoStorageProvider implements IStorageProvider { + public name = "NoStorageProvider"; + public decimals = 0; + + async init(_storagePriv: string) { + return this; + } + + async getAddress() { + return ""; + } + + async getBalance() { + return ""; + } + + async saveBundle(bundle: Buffer, _tags: BundleTag[]) { + return { + storageId: sha256(bundle), + storageData: Buffer.from(""), + }; + } + + async retrieveBundle(storageId: string, _timeout: number) { + return { + storageId, + storageData: Buffer.from(""), + }; + } +} diff --git a/common/protocol/src/scripts/checksum.ts b/common/protocol/src/scripts/checksum.ts new file mode 100644 index 00000000..0caf41ae --- /dev/null +++ b/common/protocol/src/scripts/checksum.ts @@ -0,0 +1,35 @@ +import crypto from "crypto"; +import { createReadStream, readdirSync, writeFileSync } from "fs"; + +export const getChecksum = (path: string): Promise => { + return new Promise((resolve, reject) => { + const hash = crypto.createHash("sha256"); + const input = createReadStream(path); + + input.on("error", reject); + + input.on("data", (chunk: Buffer) => { + hash.update(chunk); + }); + + input.on("close", () => { + resolve(hash.digest("hex")); + }); + }); +}; + +const main = async () => { + const files = readdirSync(`./out/`); + let result = ""; + + for (const file of files) { + const checksum = await getChecksum(`./out/${file}`); + + console.log(`${file} -> ${checksum}`); + result += `${checksum} ${file}\n`; + } + + writeFileSync(`./out/checksum.txt`, result); +}; + +main(); diff --git a/common/protocol/src/types/dto.ts b/common/protocol/src/types/dto.ts new file mode 100644 index 00000000..038c72c4 --- /dev/null +++ b/common/protocol/src/types/dto.ts @@ -0,0 +1,4 @@ +export interface DataItem { + key: string; + value: any; +} diff --git a/common/protocol/src/types/index.ts b/common/protocol/src/types/index.ts new file mode 100644 index 00000000..92c8aac6 --- /dev/null +++ b/common/protocol/src/types/index.ts @@ -0,0 +1,3 @@ +export * from "./dto"; +export * from "./interfaces"; +export * from "./metrics"; diff --git a/common/protocol/src/types/interfaces/cache.interface.ts b/common/protocol/src/types/interfaces/cache.interface.ts new file mode 100644 index 00000000..9511e325 --- /dev/null +++ b/common/protocol/src/types/interfaces/cache.interface.ts @@ -0,0 +1,82 @@ +import { DataItem } from ".."; + +/** + * Interface of Cache. + * + * The Cache is responsible for caching data before its validated and stored on the Storage Provider. + * It functiones like a simple key value store. + * + * @interface ICache + */ +export interface ICacheProvider { + /** + * Name of the cache. This should be unique for every cache. + * + * @property name + * @type {string} + */ + name: string; + + /** + * Storage path of the cache. This should be the path to the folder where the data is cached. + * + * @property name + * @type {string} + */ + path: string; + + /** + * Initializes the Cache with a storage path. This method is responsible + * for setting up the folder where data will be cached. + * + * @method init + * @param {string} path folder path where the data is cached + * @return {Promise} + */ + init(path: string): Promise; + + /** + * Saves the value with a key + * + * @method put + * @param {string | number} key + * @param {DataItem} value + * @return {Promise} + */ + put(key: string, value: DataItem): Promise; + + /** + * Loads the value from a key + * + * @method get + * @param {string | number} key + * @return {Promise} + */ + get(key: string): Promise; + + /** + * Checks whether a value exists for a key + * + * @method exists + * @param {string | number} key + * @return {Promise} + */ + exists(key: string): Promise; + + /** + * Deletes the value from a key + * + * @method del + * @param {string | number} key + * @return {Promise} + */ + del(key: string): Promise; + + /** + * Deletes the entire cache and therefore all values + * + * @method drop + * @return {Promise} + */ + drop(): Promise; +} diff --git a/common/protocol/src/types/interfaces/compression.interface.ts b/common/protocol/src/types/interfaces/compression.interface.ts new file mode 100644 index 00000000..be8a7449 --- /dev/null +++ b/common/protocol/src/types/interfaces/compression.interface.ts @@ -0,0 +1,44 @@ +/** + * Interface of Compression. + * + * The Compression is responsible for compressing data before its stored on the Storage Provider. + * It is also responsible for decompressing data after retrieved from the Storage Provider. + * + * @interface ICache + */ +export interface ICompression { + /** + * Name of the compression. This should be unique for every compression type. + * + * @property name + * @type {string} + */ + name: string; + + /** + * MIME type of the compressed data. Examples are 'application/json' for raw json or + * 'application/gzip' for gzipped files + * + * @property mimeType + * @type {string} + */ + mimeType: string; + + /** + * Compresses a bundle + * + * @method compress + * @param {Buffer} data + * @return {Promise} + */ + compress(data: Buffer): Promise; + + /** + * Decompresses a bundle + * + * @method decompress + * @param {Buffer} data + * @return {Promise} + */ + decompress(data: Buffer): Promise; +} diff --git a/common/protocol/src/types/interfaces/index.ts b/common/protocol/src/types/interfaces/index.ts new file mode 100644 index 00000000..c4b6b699 --- /dev/null +++ b/common/protocol/src/types/interfaces/index.ts @@ -0,0 +1,4 @@ +export * from "./cache.interface"; +export * from "./compression.interface"; +export * from "./runtime.interface"; +export * from "./storageProvider.interface"; diff --git a/common/protocol/src/types/interfaces/runtime.interface.ts b/common/protocol/src/types/interfaces/runtime.interface.ts new file mode 100644 index 00000000..4b747c96 --- /dev/null +++ b/common/protocol/src/types/interfaces/runtime.interface.ts @@ -0,0 +1,114 @@ +import { Validator } from "../.."; +import { DataItem } from ".."; + +/** + * Interface of Runtime. + * + * The Runtime implements the custom logic of a pool and defines how data + * items are fetched and which order they should have. + * + * @interface IRuntime + */ +export interface IRuntime { + /** + * Name of the runtime. This should be unique for every runtime and should + * later match the runtime of the pool + * + * @property name + * @type {string} + */ + name: string; + + /** + * Version of the runtime. This is used for checking if the node runs the correct + * runtime version specified by the pool + * + * @property version + * @type {string} + */ + version: string; + + /** + * Gets the data item from a specific key and returns both key and the value. + * + * Deterministic behavior is required + * + * @method getDataItem + * @param {Validator} v the class of @kyvejs/protocol + * @param {string} source the source from which to get the data item from. usually an api or rpc endpoint + * @param {string} key the key of the data item + * @return {Promise} + */ + getDataItem(v: Validator, source: string, key: string): Promise; + + /** + * Prevalidates a data item right after is was retrieved from source. + * If the prevalidation fails the item gets rejected and never makes + * it to the local cache. If the prevalidation succeeds the item gets + * transformed and written to cache were it is used from submission + * of proposals or bundle validation. + * + * Deterministic behavior is required + * + * @method preValidateDataItem + * @param {Validator} v the class of @kyvejs/protocol + * @param {DataItem} item data item which gets prevalidated + * @return {Promise} + */ + prevalidateDataItem(v: Validator, item: DataItem): Promise; + + /** + * Transforms a single data item and return it. Used for example + * to remove unecessary data or format the data in a better way. + * + * Deterministic behavior is required + * + * @method transformDataItem + * @param {Validator} v the class of @kyvejs/protocol + * @param {DataItem} item data item which gets transformed + * @return {Promise} + */ + transformDataItem(v: Validator, item: DataItem): Promise; + + /** + * Validates a single data item of a bundle proposal + * + * @method validateDataItem + * @param {Validator} v the class of @kyvejs/protocol + * @param {DataItem} proposedDataItem the data item proposed by the uploader + * @param {DataItem} validationDataItem the data item which the validator created himself for validation again the proposed data item + * @return {Promise} returns whether the proposed data item is valid compared to the validation data item + */ + validateDataItem( + v: Validator, + proposedDataItem: DataItem, + validationDataItem: DataItem + ): Promise; + + /** + * Gets a formatted value string from a bundle. This produces a "summary" of + * a bundle which gets stored on-chain and therefore needs to be short. + * + * String should not be longer than 100 characters, else gas costs might be too expensive. + * + * Deterministic behavior is required + * + * @method summarizeDataBundle + * @param {Validator} v the class of @kyvejs/protocol + * @param {DataItem[]} bundle is the bundle which needs to be summarized + * @return {Promise} returns a formatted value string + */ + summarizeDataBundle(v: Validator, bundle: DataItem[]): Promise; + + /** + * Gets the next key from the current key so that the data archived has an order. + * + * Deterministic behavior is required + * + * @method nextKey + * @param {Validator} v the class of @kyvejs/protocol + * @param {string} key which gets inserted by @kyvejs/protocol + * @return {Promise} + */ + nextKey(v: Validator, key: string): Promise; +} diff --git a/common/protocol/src/types/interfaces/storageProvider.interface.ts b/common/protocol/src/types/interfaces/storageProvider.interface.ts new file mode 100644 index 00000000..14b27d4b --- /dev/null +++ b/common/protocol/src/types/interfaces/storageProvider.interface.ts @@ -0,0 +1,83 @@ +export type BundleTag = { + name: string; + value: string; +}; + +export type StorageReceipt = { + storageId: string; + storageData: Buffer; +}; + +/** + * Interface of Storage Provider. + * + * The Storage Provider handles data storage and retrieval for a pool. Usually these + * Storage Providers are decentralized and are meant to store pool data. + * + * @interface IStorageProvider + */ +export interface IStorageProvider { + /** + * Name of the storage provider. This should be unique for every storage provider. + * + * @property name + * @type {string} + */ + name: string; + + /** + * How many decimals the native currency of the storage provider has + * + * @property decimals + * @type {number} + */ + decimals: number; + + /** + * Initializes the Storage Provider with a wallet. This method is responsible + * for setting up the wallet so the storage provider can save data + * + * @method init + * @param {string} storagePriv can be a pk, a mnemonic or a keyfile which is used to setup the storage provider wallet + * @return {this} + */ + init(storagePriv: string): Promise; + + /** + * Gets the public account address of storage provider wallet + * + * @method getAddress + * @return {Promise} + */ + getAddress(): Promise; + + /** + * Gets the balance of the storage provider wallet + * + * @method getBalance + * @return {Promise} + */ + getBalance(): Promise; + + /** + * Saves a bundle on the storage provider and returns a Storage Id + * + * @method saveBundle + * @param {Buffer} bundle data of the bundle which will get saved + * @param {BundleTag[]} tags metadata that should be included + * @return {Promise} returns a storage receipt including the storage id + * with which the data can be retrieved again and the stored data on the storage provider + */ + saveBundle(bundle: Buffer, tags: BundleTag[]): Promise; + + /** + * Retrieves the bundle from the storage provider with the Storage Id + * + * @method retrieveBundle + * @param {string} storageId storage Id from which the data of the bundle can be retrieved + * @param {number} timeout timeout defines the download timeout in milliseconds + * @return {Promise} returns a storage receipt including the storage id + * with which the data was retrieved with an the actual retrieved data on the storage provider + */ + retrieveBundle(storageId: string, timeout: number): Promise; +} diff --git a/common/protocol/src/types/metrics.ts b/common/protocol/src/types/metrics.ts new file mode 100644 index 00000000..1a767691 --- /dev/null +++ b/common/protocol/src/types/metrics.ts @@ -0,0 +1,100 @@ +import { Counter, Gauge } from "prom-client"; + +type PromCounter = typeof Counter.prototype; +type PromGauge = typeof Gauge.prototype; + +export interface IMetrics { + // TX METRICS + + // MsgClaimUploaderRole metrics + tx_claim_uploader_role_successful: PromCounter; + tx_claim_uploader_role_unsuccessful: PromCounter; + tx_claim_uploader_role_failed: PromCounter; + + // MsgVoteBundleProposal metrics + tx_vote_bundle_proposal_successful: PromCounter; + tx_vote_bundle_proposal_unsuccessful: PromCounter; + tx_vote_bundle_proposal_failed: PromCounter; + + // MsgSubmitBundleProposal metrics + tx_submit_bundle_proposal_successful: PromCounter; + tx_submit_bundle_proposal_unsuccessful: PromCounter; + tx_submit_bundle_proposal_failed: PromCounter; + + // MsgSkipUploaderRole metrics + tx_skip_uploader_role_successful: PromCounter; + tx_skip_uploader_role_unsuccessful: PromCounter; + tx_skip_uploader_role_failed: PromCounter; + + // QUERY METRICS + + // QueryPool metrics + query_pool_successful: PromCounter; + query_pool_failed: PromCounter; + + // QueryCanValidate metrics + query_can_validate_successful: PromCounter; + query_can_validate_failed: PromCounter; + + // QueryCanPropose metrics + query_can_propose_successful: PromCounter; + query_can_propose_failed: PromCounter; + + // QueryCanVote metrics + query_can_vote_successful: PromCounter; + query_can_vote_failed: PromCounter; + + // STORAGE PROVIDER METRICS + + // retrieve bundle + storage_provider_retrieve_successful: PromCounter; + storage_provider_retrieve_failed: PromCounter; + + // save bundle + storage_provider_save_successful: PromCounter; + storage_provider_save_failed: PromCounter; + + // BUNDLE METRICS + + // bundle votes + bundles_voted_valid: PromCounter; + bundles_voted_invalid: PromCounter; + bundles_voted_abstain: PromCounter; + + // bundle proposals + bundles_proposed: PromCounter; + + // bundle round time + bundles_round_time: PromGauge; + bundles_remaining_upload_interval_time: PromGauge; + bundles_wait_for_next_round_time: PromGauge; + + bundles_amount: PromCounter; + bundles_data_items: PromGauge; + bundles_byte_size: PromGauge; + + // BALANCE METRICS + + balance_staker: PromGauge; + balance_valaccount: PromGauge; + balance_storage_provider: PromGauge; + + // RUNTIME METRICS + + // get data item + runtime_get_data_item_successful: PromCounter; + runtime_get_data_item_failed: PromCounter; + + // CACHE METRICS + + cache_current_items: PromGauge; + cache_index_tail: PromGauge; + cache_index_head: PromGauge; + + // GAS METRICS + + gas_claim_uploader_role: PromGauge; + gas_vote_bundle_proposal: PromGauge; + gas_submit_bundle_proposal: PromGauge; + gas_skip_uploader_role: PromGauge; +} diff --git a/common/protocol/src/utils/constants.ts b/common/protocol/src/utils/constants.ts new file mode 100644 index 00000000..c7a2189f --- /dev/null +++ b/common/protocol/src/utils/constants.ts @@ -0,0 +1,16 @@ +// the time a node should halt if the node decides to idle +export const IDLE_TIME = 60 * 1000; + +// the time a node should halt if the node decides wait for a refresh +export const REFRESH_TIME = 10 * 1000; + +// the time the node should halt if an error occurs +export const ERROR_IDLE_TIME = 10 * 1000; + +// a vote map to allow human readable votes +export const VOTE = { + UNSPECIFIED: 0, + VALID: 1, + INVALID: 2, + ABSTAIN: 3, +}; diff --git a/common/protocol/src/utils/helpers.ts b/common/protocol/src/utils/helpers.ts new file mode 100644 index 00000000..c0af7a7d --- /dev/null +++ b/common/protocol/src/utils/helpers.ts @@ -0,0 +1,170 @@ +import { BigNumber } from "bignumber.js"; +import crypto from "crypto"; + +import { DataItem } from ".."; + +const INFINITY_LOOP = true; +/** + * Waits for a specific amount of time + * + * @method sleep + * @param {number} timeoutMs + * @return {Promise} + */ +export const sleep = (timeoutMs: number): Promise => + new Promise((resolve) => setTimeout(resolve, timeoutMs)); + +/** + * Standardizes any JSON object + * + * @method standardizeJSON + * @param {any} object + * @return {any} + */ +export const standardizeJSON = (object: any): any => + JSON.parse(JSON.stringify(object)); + +/** + * Transforms a data bundle to raw bytes + * + * @method bundleToBytes + * @param {DataItem[]} bundle + * @return {Buffer} + */ +export const bundleToBytes = (bundle: DataItem[]): Buffer => + Buffer.from(JSON.stringify(bundle)); + +/** + * Transforms raw bytes to a data bundle + * + * @method bytesToBundle + * @param {DataItem[]} bundle + * @return {Buffer} + */ +export const bytesToBundle = (bytes: Buffer): DataItem[] => + JSON.parse(bytes.toString()); + +/** + * Creates a sha256 hash of raw byte data + * + * @method sha256 + * @param {Buffer} data + * @return {string} + */ +export const sha256 = (data: Buffer): string => { + if (data.byteLength) { + return crypto.createHash("sha256").update(data).digest("hex"); + } + + return ""; +}; + +/** + * Formats any bignumber into a human readable format + * + * @method toHumanReadable + * @param {string} amount + * @param {number} precision defines how many decimals after the comma should be returned + * @return {string} + */ +export const toHumanReadable = (amount: string, precision = 4): string => { + const fmt = new BigNumber(amount || "0").div(10 ** 9).toFixed(precision, 1); + + if (precision > 1) { + return `${fmt.split(".")[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",")}.${ + fmt.split(".")[1] + }`; + } + + return fmt.split(".")[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); +}; + +/** + * Generates every index pair of an array length n. Note that this + * method is O(n^2) + * + * @method generateIndexPairs + * @param {number} n length of array + * @return {[number, number][]} + */ +export const generateIndexPairs = (n: number): [number, number][] => { + const pairs: [number, number][] = []; + + for (let i = 0; i < n; i++) { + for (let j = 0; j < n; j++) { + if (i !== j && !pairs.some((pair) => pair[0] === j && pair[1] === i)) { + pairs.push([i, j]); + } + } + } + + return pairs; +}; + +type OptionsRetryerType = { + limitTimeoutMs: number; + increaseByMs: number; + maxRequests?: number; +}; + +type onErrorRetryerType = ( + value: Error, + ctx: { + nextTimeoutInMs: number; + numberOfRetries: number; + options: OptionsRetryerType; + } +) => void; + +/** + * Calls any async function with a backoff strategy which behaviour + * can be defined with options + * + * @method callWithBackoffStrategy + * @param {() => Promise} execution the method to execute with a backoff strategy + * @param {OptionsRetryerType} options defines the backoff strategy. e.g the number of retries or the timeout limit + * @param {onErrorRetryerType} onError a method which gets called if specified and if an error occurs calling the execution method + * @return {Promise} returns what the execution method returns + */ +export async function callWithBackoffStrategy( + execution: () => Promise, + options: OptionsRetryerType, + onError?: onErrorRetryerType +): Promise { + let time = options.increaseByMs; + let requests = 1; + + return new Promise((resolve, reject) => { + (async function () { + while (INFINITY_LOOP) { + try { + return resolve(await execution()); + } catch (e) { + if (onError) { + await onError(e as Error, { + nextTimeoutInMs: time, + numberOfRetries: requests, + options, + }); + } + + await sleep(time); + + if (time < options.limitTimeoutMs) { + time += options.increaseByMs; + + if (time > options.limitTimeoutMs) { + time = options.limitTimeoutMs; + } + } + + if (options.maxRequests && requests >= options.maxRequests) { + throw e; + } + + requests++; + } + } + })().catch((err) => reject(err)); + }); +} diff --git a/common/protocol/src/utils/index.ts b/common/protocol/src/utils/index.ts new file mode 100644 index 00000000..72d4db15 --- /dev/null +++ b/common/protocol/src/utils/index.ts @@ -0,0 +1,2 @@ +export * from "./constants"; +export * from "./helpers"; diff --git a/common/protocol/test/cache.test.ts b/common/protocol/test/cache.test.ts new file mode 100644 index 00000000..3ced13a9 --- /dev/null +++ b/common/protocol/test/cache.test.ts @@ -0,0 +1,1641 @@ +import { Logger } from "tslog"; +import { + DataItem, + ICompression, + IStorageProvider, + Validator, +} from "../src/index"; +import { runCache } from "../src/methods/main/runCache"; +import { genesis_pool } from "./mocks/constants"; +import { client } from "./mocks/client.mock"; +import { lcd } from "./mocks/lcd.mock"; +import { TestCacheProvider } from "./mocks/cache.mock"; +import { setupMetrics } from "../src/methods"; +import { register } from "prom-client"; +import { TestRuntime } from "./mocks/runtime.mock"; +import { TestNormalStorageProvider } from "./mocks/storageProvider.mock"; +import { TestNormalCompression } from "./mocks/compression.mock"; + +/* + +TEST CASES - cache tests + +* start caching from a pool which is in genesis state +* start caching from a pool which has a bundle proposal ongoing +* continue caching from a pool which has a bundle proposal ongoing +* start caching from a pool where last bundle proposal was dropped +* start caching from a pool where getNextDataItem fails once +* start caching from a pool where getNextDataItem fails multiple times +* start caching from a pool where transformDataItem fails +* start caching from a pool where nextKey fails +* start caching from a pool where cache methods fail +* TODO: test with pool config that has no source object +* TODO: test with pool config that has zero sources +* TODO: start caching from a pool where node has not cached anything yet + +*/ + +describe("cache tests", () => { + let v: Validator; + + let processExit: jest.Mock; + let setTimeoutMock: jest.Mock; + + let storageProvider: IStorageProvider; + let compression: ICompression; + + beforeEach(() => { + v = new Validator(new TestRuntime()); + + v["cacheProvider"] = new TestCacheProvider(); + + // mock storage provider + storageProvider = new TestNormalStorageProvider(); + v["storageProviderFactory"] = jest.fn().mockResolvedValue(storageProvider); + + // mock compression + compression = new TestNormalCompression(); + v["compressionFactory"] = jest.fn().mockReturnValue(compression); + + // mock process.exit + processExit = jest.fn(); + process.exit = processExit; + + // mock setTimeout + setTimeoutMock = jest + .fn() + .mockImplementation( + ( + callback: (args: void) => void, + ms?: number | undefined + ): NodeJS.Timeout => { + callback(); + return null as any; + } + ); + global.setTimeout = setTimeoutMock as any; + + // mock logger + v.logger = new Logger(); + + v.logger.info = jest.fn(); + v.logger.debug = jest.fn(); + v.logger.warn = jest.fn(); + v.logger.error = jest.fn(); + + v["poolId"] = 0; + v["staker"] = "test_staker"; + v["poolConfig"] = { + sources: ["https://rpc.api.moonbeam.network"], + }; + + v.client = client(); + v.lcd = lcd(); + + v["continueRound"] = jest + .fn() + .mockReturnValueOnce(true) + .mockReturnValue(false); + + v["waitForCacheContinuation"] = jest.fn(); + + setupMetrics.call(v); + }); + + afterEach(() => { + // reset prometheus + register.clear(); + }); + + test("start caching from a pool which is in genesis state", async () => { + // ARRANGE + v.pool = { + ...genesis_pool, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: n.toString(), + value: `${n}-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + n.toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n + 1, + v, + v.poolConfig.sources[0], + n.toString() + ); + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: n.toString(), + value: `${n}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + item + ); + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // we only call getNextKey max_bundle_size - 1 because + // the pool is in genesis state and therefore start_key + // is used for the first time + expect(runtime.nextKey).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) - 1 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) - 1; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + n.toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from a pool which has a bundle proposal ongoing", async () => { + // ARRANGE + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_key: "99", + current_index: "100", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "test_storage_id", + uploader: "test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "test_bundle_hash", + bundle_size: "50", + from_key: "100", + to_key: "149", + bundle_summary: "test_summary", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 50 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 50; n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size)).toString(), + value: `${ + n + parseInt(genesis_pool.data.max_bundle_size) + }-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size)).toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * 2 + 50 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + for ( + let n = parseInt(genesis_pool.data.max_bundle_size); + n < parseInt(genesis_pool.data.max_bundle_size) * 2 + 50; + n++ + ) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 50 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 50; n++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n + 1, + v, + v.poolConfig.sources[0], + (n + parseInt(genesis_pool.data.max_bundle_size)).toString() + ); + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 50 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 50; n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size)).toString(), + value: `${n + parseInt(genesis_pool.data.max_bundle_size)}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + item + ); + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 50 + ); + + // here we subtract the key - 1 because we start using the + // current key + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 50; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + (n + parseInt(genesis_pool.data.max_bundle_size) - 1).toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("continue caching from a pool which has a bundle proposal ongoing", async () => { + // ARRANGE + v["cacheProvider"].exists = jest.fn().mockImplementation((key: string) => { + const height = parseInt(key); + return height >= 100 && height <= 102; + }); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_key: "99", + current_index: "100", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "test_storage_id", + uploader: "test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "test_bundle_hash", + bundle_size: "3", + from_key: "100", + to_key: "102", + bundle_summary: "test_summary", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + value: `${ + n + parseInt(genesis_pool.data.max_bundle_size) + 3 + }-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * 2 + 3 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + for ( + let n = parseInt(genesis_pool.data.max_bundle_size); + n < parseInt(genesis_pool.data.max_bundle_size) * 2 + 3; + n++ + ) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n + 1, + v, + v.poolConfig.sources[0], + (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString() + ); + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + value: `${n + parseInt(genesis_pool.data.max_bundle_size) + 3}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + item + ); + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 3 + ); + + // here we subtract the key - 1 because we start using the + // current key + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 3; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + (n + 100 - 1).toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from a pool where last bundle proposal was dropped", async () => { + // ARRANGE + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_key: "99", + current_index: "100", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "", + uploader: "", + next_uploader: "test_staker", + data_size: "0", + data_hash: "", + bundle_size: "0", + from_key: "", + to_key: "", + bundle_summary: "", + updated_at: "0", + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size)).toString(), + value: `${ + n + parseInt(genesis_pool.data.max_bundle_size) + }-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size)).toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * 2 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) * 2; n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n + 1, + v, + v.poolConfig.sources[0], + (n + parseInt(genesis_pool.data.max_bundle_size)).toString() + ); + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size)).toString(), + value: `${n + parseInt(genesis_pool.data.max_bundle_size)}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + item + ); + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + // here we subtract the key - 1 because we start using the + // current key + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + (n + parseInt(genesis_pool.data.max_bundle_size) - 1).toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from a pool where getNextDataItem fails once", async () => { + // ARRANGE + v["runtime"].getDataItem = jest + .fn() + .mockImplementationOnce((_: Validator, __: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockRejectedValueOnce(new Error("network error")) + .mockImplementation((_: Validator, __: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + max_bundle_size: "2", + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes(2); + + for (let n = 0; n < 2; n++) { + const item = { + key: n.toString(), + value: `${n}-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + n.toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes(2); + + for (let n = 0; n < 2; n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes(2 + 1); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 1, + expect.any(Validator), + v.poolConfig.sources[0], + "0" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 2, + expect.any(Validator), + v.poolConfig.sources[0], + "1" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 3, + expect.any(Validator), + v.poolConfig.sources[0], + "1" + ); + + expect(runtime.transformDataItem).toHaveBeenCalledTimes(2); + + for (let n = 0; n < 2; n++) { + const item = { + key: n.toString(), + value: `${n}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + item + ); + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // we only call getNextKey max_bundle_size - 1 because + // the pool is in genesis state and therefore start_key + // is used for the first time + expect(runtime.nextKey).toHaveBeenCalledTimes(2 - 1); + + for (let n = 0; n < 2 - 1; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + n.toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from a pool where getNextDataItem fails multiple times", async () => { + // ARRANGE + v["runtime"].getDataItem = jest + .fn() + .mockImplementationOnce((_: Validator, __: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockRejectedValueOnce(new Error("network error")) + .mockImplementationOnce((_: Validator, __: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockRejectedValueOnce(new Error("network error")) + .mockImplementation((_: Validator, __: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ); + + v["cacheProvider"].exists = jest.fn().mockImplementation((key: string) => { + const height = parseInt(key); + return height >= 100 && height <= 102; + }); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_key: "99", + current_index: "100", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "test_storage_id", + uploader: "test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "test_bundle_hash", + bundle_size: "3", + from_key: "100", + to_key: "102", + bundle_summary: "test_summary", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + value: `${ + n + parseInt(genesis_pool.data.max_bundle_size) + 3 + }-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * 2 + 3 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + for ( + let n = parseInt(genesis_pool.data.max_bundle_size); + n < parseInt(genesis_pool.data.max_bundle_size) * 2 + 3; + n++ + ) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 2 + ); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 1, + v, + v.poolConfig.sources[0], + (0 + parseInt(genesis_pool.data.max_bundle_size) + 3).toString() + ); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 2, + v, + v.poolConfig.sources[0], + (1 + parseInt(genesis_pool.data.max_bundle_size) + 3).toString() + ); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 3, + v, + v.poolConfig.sources[0], + (1 + parseInt(genesis_pool.data.max_bundle_size) + 3).toString() + ); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 4, + v, + v.poolConfig.sources[0], + (2 + parseInt(genesis_pool.data.max_bundle_size) + 3).toString() + ); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 5, + v, + v.poolConfig.sources[0], + (2 + parseInt(genesis_pool.data.max_bundle_size) + 3).toString() + ); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 6, + v, + v.poolConfig.sources[0], + (3 + parseInt(genesis_pool.data.max_bundle_size) + 3).toString() + ); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 7, + v, + v.poolConfig.sources[0], + (4 + parseInt(genesis_pool.data.max_bundle_size) + 3).toString() + ); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 8, + v, + v.poolConfig.sources[0], + (5 + parseInt(genesis_pool.data.max_bundle_size) + 3).toString() + ); + + // ... + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + value: `${n + parseInt(genesis_pool.data.max_bundle_size) + 3}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + item + ); + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 3 + ); + + // here we subtract the key - 1 because we start using the + // current key + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 3; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + (n + 100 - 1).toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from a pool where transformDataItem fails", async () => { + // ARRANGE + v["runtime"].transformDataItem = jest + .fn() + .mockImplementationOnce((_: Validator, item: DataItem) => + Promise.resolve({ + key: item.key, + value: `${item.value}-transform`, + }) + ) + .mockImplementationOnce((_: Validator, item: DataItem) => + Promise.resolve({ + key: item.key, + value: `${item.value}-transform`, + }) + ) + .mockRejectedValueOnce(new Error()) + .mockImplementation((_: Validator, item: DataItem) => + Promise.resolve({ + key: item.key, + value: `${item.value}-transform`, + }) + ); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + max_bundle_size: "5", + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes(5); + + for (let n = 0; n < 5; n++) { + if (n === 2) { + const item = { + key: n.toString(), + value: `${n}-value`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + n.toString(), + item + ); + } else { + const item = { + key: n.toString(), + value: `${n}-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + n.toString(), + item + ); + } + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes(5); + + for (let n = 0; n < 5; n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes(5); + + for (let n = 0; n < 5; n++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + v.poolConfig.sources[0], + n.toString() + ); + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes(5); + + for (let n = 0; n < 5; n++) { + const item = { + key: n.toString(), + value: `${n}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + item + ); + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // we only call getNextKey max_bundle_size - 1 because + // the pool is in genesis state and therefore start_key + // is used for the first time + expect(runtime.nextKey).toHaveBeenCalledTimes(5 - 1); + + for (let n = 0; n < 5 - 1; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + expect.any(Validator), + n.toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from a pool where nextKey fails", async () => { + // ARRANGE + v["runtime"].nextKey = jest.fn().mockRejectedValue(new Error()); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_key: "99", + current_index: "100", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "test_storage_id", + uploader: "test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "test_bundle_hash", + bundle_size: "50", + from_key: "100", + to_key: "149", + bundle_summary: "test_summary", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes(0); + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 1 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.exists).toHaveBeenNthCalledWith( + parseInt(genesis_pool.data.max_bundle_size) + 1, + "100" + ); + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.transformDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(1); + + expect(runtime.nextKey).toHaveBeenNthCalledWith( + 1, + expect.any(Validator), + "99" + ); + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(0); + + // TODO: assert timeouts + }); + + test("start caching from a pool where cache methods fail", async () => { + // ARRANGE + v["cacheProvider"].put = jest.fn().mockRejectedValue(new Error("io error")); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_key: "99", + current_index: "100", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "test_storage_id", + uploader: "test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "test_bundle_hash", + bundle_size: "50", + from_key: "100", + to_key: "149", + bundle_summary: "test_summary", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes(1); + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 1 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.exists).toHaveBeenNthCalledWith( + parseInt(genesis_pool.data.max_bundle_size) + 1, + "100" + ); + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes(1); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 1, + v, + v.poolConfig.sources[0], + "100" + ); + + expect(runtime.transformDataItem).toHaveBeenCalledTimes(1); + + expect(runtime.transformDataItem).toHaveBeenNthCalledWith( + 1, + expect.any(Validator), + { + key: "100", + value: `100-value`, + } + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(1); + + expect(runtime.nextKey).toHaveBeenNthCalledWith( + 1, + expect.any(Validator), + "99" + ); + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(0); + + // TODO: assert timeouts + }); +}); diff --git a/common/protocol/test/genesis.test.ts b/common/protocol/test/genesis.test.ts new file mode 100644 index 00000000..ac996f56 --- /dev/null +++ b/common/protocol/test/genesis.test.ts @@ -0,0 +1,517 @@ +import { Logger } from "tslog"; +import { + bundleToBytes, + ICompression, + IStorageProvider, + Validator, + sha256, + standardizeJSON, +} from "../src/index"; +import { runNode } from "../src/methods/main/runNode"; +import { genesis_pool } from "./mocks/constants"; +import { client } from "./mocks/client.mock"; +import { lcd } from "./mocks/lcd.mock"; +import { TestNormalStorageProvider } from "./mocks/storageProvider.mock"; +import { TestCacheProvider } from "./mocks/cache.mock"; +import { TestNormalCompression } from "./mocks/compression.mock"; +import { setupMetrics } from "../src/methods"; +import { register } from "prom-client"; +import { TestRuntime } from "./mocks/runtime.mock"; +import { VoteType } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; + +/* + +TEST CASES - genesis tests + +* propose genesis bundle with valid data +* propose genesis bundle with no data bundle +* be too late to claim uploader role and instead validate + +*/ + +describe("genesis tests", () => { + let v: Validator; + + let processExit: jest.Mock; + let setTimeoutMock: jest.Mock; + + let storageProvider: IStorageProvider; + let compression: ICompression; + + beforeEach(() => { + v = new Validator(new TestRuntime()); + + v["cacheProvider"] = new TestCacheProvider(); + + // mock storage provider + storageProvider = new TestNormalStorageProvider(); + v["storageProviderFactory"] = jest.fn().mockResolvedValue(storageProvider); + + // mock compression + compression = new TestNormalCompression(); + v["compressionFactory"] = jest.fn().mockReturnValue(compression); + + // mock process.exit + processExit = jest.fn(); + process.exit = processExit; + + // mock setTimeout + setTimeoutMock = jest + .fn() + .mockImplementation( + ( + callback: (args: void) => void, + ms?: number | undefined + ): NodeJS.Timeout => { + callback(); + return null as any; + } + ); + global.setTimeout = setTimeoutMock as any; + + // mock logger + v.logger = new Logger(); + + v.logger.info = jest.fn(); + v.logger.debug = jest.fn(); + v.logger.warn = jest.fn(); + v.logger.error = jest.fn(); + + v["poolId"] = 0; + v["staker"] = "test_staker"; + + v.client = client(); + v.lcd = lcd(); + + v["continueRound"] = jest + .fn() + .mockReturnValueOnce(true) + .mockReturnValue(false); + + v["waitForNextBundleProposal"] = jest.fn(); + + setupMetrics.call(v); + }); + + afterEach(() => { + // reset prometheus + register.clear(); + }); + + test("propose genesis bundle with valid data bundle", async () => { + // ARRANGE + v["syncPoolState"] = jest + .fn() + .mockImplementationOnce(() => { + v.pool = { + ...genesis_pool, + } as any; + }) + .mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + next_uploader: "test_staker", + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + await v["cacheProvider"].put("0", bundle[0]); + await v["cacheProvider"].put("1", bundle[1]); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.claimUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + }); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.submitBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "test_storage_id", + data_size: Buffer.from(JSON.stringify(bundle)).byteLength.toString(), + data_hash: sha256(Buffer.from(JSON.stringify(bundle))), + from_index: "0", + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + }); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "0", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.saveBundle).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)), + expect.any(Array) + ); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "2"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(1); + expect(compression.compress).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)) + ); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose genesis bundle with no data bundle", async () => { + // ARRANGE + v["syncPoolState"] = jest + .fn() + .mockImplementationOnce(() => { + v.pool = { + ...genesis_pool, + } as any; + }) + .mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + next_uploader: "test_staker", + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockRejectedValue(new Error("not found")); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.claimUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + }); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.skipUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + from_index: "0", + }); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "0", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(1); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("be too late to claim uploader role and instead validate", async () => { + // ARRANGE + v["client"].kyve.bundles.v1beta1.claimUploaderRole = jest + .fn() + .mockResolvedValue({ + txHash: "test_hash", + execute: jest.fn().mockResolvedValue({ + code: 1, + }), + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest + .fn() + .mockImplementationOnce(() => { + v.pool = { + ...genesis_pool, + } as any; + }) + .mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.claimUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + }); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); +}); diff --git a/common/protocol/test/mocks/cache.mock.ts b/common/protocol/test/mocks/cache.mock.ts new file mode 100644 index 00000000..7cc46ed4 --- /dev/null +++ b/common/protocol/test/mocks/cache.mock.ts @@ -0,0 +1,28 @@ +import { DataItem } from "../../src"; + +export const TestCacheProvider = jest.fn().mockImplementation(() => { + let cache: any = {}; + + return { + name: "TestCacheProvider", + put: jest.fn().mockImplementation(async (key: string, value: DataItem) => { + cache[key] = value; + }), + get: jest.fn().mockImplementation(async (key: string) => { + if (cache[key]) { + return cache[key]; + } + + throw new Error("not found"); + }), + exists: jest.fn().mockImplementation(async (key: string) => { + return !!cache[key]; + }), + del: jest.fn().mockImplementation(async (key: string) => { + delete cache[key]; + }), + drop: jest.fn().mockImplementation(async () => { + cache = {}; + }), + }; +}); diff --git a/common/protocol/test/mocks/client.mock.ts b/common/protocol/test/mocks/client.mock.ts new file mode 100644 index 00000000..6305423f --- /dev/null +++ b/common/protocol/test/mocks/client.mock.ts @@ -0,0 +1,42 @@ +export const client = () => + ({ + nativeClient: { + getBalance: jest.fn().mockResolvedValue("0"), + getChainId: jest.fn().mockResolvedValue("kyve-local-test"), + }, + kyve: { + bundles: { + v1beta1: { + claimUploaderRole: jest.fn().mockResolvedValue({ + txHash: "claim_uploader_role_test_hash", + execute: jest.fn().mockResolvedValue({ + code: 0, + }), + }), + skipUploaderRole: jest.fn().mockResolvedValue({ + txHash: "skip_uploader_role_test_hash", + execute: jest.fn().mockResolvedValue({ + code: 0, + }), + }), + voteBundleProposal: jest.fn().mockResolvedValue({ + txHash: "vote_bundle_proposal_test_hash", + execute: jest.fn().mockResolvedValue({ + code: 0, + }), + }), + submitBundleProposal: jest.fn().mockResolvedValue({ + txHash: "submit_bundle_proposal_test_hash", + execute: jest.fn().mockResolvedValue({ + code: 0, + }), + }), + }, + }, + }, + account: { + address: "test_valaddress", + algo: "ed25519", + pubkey: new Uint8Array(), + }, + } as any); diff --git a/common/protocol/test/mocks/compression.mock.ts b/common/protocol/test/mocks/compression.mock.ts new file mode 100644 index 00000000..d678bac8 --- /dev/null +++ b/common/protocol/test/mocks/compression.mock.ts @@ -0,0 +1,25 @@ +export const TestNormalCompression = jest.fn().mockImplementation(() => { + return { + name: "TestNormalCompression", + mimeType: "application/json", + compress: jest + .fn() + .mockImplementation((data: Buffer) => Promise.resolve(data)), + decompress: jest + .fn() + .mockImplementation((data: Buffer) => Promise.resolve(data)), + }; +}); + +export const TestNoCompression = jest.fn().mockImplementation(() => { + return { + name: "TestNoCompression", + mimeType: "application/json", + compress: jest + .fn() + .mockImplementation((data: Buffer) => Promise.resolve(data)), + decompress: jest + .fn() + .mockImplementation((data: Buffer) => Promise.resolve(data)), + }; +}); diff --git a/common/protocol/test/mocks/constants.ts b/common/protocol/test/mocks/constants.ts new file mode 100644 index 00000000..8e4aa64c --- /dev/null +++ b/common/protocol/test/mocks/constants.ts @@ -0,0 +1,61 @@ +export const genesis_pool = { + id: "0", + data: { + id: "0", + name: "Moonbeam", + runtime: "@kyve/evm", + logo: "ar://9FJDam56yBbmvn8rlamEucATH5UcYqSBw468rlCXn8E", + config: "ar://bYvlKiVLb1YY0Gx4mjUhpWBkztqmA4uEN97kTaZtBfY", + start_key: "0", + current_key: "", + current_summary: "", + current_index: "0", + total_bundles: "0", + upload_interval: "120", + operating_cost: "2500000000", + min_delegation: "0", + max_bundle_size: "100", + paused: false, + funders: [ + { + address: "test_funder", + amount: "100000000000", + }, + ], + total_funds: "100000000000", + protocol: { + version: "0.0.0", + binaries: + '{"macos":"https://github.com/kyve-org/evm/releases/download/v1.0.5/kyve-evm-macos.zip"}', + last_upgrade: "0", + }, + upgrade_plan: { + version: "", + binaries: "", + scheduled_at: "0", + duration: "0", + }, + current_storage_provider_id: 0, + current_compression_id: 0, + }, + bundle_proposal: { + pool_id: "0", + storage_id: "", + uploader: "", + next_uploader: "", + data_size: "0", + data_hash: "", + bundle_size: "0", + from_key: "", + to_key: "", + bundle_summary: "", + updated_at: "0", + voters_valid: [], + voters_invalid: [], + voters_abstain: [], + }, + stakers: ["test_staker"], + total_self_delegation: "100000000000", + total_delegation: "100000000000", + status: "POOL_STATUS_ACTIVE", +}; diff --git a/common/protocol/test/mocks/lcd.mock.ts b/common/protocol/test/mocks/lcd.mock.ts new file mode 100644 index 00000000..10976973 --- /dev/null +++ b/common/protocol/test/mocks/lcd.mock.ts @@ -0,0 +1,17 @@ +export const lcd = () => + ({ + kyve: { + query: { + v1beta1: { + canVote: jest.fn().mockResolvedValue({ + possible: true, + reason: "", + }), + canPropose: jest.fn().mockResolvedValue({ + possible: true, + reason: "", + }), + }, + }, + }, + } as any); diff --git a/common/protocol/test/mocks/runtime.mock.ts b/common/protocol/test/mocks/runtime.mock.ts new file mode 100644 index 00000000..ba40ce3c --- /dev/null +++ b/common/protocol/test/mocks/runtime.mock.ts @@ -0,0 +1,39 @@ +import { DataItem, Validator, sha256 } from "../../src"; + +export const TestRuntime = jest.fn().mockImplementation(() => { + return { + name: "@kyve/evm", + version: "0.0.0", + getDataItem: jest.fn(async (_: Validator, __: string, key: string) => ({ + key, + value: `${key}-value`, + })), + prevalidateDataItem: jest.fn(async (_: Validator, __: DataItem) => true), + transformDataItem: jest.fn(async (_: Validator, item: DataItem) => ({ + key: item.key, + value: `${item.value}-transform`, + })), + validateDataItem: jest.fn( + async ( + _: Validator, + proposedDataItem: DataItem, + validationDataItem: DataItem + ) => { + const proposedDataItemHash = sha256( + Buffer.from(JSON.stringify(proposedDataItem)) + ); + const validationDataItemHash = sha256( + Buffer.from(JSON.stringify(validationDataItem)) + ); + + return proposedDataItemHash === validationDataItemHash; + } + ), + summarizeDataBundle: jest.fn(async (_: Validator, bundle: DataItem[]) => + JSON.stringify(bundle) + ), + nextKey: jest.fn(async (_: Validator, key: string) => + (parseInt(key) + 1).toString() + ), + }; +}); diff --git a/common/protocol/test/mocks/storageProvider.mock.ts b/common/protocol/test/mocks/storageProvider.mock.ts new file mode 100644 index 00000000..d620aa94 --- /dev/null +++ b/common/protocol/test/mocks/storageProvider.mock.ts @@ -0,0 +1,44 @@ +import { BundleTag } from "../../src"; + +export const TestNormalStorageProvider = jest.fn().mockImplementation(() => { + return { + name: "TestNormalStorageProvider", + decimals: 12, + init: jest.fn(), + getBalance: jest.fn().mockResolvedValue("0"), + saveBundle: jest + .fn() + .mockImplementation((bundle: Buffer, tags: BundleTag[]) => ({ + storageId: "test_storage_id", + storageData: bundle, + })), + retrieveBundle: jest + .fn() + .mockImplementation((storageId: string, timeout: number) => ({ + storageId, + storageData: Buffer.from( + JSON.stringify([ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]) + ), + })), + }; +}); + +export const TestNoStorageProvider = jest.fn().mockImplementation(() => { + return { + name: "TestNoStorageProvider", + decimals: 0, + init: jest.fn(), + getBalance: jest.fn().mockResolvedValue("0"), + saveBundle: jest.fn().mockResolvedValue({ + storageId: "test_storage_id", + storageData: Buffer.from(""), + }), + retrieveBundle: jest.fn().mockResolvedValue({ + storageId: "test_storage_id", + storageData: Buffer.from(""), + }), + }; +}); diff --git a/common/protocol/test/multiple_sources.test.ts b/common/protocol/test/multiple_sources.test.ts new file mode 100644 index 00000000..59ac3595 --- /dev/null +++ b/common/protocol/test/multiple_sources.test.ts @@ -0,0 +1,1850 @@ +import { Logger } from "tslog"; +import { + DataItem, + generateIndexPairs, + ICompression, + IStorageProvider, + Validator, + sha256, +} from "../src/index"; +import { runCache } from "../src/methods/main/runCache"; +import { genesis_pool } from "./mocks/constants"; +import { client } from "./mocks/client.mock"; +import { lcd } from "./mocks/lcd.mock"; +import { TestCacheProvider } from "./mocks/cache.mock"; +import { setupMetrics } from "../src/methods"; +import { register } from "prom-client"; +import { TestRuntime } from "./mocks/runtime.mock"; +import { TestNormalStorageProvider } from "./mocks/storageProvider.mock"; +import { TestNormalCompression } from "./mocks/compression.mock"; + +/* + +TEST CASES - multiple sources tests + +* start caching from a pool with multiple sources which is in genesis state +* start caching from a pool with multiple sources which has a bundle proposal ongoing +* continue caching from a pool with multiple sources which has a bundle proposal ongoing +* start caching from a pool with multiple sources where last bundle proposal was dropped +* start caching from a pool with multiple sources where getDataItem fails once +* start caching from a pool with multiple sources where getDataItem fails multiple times +* start caching from multiple sources but sources return different result +* start caching from multiple sources but sources but validateDataItem fails + +*/ + +describe.skip("multiple sources tests", () => { + let v: Validator; + + let processExit: jest.Mock; + let setTimeoutMock: jest.Mock; + + let storageProvider: IStorageProvider; + let compression: ICompression; + + beforeEach(() => { + v = new Validator(new TestRuntime()); + + v["cacheProvider"] = new TestCacheProvider(); + + // mock storage provider + storageProvider = new TestNormalStorageProvider(); + v["storageProviderFactory"] = jest.fn().mockResolvedValue(storageProvider); + + // mock compression + compression = new TestNormalCompression(); + v["compressionFactory"] = jest.fn().mockReturnValue(compression); + + // mock process.exit + processExit = jest.fn(); + process.exit = processExit; + + // mock setTimeout + setTimeoutMock = jest + .fn() + .mockImplementation( + ( + callback: (args: void) => void, + ms?: number | undefined + ): NodeJS.Timeout => { + callback(); + return null as any; + } + ); + global.setTimeout = setTimeoutMock as any; + + // mock logger + v.logger = new Logger(); + + v.logger.info = jest.fn(); + v.logger.debug = jest.fn(); + v.logger.warn = jest.fn(); + v.logger.error = jest.fn(); + + v["poolId"] = 0; + v["staker"] = "test_staker"; + v["poolConfig"] = { + sources: [ + "https://rpc.api.moonbeam.network", + "https://moonbeam.api.onfinality.io/public", + "https://moonbeam.public.blastapi.io", + ], + }; + + v.client = client(); + v.lcd = lcd(); + + v["continueRound"] = jest + .fn() + .mockReturnValueOnce(true) + .mockReturnValue(false); + + v["waitForCacheContinuation"] = jest.fn(); + + setupMetrics.call(v); + }); + + afterEach(() => { + // reset prometheus + register.clear(); + }); + + test("start caching from a pool with multiple sources which is in genesis state", async () => { + // ARRANGE + v.pool = { + ...genesis_pool, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: n.toString(), + value: `${n}-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + n.toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + let n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size); b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + v.poolConfig.sources[s], + b.toString() + ); + + n++; + } + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size); b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + const item = { + key: b.toString(), + value: `${b}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith(n, item); + + n++; + } + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + const pairs = generateIndexPairs(v.poolConfig.sources.length); + n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size); b++) { + for (let p = 0; p < pairs.length; p++) { + const item = { + key: b.toString(), + value: `${b}-value-transform`, + }; + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + item, + item + ); + n++; + } + } + + // we only call getNextKey max_bundle_size - 1 because + // the pool is in genesis state and therefore start_key + // is used for the first time + expect(runtime.nextKey).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) - 1 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) - 1; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from a pool with multiple sources which has a bundle proposal ongoing", async () => { + // ARRANGE + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_key: "99", + current_index: "100", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "test_storage_id", + uploader: "test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "test_bundle_hash", + bundle_size: "50", + from_key: "100", + to_key: "149", + bundle_summary: "test_summary", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 50 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 50; n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size)).toString(), + value: `${ + n + parseInt(genesis_pool.data.max_bundle_size) + }-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size)).toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 50 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 50; n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size)).toString() + ); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(100); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.del).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.drop).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + (parseInt(genesis_pool.data.max_bundle_size) + 50) * + v.poolConfig.sources.length + ); + + let n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size) + 50; b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + v.poolConfig.sources[s], + (b + parseInt(genesis_pool.data.max_bundle_size)).toString() + ); + + n++; + } + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + (parseInt(genesis_pool.data.max_bundle_size) + 50) * + v.poolConfig.sources.length + ); + + n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size) + 50; b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + const item = { + key: (b + parseInt(genesis_pool.data.max_bundle_size)).toString(), + value: `${b + parseInt(genesis_pool.data.max_bundle_size)}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith(n, item); + + n++; + } + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes( + (parseInt(genesis_pool.data.max_bundle_size) + 50) * + v.poolConfig.sources.length + ); + + const pairs = generateIndexPairs(v.poolConfig.sources.length); + n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size) + 50; b++) { + for (let p = 0; p < pairs.length; p++) { + const item = { + key: (b + parseInt(genesis_pool.data.max_bundle_size)).toString(), + value: `${ + b + parseInt(genesis_pool.data.max_bundle_size) + }-value-transform`, + }; + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + item, + item + ); + n++; + } + } + + expect(runtime.nextKey).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 50 + ); + + // here we subtract the key - 1 because we start using the + // current key + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 50; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size) - 1).toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("continue caching from a pool with multiple sources which has a bundle proposal ongoing", async () => { + // ARRANGE + v["cacheProvider"].exists = jest + .fn() + .mockResolvedValueOnce(true) + .mockResolvedValueOnce(true) + .mockResolvedValueOnce(true) + .mockResolvedValue(false); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_key: "99", + current_index: "100", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "test_storage_id", + uploader: "test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "test_bundle_hash", + bundle_size: "3", + from_key: "100", + to_key: "102", + bundle_summary: "test_summary", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + value: `${ + n + parseInt(genesis_pool.data.max_bundle_size) + 3 + }-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 3 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 3; n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size)).toString() + ); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(100); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.del).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.drop).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + let n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size); b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + v.poolConfig.sources[s], + (b + parseInt(genesis_pool.data.max_bundle_size) + 3).toString() + ); + + n++; + } + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size); b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + const item = { + key: (b + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + value: `${b + parseInt(genesis_pool.data.max_bundle_size) + 3}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith(n, item); + + n++; + } + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + const pairs = generateIndexPairs(v.poolConfig.sources.length); + n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size); b++) { + for (let p = 0; p < pairs.length; p++) { + const item = { + key: (b + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + value: `${ + b + parseInt(genesis_pool.data.max_bundle_size) + 3 + }-value-transform`, + }; + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + item, + item + ); + n++; + } + } + + expect(runtime.nextKey).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 3 + ); + + // here we subtract the key - 1 because we start using the + // current key + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 3; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + (n + 100 - 1).toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from a pool with multiple sources where last bundle proposal was dropped", async () => { + // ARRANGE + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_key: "99", + current_index: "100", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "", + uploader: "", + next_uploader: "test_staker", + data_size: "0", + data_hash: "", + bundle_size: "0", + from_key: "", + to_key: "", + bundle_summary: "", + updated_at: "0", + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size)).toString(), + value: `${ + n + parseInt(genesis_pool.data.max_bundle_size) + }-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size)).toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size)).toString() + ); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(100); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.del).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + let n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size); b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + v.poolConfig.sources[s], + (b + parseInt(genesis_pool.data.max_bundle_size)).toString() + ); + + n++; + } + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size); b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + const item = { + key: (b + parseInt(genesis_pool.data.max_bundle_size)).toString(), + value: `${b + parseInt(genesis_pool.data.max_bundle_size)}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith(n, item); + + n++; + } + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + const pairs = generateIndexPairs(v.poolConfig.sources.length); + n = 1; + + for (let b = 0; b < parseInt(genesis_pool.data.max_bundle_size); b++) { + for (let p = 0; p < pairs.length; p++) { + const item = { + key: (b + parseInt(genesis_pool.data.max_bundle_size)).toString(), + value: `${ + b + parseInt(genesis_pool.data.max_bundle_size) + }-value-transform`, + }; + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + item, + item + ); + n++; + } + } + + expect(runtime.nextKey).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + // here we subtract the key - 1 because we start using the + // current key + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size) - 1).toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from a pool with multiple sources where getDataItem fails once", async () => { + // ARRANGE + v["runtime"].getDataItem = jest + .fn() + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockRejectedValueOnce(new Error("network error")) + .mockImplementation((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + max_bundle_size: "2", + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes(2); + + for (let n = 0; n < 2; n++) { + const item = { + key: n.toString(), + value: `${n}-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + n.toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes(2); + + for (let n = 0; n < 2; n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + 2 * v.poolConfig.sources.length + 1 + ); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 1, + expect.any(Validator), + v.poolConfig.sources[0], + "0" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 2, + expect.any(Validator), + v.poolConfig.sources[1], + "0" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 3, + expect.any(Validator), + v.poolConfig.sources[2], + "0" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 4, + expect.any(Validator), + v.poolConfig.sources[0], + "1" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 5, + expect.any(Validator), + v.poolConfig.sources[1], + "1" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 5, + expect.any(Validator), + v.poolConfig.sources[1], + "1" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 6, + expect.any(Validator), + v.poolConfig.sources[2], + "1" + ); + + expect(runtime.transformDataItem).toHaveBeenCalledTimes(6); + + let n = 1; + + for (let b = 0; b < 2; b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + const item = { + key: b.toString(), + value: `${b}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith(n, item); + + n++; + } + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes( + 2 * v.poolConfig.sources.length + ); + + const pairs = generateIndexPairs(v.poolConfig.sources.length); + n = 1; + + for (let b = 0; b < 2; b++) { + for (let p = 0; p < pairs.length; p++) { + const item = { + key: b.toString(), + value: `${b}-value-transform`, + }; + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + item, + item + ); + n++; + } + } + + // we only call getNextKey max_bundle_size - 1 because + // the pool is in genesis state and therefore start_key + // is used for the first time + expect(runtime.nextKey).toHaveBeenCalledTimes(2 - 1); + + for (let n = 0; n < 2 - 1; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from a pool with multiple sources where getDataItem fails multiple times", async () => { + // ARRANGE + v["runtime"].getDataItem = jest + .fn() + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockRejectedValueOnce(new Error("network error")) + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockRejectedValueOnce(new Error("network error")) + .mockImplementation((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ); + + v["cacheProvider"].exists = jest + .fn() + .mockResolvedValueOnce(true) + .mockResolvedValueOnce(true) + .mockResolvedValueOnce(true) + .mockResolvedValue(false); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_key: "99", + current_index: "100", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "test_storage_id", + uploader: "test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "test_bundle_hash", + bundle_size: "3", + from_key: "100", + to_key: "102", + bundle_summary: "test_summary", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + const item = { + key: (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + value: `${ + n + parseInt(genesis_pool.data.max_bundle_size) + 3 + }-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 3 + ); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 3; n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith( + n + 1, + (n + parseInt(genesis_pool.data.max_bundle_size)).toString() + ); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(100); + + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size); n++) { + expect(cacheProvider.del).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.drop).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 1, + expect.any(Validator), + v.poolConfig.sources[0], + "103" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 2, + expect.any(Validator), + v.poolConfig.sources[1], + "103" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 3, + expect.any(Validator), + v.poolConfig.sources[2], + "103" + ); + + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 4, + expect.any(Validator), + v.poolConfig.sources[0], + "104" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 5, + expect.any(Validator), + v.poolConfig.sources[1], + "104" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 6, + expect.any(Validator), + v.poolConfig.sources[2], + "104" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 7, + expect.any(Validator), + v.poolConfig.sources[0], + "104" + ); + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + 8, + expect.any(Validator), + v.poolConfig.sources[2], + "104" + ); + + // ... + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + let n = 1; + + for (let b = 0; b < 2; b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + const item = { + key: (b + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + value: `${b + parseInt(genesis_pool.data.max_bundle_size) + 3}-value`, + }; + expect(runtime.transformDataItem).toHaveBeenNthCalledWith(n, item); + + n++; + } + } + + expect(runtime.validateDataItem).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) * v.poolConfig.sources.length + ); + + const pairs = generateIndexPairs(v.poolConfig.sources.length); + n = 1; + + for (let b = 0; b < 2; b++) { + for (let p = 0; p < pairs.length; p++) { + const item = { + key: (b + parseInt(genesis_pool.data.max_bundle_size) + 3).toString(), + value: `${ + b + parseInt(genesis_pool.data.max_bundle_size) + 3 + }-value-transform`, + }; + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + item, + item + ); + n++; + } + } + + expect(runtime.nextKey).toHaveBeenCalledTimes( + parseInt(genesis_pool.data.max_bundle_size) + 3 + ); + + // here we subtract the key - 1 because we start using the + // current key + for (let n = 0; n < parseInt(genesis_pool.data.max_bundle_size) + 3; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith( + n + 1, + (n + 100 - 1).toString() + ); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from multiple sources but sources return different result", async () => { + // ARRANGE + v["runtime"].getDataItem = jest + .fn() + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ) + .mockImplementationOnce((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value-invalid`, + }) + ) + .mockImplementation((v: Validator, source: string, key: string) => + Promise.resolve({ + key, + value: `${key}-value`, + }) + ); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + max_bundle_size: "3", + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes(1); + + for (let n = 0; n < 1; n++) { + const item = { + key: n.toString(), + value: `${n}-value-transform`, + }; + expect(cacheProvider.put).toHaveBeenNthCalledWith( + n + 1, + n.toString(), + item + ); + } + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes(2); + + for (let n = 0; n < 2; n++) { + expect(cacheProvider.exists).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + 2 * v.poolConfig.sources.length + ); + + let n = 1; + + for (let b = 0; b < 2; b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + v.poolConfig.sources[s], + b.toString() + ); + + n++; + } + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + 2 * v.poolConfig.sources.length + ); + + n = 1; + + for (let b = 0; b < 2; b++) { + for (let s = 0; s < v.poolConfig.sources.length; s++) { + let item; + + if (n === 5) { + item = { + key: b.toString(), + value: `${b}-value-invalid`, + }; + } else { + item = { + key: b.toString(), + value: `${b}-value`, + }; + } + + expect(runtime.transformDataItem).toHaveBeenNthCalledWith(n, item); + n++; + } + } + + const pairs = generateIndexPairs(v.poolConfig.sources.length); + n = 1; + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(4); + + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + 1, + expect.any(Validator), + { + key: `0`, + value: `0-value-transform`, + }, + { + key: `0`, + value: `0-value-transform`, + } + ); + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + 2, + expect.any(Validator), + { + key: `0`, + value: `0-value-transform`, + }, + { + key: `0`, + value: `0-value-transform`, + } + ); + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + 3, + expect.any(Validator), + { + key: `0`, + value: `0-value-transform`, + }, + { + key: `0`, + value: `0-value-transform`, + } + ); + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + 4, + expect.any(Validator), + { + key: `1`, + value: `1-value-transform`, + }, + { + key: `1`, + value: `1-value-invalid-transform`, + } + ); + + // we only call getNextKey max_bundle_size - 1 because + // the pool is in genesis state and therefore start_key + // is used for the first time + expect(runtime.nextKey).toHaveBeenCalledTimes(2 - 1); + + for (let n = 0; n < 2 - 1; n++) { + expect(runtime.nextKey).toHaveBeenNthCalledWith(n + 1, n.toString()); + } + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("start caching from multiple sources but sources but validateDataItem fails", async () => { + // ARRANGE + v["runtime"].validateDataItem = jest + .fn() + .mockImplementationOnce( + async ( + v: Validator, + proposedDataItem: DataItem, + validationDataItem: DataItem + ) => { + const proposedDataItemHash = sha256( + Buffer.from(JSON.stringify(proposedDataItem)) + ); + const validationDataItemHash = sha256( + Buffer.from(JSON.stringify(validationDataItem)) + ); + + return proposedDataItemHash === validationDataItemHash; + } + ) + .mockRejectedValueOnce(new Error()) + .mockImplementation( + async ( + v: Validator, + proposedDataItem: DataItem, + validationDataItem: DataItem + ) => { + const proposedDataItemHash = sha256( + Buffer.from(JSON.stringify(proposedDataItem)) + ); + const validationDataItemHash = sha256( + Buffer.from(JSON.stringify(validationDataItem)) + ); + + return proposedDataItemHash === validationDataItemHash; + } + ); + + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + max_bundle_size: "3", + }, + } as any; + + // ACT + await runCache.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.put).toHaveBeenCalledTimes(0); + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + expect(cacheProvider.exists).toHaveBeenCalledTimes(1); + + expect(cacheProvider.exists).toHaveBeenLastCalledWith("0"); + + expect(cacheProvider.del).toHaveBeenCalledTimes(0); + + expect(cacheProvider.drop).toHaveBeenCalledTimes(1); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.getDataItem).toHaveBeenCalledTimes( + v.poolConfig.sources.length + ); + + let n = 1; + + for (let s = 0; s < v.poolConfig.sources.length; s++) { + expect(runtime.getDataItem).toHaveBeenNthCalledWith( + n, + expect.any(Validator), + v.poolConfig.sources[s], + "0" + ); + + n++; + } + + expect(runtime.transformDataItem).toHaveBeenCalledTimes( + v.poolConfig.sources.length + ); + + n = 1; + + for (let s = 0; s < v.poolConfig.sources.length; s++) { + expect(runtime.transformDataItem).toHaveBeenNthCalledWith(n, { + key: "0", + value: "0-value", + }); + n++; + } + + n = 1; + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(2); + + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + 1, + expect.any(Validator), + { + key: `0`, + value: `0-value-transform`, + }, + { + key: `0`, + value: `0-value-transform`, + } + ); + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + 2, + expect.any(Validator), + { + key: `0`, + value: `0-value-transform`, + }, + { + key: `0`, + value: `0-value-transform`, + } + ); + + // we only call getNextKey max_bundle_size - 1 because + // the pool is in genesis state and therefore start_key + // is used for the first time + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForCacheContinuation"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); +}); diff --git a/common/protocol/test/no_storage.test.ts b/common/protocol/test/no_storage.test.ts new file mode 100644 index 00000000..e7a3be23 --- /dev/null +++ b/common/protocol/test/no_storage.test.ts @@ -0,0 +1,877 @@ +import { Logger } from "tslog"; +import { ICompression, IStorageProvider, Validator } from "../src/index"; +import { runNode } from "../src/methods/main/runNode"; +import { genesis_pool } from "./mocks/constants"; +import { client } from "./mocks/client.mock"; +import { lcd } from "./mocks/lcd.mock"; +import { TestCacheProvider } from "./mocks/cache.mock"; +import { setupMetrics } from "../src/methods"; +import { register } from "prom-client"; +import { TestRuntime } from "./mocks/runtime.mock"; +import { TestNoStorageProvider } from "./mocks/storageProvider.mock"; +import { TestNoCompression } from "./mocks/compression.mock"; +import { VoteType } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; + +/* + +TEST CASES - no storage tests + +* propose bundle with data +* propose bundle with no data +* vote valid because bundle was proposed correctly +* vote invalid because data size is not zero +* vote invalid because data hash is not empty +* vote invalid because bundle size is invalid + +*/ + +describe("no storage tests", () => { + let v: Validator; + + let processExit: jest.Mock; + let setTimeoutMock: jest.Mock; + + let storageProvider: IStorageProvider; + let compression: ICompression; + + beforeEach(() => { + v = new Validator(new TestRuntime()); + + v["cacheProvider"] = new TestCacheProvider(); + + // mock storage provider + storageProvider = new TestNoStorageProvider(); + v["storageProviderFactory"] = jest.fn().mockResolvedValue(storageProvider); + + // mock compression + compression = new TestNoCompression(); + v["compressionFactory"] = jest.fn().mockReturnValue(compression); + + // mock process.exit + processExit = jest.fn(); + process.exit = processExit; + + // mock setTimeout + setTimeoutMock = jest + .fn() + .mockImplementation( + ( + callback: (args: void) => void, + ms?: number | undefined + ): NodeJS.Timeout => { + callback(); + return null as any; + } + ); + global.setTimeout = setTimeoutMock as any; + + // mock logger + v.logger = new Logger(); + + v.logger.info = jest.fn(); + v.logger.debug = jest.fn(); + v.logger.warn = jest.fn(); + v.logger.error = jest.fn(); + + v["poolId"] = 0; + v["staker"] = "test_staker"; + + v.client = client(); + v.lcd = lcd(); + + v["waitForNextBundleProposal"] = jest.fn(); + + v["continueRound"] = jest + .fn() + .mockReturnValueOnce(true) + .mockReturnValue(false); + + setupMetrics.call(v); + }); + + afterEach(() => { + // reset prometheus + register.clear(); + }); + + test("propose bundle with data", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + { + key: "test_key_3", + value: "test_value_3", + }, + { + key: "test_key_4", + value: "test_value_4", + }, + ]; + + await v["cacheProvider"].put("102", bundle[0]); + await v["cacheProvider"].put("103", bundle[1]); + await v["cacheProvider"].put("104", bundle[2]); + await v["cacheProvider"].put("105", bundle[3]); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.submitBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "test_storage_id", + data_size: "0", + data_hash: "", + from_index: "102", + bundle_size: "4", + from_key: "test_key_1", + to_key: "test_key_4", + bundle_summary: JSON.stringify(bundle), + }); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.saveBundle).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)), + expect.any(Array) + ); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(5); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "102"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "103"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "104"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(4, "105"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(5, "106"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(1); + expect(compression.compress).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)) + ); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose bundle with no data", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + // ACT + await runNode.call(v); + + // ASSERT + + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.skipUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + from_index: "102", + }); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(1); + expect(cacheProvider.get).toHaveBeenLastCalledWith("102"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote valid because bundle was proposed correctly", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: "0", + data_hash: "", + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote invalid because data size is not zero", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: "123456", + data_hash: "", + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote invalid because data hash is not empty", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: "0", + data_hash: "test_hash", + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote invalid because bundle size is invalid", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: "0", + data_hash: "", + bundle_size: "1", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(1); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); +}); diff --git a/common/protocol/test/propose_bundle.test.ts b/common/protocol/test/propose_bundle.test.ts new file mode 100644 index 00000000..56fe8cb3 --- /dev/null +++ b/common/protocol/test/propose_bundle.test.ts @@ -0,0 +1,1618 @@ +import { Logger } from "tslog"; +import { + ICompression, + IStorageProvider, + Validator, + sha256, +} from "../src/index"; +import { runNode } from "../src/methods/main/runNode"; +import { genesis_pool } from "./mocks/constants"; +import { client } from "./mocks/client.mock"; +import { lcd } from "./mocks/lcd.mock"; +import { TestCacheProvider } from "./mocks/cache.mock"; +import { setupMetrics } from "../src/methods"; +import { register } from "prom-client"; +import { TestRuntime } from "./mocks/runtime.mock"; +import { TestNormalStorageProvider } from "./mocks/storageProvider.mock"; +import { TestNormalCompression } from "./mocks/compression.mock"; + +/* + +TEST CASES - propose bundle tests + +* propose bundle with data +* propose bundle with no data +* propose bundle after last bundle has been dropped +* propose bundle where saveBundle fails +* propose bundle but saveBundle does not return a storage id +* propose bundle where submitBundleProposal fails +* propose bundle where skipUploaderRole fails +* propose bundle where saveBundle and skipUploaderRole fails +* propose bundle where summarizeDataBundle fails +* propose bundle where compress fails + +*/ + +describe("propose bundle tests", () => { + let v: Validator; + + let processExit: jest.Mock; + let setTimeoutMock: jest.Mock; + + let storageProvider: IStorageProvider; + let compression: ICompression; + + beforeEach(() => { + v = new Validator(new TestRuntime()); + + v["cacheProvider"] = new TestCacheProvider(); + + // mock storage provider + storageProvider = new TestNormalStorageProvider(); + v["storageProviderFactory"] = jest.fn().mockResolvedValue(storageProvider); + + // mock compression + compression = new TestNormalCompression(); + v["compressionFactory"] = jest.fn().mockReturnValue(compression); + + // mock process.exit + processExit = jest.fn(); + process.exit = processExit; + + // mock setTimeout + setTimeoutMock = jest + .fn() + .mockImplementation( + ( + callback: (args: void) => void, + ms?: number | undefined + ): NodeJS.Timeout => { + callback(); + return null as any; + } + ); + global.setTimeout = setTimeoutMock as any; + + // mock logger + v.logger = new Logger(); + + v.logger.info = jest.fn(); + v.logger.debug = jest.fn(); + v.logger.warn = jest.fn(); + v.logger.error = jest.fn(); + + v["poolId"] = 0; + v["staker"] = "test_staker"; + + v.client = client(); + v.lcd = lcd(); + + v["waitForNextBundleProposal"] = jest.fn(); + + v["continueRound"] = jest + .fn() + .mockReturnValueOnce(true) + .mockReturnValue(false); + + setupMetrics.call(v); + }); + + afterEach(() => { + // reset prometheus + register.clear(); + }); + + test("propose bundle with data", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + { + key: "test_key_3", + value: "test_value_3", + }, + { + key: "test_key_4", + value: "test_value_4", + }, + ]; + + await v["cacheProvider"].put("102", bundle[0]); + await v["cacheProvider"].put("103", bundle[1]); + await v["cacheProvider"].put("104", bundle[2]); + await v["cacheProvider"].put("105", bundle[3]); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.submitBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "test_storage_id", + data_size: Buffer.from(JSON.stringify(bundle)).byteLength.toString(), + data_hash: sha256(Buffer.from(JSON.stringify(bundle))), + from_index: "102", + bundle_size: "4", + from_key: "test_key_1", + to_key: "test_key_4", + bundle_summary: JSON.stringify(bundle), + }); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.saveBundle).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)), + expect.any(Array) + ); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(5); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "102"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "103"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "104"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(4, "105"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(5, "106"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(1); + expect(compression.compress).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)) + ); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose bundle with no data", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + // ACT + await runNode.call(v); + + // ASSERT + + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.skipUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + from_index: "102", + }); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(1); + expect(cacheProvider.get).toHaveBeenLastCalledWith("102"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose bundle after last bundle has been dropped", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "", + uploader: "", + next_uploader: "test_staker", + data_size: "0", + data_hash: "", + bundle_size: "0", + from_key: "", + to_key: "", + bundle_summary: "", + updated_at: "0", + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + await v["cacheProvider"].put("100", bundle[0]); + await v["cacheProvider"].put("101", bundle[1]); + + // ACT + await runNode.call(v); + + // ASSERT + + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.submitBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "test_storage_id", + data_size: Buffer.from(JSON.stringify(bundle)).byteLength.toString(), + data_hash: sha256(Buffer.from(JSON.stringify(bundle))), + from_index: "100", + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + }); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(0); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "100", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.saveBundle).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)), + expect.any(Array) + ); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "100"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "101"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "102"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(1); + expect(compression.compress).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)) + ); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose bundle where saveBundle fails", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + storageProvider.saveBundle = jest.fn().mockRejectedValue(new Error()); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + await v["cacheProvider"].put("102", bundle[0]); + await v["cacheProvider"].put("103", bundle[1]); + + // ACT + await runNode.call(v); + + // ASSERT + + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.skipUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + from_index: "102", + }); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.saveBundle).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)), + expect.any(Array) + ); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "102"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "103"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "104"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(1); + expect(compression.compress).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)) + ); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose bundle but saveBundle does not return a storage id", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + storageProvider.saveBundle = jest.fn().mockResolvedValue(null); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + await v["cacheProvider"].put("102", bundle[0]); + await v["cacheProvider"].put("103", bundle[1]); + + // ACT + await runNode.call(v); + + // ASSERT + + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.skipUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + from_index: "102", + }); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.saveBundle).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)), + expect.any(Array) + ); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "102"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "103"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "104"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(1); + expect(compression.compress).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)) + ); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose bundle where submitBundleProposal fails", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + v["client"].kyve.bundles.v1beta1.submitBundleProposal = jest + .fn() + .mockRejectedValue(new Error()); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + await v["cacheProvider"].put("102", bundle[0]); + await v["cacheProvider"].put("103", bundle[1]); + + // ACT + await runNode.call(v); + + // ASSERT + + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.submitBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "test_storage_id", + data_size: Buffer.from(JSON.stringify(bundle)).byteLength.toString(), + data_hash: sha256(Buffer.from(JSON.stringify(bundle))), + from_index: "102", + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + }); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.saveBundle).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)), + expect.any(Array) + ); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "102"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "103"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "104"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(1); + expect(compression.compress).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)) + ); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose bundle where skipUploaderRole fails", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + v["client"].kyve.bundles.v1beta1.skipUploaderRole = jest + .fn() + .mockRejectedValue(new Error()); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + // ACT + await runNode.call(v); + + // ASSERT + + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.skipUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + from_index: "102", + }); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(1); + expect(cacheProvider.get).toHaveBeenLastCalledWith("102"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose bundle where saveBundle and skipUploaderRole fails", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + storageProvider.saveBundle = jest.fn().mockRejectedValue(new Error()); + + v["client"].kyve.bundles.v1beta1.skipUploaderRole = jest + .fn() + .mockRejectedValue(new Error()); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + await v["cacheProvider"].put("102", bundle[0]); + await v["cacheProvider"].put("103", bundle[1]); + + // ACT + await runNode.call(v); + + // ASSERT + + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.skipUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + from_index: "102", + }); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.saveBundle).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)), + expect.any(Array) + ); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "102"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "103"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "104"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(1); + expect(compression.compress).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)) + ); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose bundle where summarizeDataBundle fails", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + v["runtime"].summarizeDataBundle = jest.fn().mockRejectedValue(new Error()); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + await v["cacheProvider"].put("102", bundle[0]); + await v["cacheProvider"].put("103", bundle[1]); + + // ACT + await runNode.call(v); + + // ASSERT + + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.skipUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + from_index: "102", + }); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "102"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "103"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "104"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("propose bundle where compress fails", async () => { + // ARRANGE + v["lcd"].kyve.query.v1beta1.canVote = jest.fn().mockResolvedValue({ + possible: false, + reason: "Already voted", + }); + + compression.compress = jest.fn().mockRejectedValue(new Error()); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + data: { + ...genesis_pool.data, + current_index: "100", + current_key: "99", + }, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "test_staker", + data_size: "123456789", + data_hash: "previous_test_bundle_hash", + bundle_size: "2", + from_key: "100", + to_key: "101", + bundle_summary: "previous_test_value", + updated_at: "0", + voters_valid: ["test_staker"], + }, + } as any; + }); + + const bundle = [ + { + key: "test_key_1", + value: "test_value_1", + }, + { + key: "test_key_2", + value: "test_value_2", + }, + ]; + + await v["cacheProvider"].put("102", bundle[0]); + await v["cacheProvider"].put("103", bundle[1]); + + // ACT + await runNode.call(v); + + // ASSERT + + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(1); + expect(txs.skipUploaderRole).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + from_index: "102", + }); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(1); + expect(queries.canPropose).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + proposer: "test_valaddress", + from_index: "102", + }); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "102"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "103"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "104"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(1); + expect(compression.compress).toHaveBeenLastCalledWith( + Buffer.from(JSON.stringify(bundle)) + ); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT RUNTIME INTERFACES + // ========================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.getDataItem).toHaveBeenCalledTimes(0); + + expect(runtime.nextKey).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); +}); diff --git a/common/protocol/test/vote_abstain.test.ts b/common/protocol/test/vote_abstain.test.ts new file mode 100644 index 00000000..03980c24 --- /dev/null +++ b/common/protocol/test/vote_abstain.test.ts @@ -0,0 +1,1918 @@ +import { Logger } from "tslog"; +import { + bundleToBytes, + ICompression, + IStorageProvider, + Validator, + sha256, + standardizeJSON, +} from "../src/index"; +import { runNode } from "../src/methods/main/runNode"; +import { genesis_pool } from "./mocks/constants"; +import { client } from "./mocks/client.mock"; +import { lcd } from "./mocks/lcd.mock"; +import { TestCacheProvider } from "./mocks/cache.mock"; +import { setupMetrics } from "../src/methods"; +import { register } from "prom-client"; +import { TestRuntime } from "./mocks/runtime.mock"; +import { VoteType } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { TestNormalStorageProvider } from "./mocks/storageProvider.mock"; +import { TestNormalCompression } from "./mocks/compression.mock"; + +/* + +TEST CASES - vote abstain tests + +* TODO: test if proposed to height is greater than of loadBundle + +* vote abstain because local bundle could not be loaded at all +* vote abstain because local bundle could only be loaded partially +* vote abstain because local bundle could only be loaded partially multiple times +* vote abstain because bundle from storage provider could not be loaded +* vote abstain because bundle from storage provider could not be loaded multiple times +* vote abstain because local and storage provider bundle could not be loaded +* try to vote abstain after validator has already voted abstain +* try to vote abstain after validator has already voted valid +* try to vote abstain after validator has already voted invalid +* try to vote abstain where voteBundleProposal fails +* try to validate bundle but summarizeDataBundle fails +* try to validate bundle but validateDataItem fails + +*/ + +describe("vote abstain tests", () => { + let v: Validator; + + let processExit: jest.Mock; + let setTimeoutMock: jest.Mock; + + let storageProvider: IStorageProvider; + let compression: ICompression; + + beforeEach(() => { + v = new Validator(new TestRuntime()); + + v["cacheProvider"] = new TestCacheProvider(); + + // mock storage provider + storageProvider = new TestNormalStorageProvider(); + v["storageProviderFactory"] = jest.fn().mockResolvedValue(storageProvider); + + // mock compression + compression = new TestNormalCompression(); + v["compressionFactory"] = jest.fn().mockReturnValue(compression); + + // mock process.exit + processExit = jest.fn(); + process.exit = processExit; + + // mock setTimeout + setTimeoutMock = jest + .fn() + .mockImplementation( + ( + callback: (args: void) => void, + ms?: number | undefined + ): NodeJS.Timeout => { + callback(); + return null as any; + } + ); + global.setTimeout = setTimeoutMock as any; + + // mock logger + v.logger = new Logger(); + + v.logger.info = jest.fn(); + v.logger.debug = jest.fn(); + v.logger.warn = jest.fn(); + v.logger.error = jest.fn(); + + v["poolId"] = 0; + v["staker"] = "test_staker"; + + v.client = client(); + v.lcd = lcd(); + + v["waitForNextBundleProposal"] = jest.fn(); + + v["continueRound"] = jest + .fn() + .mockReturnValueOnce(true) + .mockReturnValue(false); + + setupMetrics.call(v); + }); + + afterEach(() => { + // reset prometheus + register.clear(); + }); + + test("vote abstain because local bundle could not be loaded at all", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(2, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote abstain because local bundle could only be loaded partially", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(2, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(4); + + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(4, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote abstain because local bundle could only be loaded partially multiple times", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + // TODO: find out how to properly mock voteBundleProposal result + // expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(5); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "1"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(4, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(5, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote abstain because bundle from storage provider could not be loaded", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + storageProvider.retrieveBundle = jest + .fn() + .mockRejectedValueOnce(new Error()) + .mockResolvedValue({ + storageId: "test_storage_id", + storageData: compressedBundle, + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(2, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(2); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 1, + "another_test_storage_id", + (120 - 20) * 1000 + ); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 2, + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote abstain because bundle from storage provider could not be loaded multiple times", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + const retrieveBundleMock = jest + .fn() + .mockRejectedValueOnce(new Error()) + .mockRejectedValueOnce(new Error()) + .mockResolvedValue({ + storageId: "test_storage_id", + storageData: compressedBundle, + }); + storageProvider.retrieveBundle = retrieveBundleMock; + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + // TODO: find out how to properly mock voteBundleProposal result + // expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(3); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 1, + "another_test_storage_id", + (120 - 20) * 1000 + ); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 2, + "another_test_storage_id", + (120 - 20) * 1000 + ); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 3, + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote abstain because local and storage provider bundle could not be loaded", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + storageProvider.retrieveBundle = jest + .fn() + .mockRejectedValueOnce(new Error()) + .mockResolvedValue({ + storageId: "test_storage_id", + storageData: compressedBundle, + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + // TODO: find out how to properly mock voteBundleProposal result + // expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(2); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 1, + "another_test_storage_id", + (120 - 20) * 1000 + ); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 2, + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote abstain after validator has already voted abstain", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + voters_abstain: ["test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote abstain after validator has already voted valid", async () => { + // ARRANGE + const canVoteMock = jest.fn().mockResolvedValue({ + possible: false, + reaseon: "already voted valid", + }); + + v.lcd.kyve.query.v1beta1.canVote = canVoteMock; + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker", "test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote abstain after validator has already voted invalid", async () => { + // ARRANGE + const canVoteMock = jest.fn().mockResolvedValue({ + possible: false, + reaseon: "already voted invalid", + }); + + v.lcd.kyve.query.v1beta1.canVote = canVoteMock; + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + voters_invalid: ["test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote abstain where voteBundleProposal fails", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["client"].kyve.bundles.v1beta1.voteBundleProposal = jest + .fn() + .mockRejectedValue(new Error()); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(2, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to validate bundle but summarizeDataBundle fails", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["runtime"].summarizeDataBundle = jest.fn().mockRejectedValue(new Error()); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to validate bundle but validateDataItem fails", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["runtime"].validateDataItem = jest.fn().mockRejectedValue(new Error()); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(1); + expect(runtime.validateDataItem).toHaveBeenLastCalledWith( + expect.any(Validator), + standardizeJSON(bundle[0]), + standardizeJSON(bundle[0]) + ); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); +}); diff --git a/common/protocol/test/vote_invalid.test.ts b/common/protocol/test/vote_invalid.test.ts new file mode 100644 index 00000000..b7e4110f --- /dev/null +++ b/common/protocol/test/vote_invalid.test.ts @@ -0,0 +1,1768 @@ +import { Logger } from "tslog"; +import { + bundleToBytes, + ICompression, + IStorageProvider, + Validator, + sha256, + standardizeJSON, +} from "../src/index"; +import { runNode } from "../src/methods/main/runNode"; +import { genesis_pool } from "./mocks/constants"; +import { client } from "./mocks/client.mock"; +import { lcd } from "./mocks/lcd.mock"; +import { TestCacheProvider } from "./mocks/cache.mock"; +import { setupMetrics } from "../src/methods"; +import { register } from "prom-client"; +import { TestRuntime } from "./mocks/runtime.mock"; +import { VoteType } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { TestNormalStorageProvider } from "./mocks/storageProvider.mock"; +import { TestNormalCompression } from "./mocks/compression.mock"; + +/* + +TEST CASES - invalid votes tests + +* vote invalid because runtime validate function returns false +* vote invalid because proposed data_size does not match +* vote invalid because proposed from_key does not match +* vote invalid because proposed to_key does not match +* vote invalid because proposed bundle_summary does not match +* vote invalid because proposed data_hash does not match +* try to vote invalid after validator has voted abstain bebore +* try to vote invalid after validator has voted invalid before +* try to vote invalid after validator has voted valid before +* vote invalid but local bundle could not be loaded in the first try +* vote invalid but bundle from storage provider could not be loaded in the first try +* try to vote invalid where voteBundleProposal fails + +*/ + +describe("invalid votes tests", () => { + let v: Validator; + + let processExit: jest.Mock; + let setTimeoutMock: jest.Mock; + + let storageProvider: IStorageProvider; + let compression: ICompression; + + beforeEach(() => { + v = new Validator(new TestRuntime()); + + v["cacheProvider"] = new TestCacheProvider(); + + // mock storage provider + storageProvider = new TestNormalStorageProvider(); + v["storageProviderFactory"] = jest.fn().mockResolvedValue(storageProvider); + + // mock compression + compression = new TestNormalCompression(); + v["compressionFactory"] = jest.fn().mockReturnValue(compression); + + // mock process.exit + processExit = jest.fn(); + process.exit = processExit; + + // mock setTimeout + setTimeoutMock = jest + .fn() + .mockImplementation( + ( + callback: (args: void) => void, + ms?: number | undefined + ): NodeJS.Timeout => { + callback(); + return null as any; + } + ); + global.setTimeout = setTimeoutMock as any; + + // mock logger + v.logger = new Logger(); + + v.logger.info = jest.fn(); + v.logger.debug = jest.fn(); + v.logger.warn = jest.fn(); + v.logger.error = jest.fn(); + + v["poolId"] = 0; + v["staker"] = "test_staker"; + + v.client = client(); + v.lcd = lcd(); + + v["waitForNextBundleProposal"] = jest.fn(); + + v["continueRound"] = jest + .fn() + .mockReturnValueOnce(true) + .mockReturnValue(false); + + setupMetrics.call(v); + }); + + afterEach(() => { + // reset prometheus + register.clear(); + }); + + test("vote invalid because runtime validate function returns false", async () => { + // ARRANGE + const validateBundleMock = jest.fn().mockResolvedValue(false); + v["runtime"].validateDataItem = validateBundleMock; + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(1); + + expect(runtime.validateDataItem).toHaveBeenLastCalledWith( + expect.any(Validator), + standardizeJSON(bundle[0]), + standardizeJSON(bundle[0]) + ); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote invalid because proposed data_size does not match", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_hash: dataHash, + data_size: "123456789", + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundleSummary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote invalid because proposed from_key does not match", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "invalid_from_key", + to_key: "invalid_to_key", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote invalid because proposed to_key does not match", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "invalid_to_key", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote invalid because proposed bundle_summary does not match", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: "invalid_test_value", + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote invalid because proposed data_hash does not match", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: "invalid_bundle_hash", + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: "test_value_2", + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote invalid after validator has voted abstain bebore", async () => { + // ARRANGE + const validateBundleMock = jest.fn().mockResolvedValue(false); + + v["runtime"].validateDataItem = validateBundleMock; + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + voters_abstain: ["test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(1); + + expect(runtime.validateDataItem).toHaveBeenLastCalledWith( + expect.any(Validator), + standardizeJSON(bundle[0]), + standardizeJSON(bundle[0]) + ); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote invalid after validator has voted invalid before", async () => { + // ARRANGE + const validateBundleMock = jest.fn().mockResolvedValue(false); + + v["runtime"].validateDataItem = validateBundleMock; + + const canVoteMock = jest.fn().mockResolvedValue({ + possible: false, + reaseon: "already voted invalid", + }); + + v.lcd.kyve.query.v1beta1.canVote = canVoteMock; + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + voters_invalid: ["test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote invalid after validator has voted valid before", async () => { + // ARRANGE + const validateBundleMock = jest.fn().mockResolvedValue(false); + + v["runtime"].validateDataItem = validateBundleMock; + + const canVoteMock = jest.fn().mockResolvedValue({ + possible: false, + reaseon: "already voted valid", + }); + v.lcd.kyve.query.v1beta1.canVote = canVoteMock; + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker", "test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote invalid but local bundle could not be loaded in the first try", async () => { + // ARRANGE + v["runtime"].validateDataItem = jest.fn().mockResolvedValue(false); + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(2, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(1); + + expect(runtime.validateDataItem).toHaveBeenLastCalledWith( + expect.any(Validator), + standardizeJSON(bundle[0]), + standardizeJSON(bundle[0]) + ); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote invalid but bundle from storage provider could not be loaded in the first try", async () => { + // ARRANGE + v["runtime"].validateDataItem = jest.fn().mockResolvedValue(false); + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + storageProvider.retrieveBundle = jest + .fn() + .mockRejectedValueOnce(new Error()) + .mockResolvedValue({ + storageId: "test_storage_id", + storageData: compressedBundle, + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(2, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(2); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 1, + "another_test_storage_id", + (120 - 20) * 1000 + ); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 2, + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(1); + + expect(runtime.validateDataItem).toHaveBeenLastCalledWith( + expect.any(Validator), + standardizeJSON(bundle[0]), + standardizeJSON(bundle[0]) + ); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote invalid where voteBundleProposal fails", async () => { + // ARRANGE + v["runtime"].validateDataItem = jest.fn().mockResolvedValue(false); + + v["client"].kyve.bundles.v1beta1.voteBundleProposal = jest + .fn() + .mockRejectedValue(new Error()); + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_INVALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(1); + + expect(runtime.validateDataItem).toHaveBeenLastCalledWith( + expect.any(Validator), + standardizeJSON(bundle[0]), + standardizeJSON(bundle[0]) + ); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); +}); diff --git a/common/protocol/test/vote_valid.test.ts b/common/protocol/test/vote_valid.test.ts new file mode 100644 index 00000000..e45e570a --- /dev/null +++ b/common/protocol/test/vote_valid.test.ts @@ -0,0 +1,1105 @@ +import { Logger } from "tslog"; +import { + bundleToBytes, + ICompression, + IStorageProvider, + Validator, + sha256, + standardizeJSON, +} from "../src/index"; +import { runNode } from "../src/methods/main/runNode"; +import { genesis_pool } from "./mocks/constants"; +import { client } from "./mocks/client.mock"; +import { lcd } from "./mocks/lcd.mock"; +import { TestCacheProvider } from "./mocks/cache.mock"; +import { setupMetrics } from "../src/methods"; +import { register } from "prom-client"; +import { TestRuntime } from "./mocks/runtime.mock"; +import { VoteType } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { TestNormalStorageProvider } from "./mocks/storageProvider.mock"; +import { TestNormalCompression } from "./mocks/compression.mock"; + +/* + +TEST CASES - vote valid tests + +* vote valid because bundle was proposed correctly +* vote valid but local bundle could not be loaded in the first try +* vote valid but bundle from storage provider could not be loaded in the first try +* try to vote valid after validator has voted abstain bebore +* try to vote valid after validator has voted invalid before +* try to vote valid after validator has voted valid before +* try to vote valid where voteBundleProposal fails + +*/ + +describe("vote valid tests", () => { + let v: Validator; + + let processExit: jest.Mock; + let setTimeoutMock: jest.Mock; + + let storageProvider: IStorageProvider; + let compression: ICompression; + + beforeEach(() => { + v = new Validator(new TestRuntime()); + + v["cacheProvider"] = new TestCacheProvider(); + + // mock storage provider + storageProvider = new TestNormalStorageProvider(); + v["storageProviderFactory"] = jest.fn().mockResolvedValue(storageProvider); + + // mock compression + compression = new TestNormalCompression(); + v["compressionFactory"] = jest.fn().mockReturnValue(compression); + + // mock process.exit + processExit = jest.fn(); + process.exit = processExit; + + // mock setTimeout + setTimeoutMock = jest + .fn() + .mockImplementation( + ( + callback: (args: void) => void, + ms?: number | undefined + ): NodeJS.Timeout => { + callback(); + return null as any; + } + ); + global.setTimeout = setTimeoutMock as any; + + // mock logger + v.logger = new Logger(); + + v.logger.info = jest.fn(); + v.logger.debug = jest.fn(); + v.logger.warn = jest.fn(); + v.logger.error = jest.fn(); + + v["poolId"] = 0; + v["staker"] = "test_staker"; + + v.client = client(); + v.lcd = lcd(); + + v["waitForNextBundleProposal"] = jest.fn(); + + v["continueRound"] = jest + .fn() + .mockReturnValueOnce(true) + .mockReturnValue(false); + + setupMetrics.call(v); + }); + + afterEach(() => { + // reset prometheus + register.clear(); + }); + + test("vote valid because bundle was proposed correctly", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote valid but local bundle could not be loaded in the first try", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockRejectedValueOnce(new Error("not found")) + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(2, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(3); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(3, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("vote valid but bundle from storage provider could not be loaded in the first try", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + storageProvider.retrieveBundle = jest + .fn() + .mockRejectedValueOnce(new Error()) + .mockResolvedValue({ + storageId: "test_storage_id", + storageData: compressedBundle, + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(2); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(1, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_ABSTAIN, + }); + expect(txs.voteBundleProposal).toHaveBeenNthCalledWith(2, { + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(2); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 1, + "another_test_storage_id", + (120 - 20) * 1000 + ); + expect(storageProvider.retrieveBundle).toHaveBeenNthCalledWith( + 2, + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote valid after validator has voted abstain bebore", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + voters_abstain: ["test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote valid after validator has voted invalid before", async () => { + // ARRANGE + const canVoteMock = jest.fn().mockResolvedValue({ + possible: false, + reaseon: "already voted invalid", + }); + v.lcd.kyve.query.v1beta1.canVote = canVoteMock; + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + voters_invalid: ["test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote valid after validator has voted valid before", async () => { + // ARRANGE + const canVoteMock = jest.fn().mockResolvedValue({ + possible: false, + reaseon: "already voted valid", + }); + v.lcd.kyve.query.v1beta1.canVote = canVoteMock; + + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + to_height: "2", + to_key: "test_key_2", + bundle_summary: "test_value_2", + data_hash: dataHash, + created_at: "0", + voters_valid: ["another_test_staker", "test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(0); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(0); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(0); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(0); + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); + + test("try to vote valid where voteBundleProposal fails", async () => { + // ARRANGE + const bundle = [ + { key: "test_key_1", value: "test_value_1" }, + { key: "test_key_2", value: "test_value_2" }, + ]; + + const bundleBytes = bundleToBytes(bundle); + const compressedBundle = bundleBytes; // no compression + const dataSize = compressedBundle.byteLength.toString(); + const dataHash = sha256(bundleBytes); + + v["client"].kyve.bundles.v1beta1.voteBundleProposal = jest + .fn() + .mockRejectedValue(new Error()); + + v["syncPoolState"] = jest.fn().mockImplementation(() => { + v.pool = { + ...genesis_pool, + bundle_proposal: { + ...genesis_pool.bundle_proposal, + storage_id: "another_test_storage_id", + uploader: "another_test_staker", + next_uploader: "another_test_staker", + data_size: dataSize, + data_hash: dataHash, + bundle_size: "2", + from_key: "test_key_1", + to_key: "test_key_2", + bundle_summary: JSON.stringify(bundle), + updated_at: "0", + voters_valid: ["another_test_staker"], + }, + } as any; + }); + + v["cacheProvider"].get = jest + .fn() + .mockResolvedValueOnce({ + key: "test_key_1", + value: "test_value_1", + }) + .mockResolvedValueOnce({ + key: "test_key_2", + value: "test_value_2", + }); + + // ACT + await runNode.call(v); + + // ASSERT + const txs = v["client"].kyve.bundles.v1beta1; + const queries = v["lcd"].kyve.query.v1beta1; + const cacheProvider = v["cacheProvider"]; + const runtime = v["runtime"]; + + // ======================== + // ASSERT CLIENT INTERFACES + // ======================== + + expect(txs.claimUploaderRole).toHaveBeenCalledTimes(0); + + expect(txs.voteBundleProposal).toHaveBeenCalledTimes(1); + expect(txs.voteBundleProposal).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + storage_id: "another_test_storage_id", + vote: VoteType.VOTE_TYPE_VALID, + }); + + expect(txs.submitBundleProposal).toHaveBeenCalledTimes(0); + + expect(txs.skipUploaderRole).toHaveBeenCalledTimes(0); + + // ===================== + // ASSERT LCD INTERFACES + // ===================== + + expect(queries.canVote).toHaveBeenCalledTimes(1); + expect(queries.canVote).toHaveBeenLastCalledWith({ + staker: "test_staker", + pool_id: "0", + voter: "test_valaddress", + storage_id: "another_test_storage_id", + }); + + expect(queries.canPropose).toHaveBeenCalledTimes(0); + + // ========================= + // ASSERT STORAGE INTERFACES + // ========================= + + expect(storageProvider.saveBundle).toHaveBeenCalledTimes(0); + + expect(storageProvider.retrieveBundle).toHaveBeenCalledTimes(1); + expect(storageProvider.retrieveBundle).toHaveBeenLastCalledWith( + "another_test_storage_id", + (120 - 20) * 1000 + ); + + // ======================= + // ASSERT CACHE INTERFACES + // ======================= + + expect(cacheProvider.get).toHaveBeenCalledTimes(2); + expect(cacheProvider.get).toHaveBeenNthCalledWith(1, "0"); + expect(cacheProvider.get).toHaveBeenNthCalledWith(2, "1"); + + // ============================= + // ASSERT COMPRESSION INTERFACES + // ============================= + + expect(compression.compress).toHaveBeenCalledTimes(0); + + expect(compression.decompress).toHaveBeenCalledTimes(1); + expect(compression.decompress).toHaveBeenLastCalledWith(compressedBundle); + + // ============================= + // ASSERT INTEGRATION INTERFACES + // ============================= + + expect(runtime.summarizeDataBundle).toHaveBeenCalledTimes(1); + expect(runtime.summarizeDataBundle).toHaveBeenLastCalledWith( + expect.any(Validator), + bundle + ); + + expect(runtime.validateDataItem).toHaveBeenCalledTimes(bundle.length); + + for (let i = 0; i < bundle.length; i++) { + expect(runtime.validateDataItem).toHaveBeenNthCalledWith( + i + 1, + expect.any(Validator), + standardizeJSON(bundle[i]), + standardizeJSON(bundle[i]) + ); + } + + // ======================== + // ASSERT NODEJS INTERFACES + // ======================== + + // assert that only one round ran + expect(v["waitForNextBundleProposal"]).toHaveBeenCalledTimes(1); + + // TODO: assert timeouts + }); +}); diff --git a/common/protocol/tsconfig.json b/common/protocol/tsconfig.json new file mode 100644 index 00000000..a4612d41 --- /dev/null +++ b/common/protocol/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "es2019", + "module": "commonjs", + "strict": true, + "declaration": true, + "outDir": "dist", + "esModuleInterop": true, + "resolveJsonModule": true + }, + "files": ["src/index.ts", "src/scripts/checksum.ts"] +} diff --git a/common/protocol/typedoc.json b/common/protocol/typedoc.json new file mode 100644 index 00000000..db31609a --- /dev/null +++ b/common/protocol/typedoc.json @@ -0,0 +1,11 @@ +{ + "entryPoints": ["./src/index.ts"], + "includes": ["./src"], + "out": "docs", + "excludeExternals": false, + "theme": "default", + "name": "@kyvejs/protocol", + "excludePrivate": true, + "excludeProtected": true, + "hideGenerator": true +} diff --git a/common/protocol/yarn.lock b/common/protocol/yarn.lock new file mode 100644 index 00000000..e69de29b diff --git a/common/sdk/.eslintrc b/common/sdk/.eslintrc new file mode 100644 index 00000000..549b0907 --- /dev/null +++ b/common/sdk/.eslintrc @@ -0,0 +1,9 @@ +{ + "extends": "../../.eslintrc", + "parserOptions": { + "project": "./tsconfig.json", + "ecmaVersion": 2018, + "sourceType": "module" + }, + "ignorePatterns": ["test/**/*", "test.ts", "jest.config.js"] +} \ No newline at end of file diff --git a/common/sdk/.gitignore b/common/sdk/.gitignore new file mode 100644 index 00000000..1c77adcd --- /dev/null +++ b/common/sdk/.gitignore @@ -0,0 +1,5 @@ +.idea +node_modules +docs +test.js +test.ts \ No newline at end of file diff --git a/common/sdk/.prettierignore b/common/sdk/.prettierignore new file mode 100644 index 00000000..1521c8b7 --- /dev/null +++ b/common/sdk/.prettierignore @@ -0,0 +1 @@ +dist diff --git a/common/sdk/LICENSE b/common/sdk/LICENSE new file mode 100644 index 00000000..21e34717 --- /dev/null +++ b/common/sdk/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2022 BCP Innovations UG (haftungsbeschränkt) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/common/sdk/README.md b/common/sdk/README.md new file mode 100644 index 00000000..69ce2d7b --- /dev/null +++ b/common/sdk/README.md @@ -0,0 +1,5 @@ +
+

@kyvejs/sdk

+
+ +![banner](https://arweave.net/Kb1ltyFwjCHflMAcZ7m6C0B7bslOBQ6laRhimaGFthE) diff --git a/common/sdk/jest.config.js b/common/sdk/jest.config.js new file mode 100644 index 00000000..f56ed940 --- /dev/null +++ b/common/sdk/jest.config.js @@ -0,0 +1,6 @@ +/** @type {import('ts-jest').InitialOptionsTsJest} */ +module.exports = { + preset: "ts-jest", + // testPathPattern: "test" + testMatch: ["**/*.test.ts"], +}; diff --git a/common/sdk/package.json b/common/sdk/package.json new file mode 100644 index 00000000..7b43c80d --- /dev/null +++ b/common/sdk/package.json @@ -0,0 +1,54 @@ +{ + "name": "@kyvejs/sdk", + "version": "1.0.0-beta.0", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "repository": { + "type": "git", + "url": "git+https://github.com/KYVENetwork/kyvejs.git" + }, + "author": "Ruslan Hlaznov , Troy Kessler , John Letey , Max Breithecker ", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "rimraf dist && tsc", + "format": "prettier --write .", + "doc": "typedoc", + "lint": "eslint . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx", + "lint:fix": "eslint --fix . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx" + }, + "dependencies": { + "@cosmjs/amino": "0.28.3", + "@cosmjs/crypto": "0.27.1", + "@cosmjs/encoding": "0.27.1", + "@cosmjs/proto-signing": "0.28.0", + "@cosmjs/stargate": "0.28.0", + "@cosmjs/tendermint-rpc": "0.28.0", + "@cosmostation/extension-client": "^0.0.6", + "@keplr-wallet/cosmos": "0.9.16", + "@kyvejs/types": "1.0.0-beta.0", + "axios": "0.25.0", + "bech32": "2.0.0", + "bignumber.js": "9.0.2", + "humanize-number": "0.0.2", + "qs": "^6.10.5" + }, + "devDependencies": { + "@keplr-wallet/types": "^0.9.12", + "@types/jest": "^28.1.3", + "@types/qs": "^6.9.7", + "ajv": "^8.11.0", + "copyfiles": "^2.4.1", + "jest": "^28.1.1", + "prettier": "^2.5.1", + "rimraf": "^3.0.2", + "ts-jest": "^28.0.5", + "ts-node": "^10.8.1", + "tslib": "^2.4.0", + "typedoc": "^0.22.17", + "typescript": "^4.5.5", + "typescript-json-schema": "^0.53.1" + } +} diff --git a/common/sdk/src/clients/full-client.ts b/common/sdk/src/clients/full-client.ts new file mode 100644 index 00000000..75057265 --- /dev/null +++ b/common/sdk/src/clients/full-client.ts @@ -0,0 +1,42 @@ +import { OfflineAminoSigner } from "@cosmjs/amino/build/signer"; +import { OfflineSigner, Registry } from "@cosmjs/proto-signing"; +import { GasPrice, SigningStargateClient } from "@cosmjs/stargate"; + +import * as KyveRegistryTx from "../registry/tx.registry"; +import KyveClient from "./rpc-client/client"; +import KyveWebClient from "./rpc-client/web.client"; + +export async function getSigningKyveClient( + rpcEndpoint: string, + signer: OfflineSigner, + aminoSigner: OfflineAminoSigner | null, + walletName?: undefined, + defaultTypes?: undefined +): Promise; + +export async function getSigningKyveClient( + rpcEndpoint: string, + signer: OfflineSigner, + aminoSigner: OfflineAminoSigner | null, + walletName?: string, + defaultTypes?: undefined +): Promise; + +export async function getSigningKyveClient( + rpcEndpoint: string, + signer: OfflineSigner, + aminoSigner: OfflineAminoSigner | null, + walletName?: string +): Promise { + const registry = new Registry([...KyveRegistryTx.registry]); + const gasPrice = GasPrice.fromString("0tkyve"); + const client: SigningStargateClient = + await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry, + gasPrice, + }); + const [account] = await signer.getAccounts(); + if (typeof walletName === "string") + return new KyveWebClient(client, account, aminoSigner, walletName); + return new KyveClient(client, account, aminoSigner); +} diff --git a/common/sdk/src/clients/lcd-client/client.ts b/common/sdk/src/clients/lcd-client/client.ts new file mode 100644 index 00000000..307afe1a --- /dev/null +++ b/common/sdk/src/clients/lcd-client/client.ts @@ -0,0 +1,17 @@ +import { KyveRegistryLCDClient } from "./query/v1beta1/query"; +class KyveLCDClient { + public query: { v1beta1: KyveRegistryLCDClient }; + constructor(restEndpoint: string) { + this.query = { + v1beta1: new KyveRegistryLCDClient(restEndpoint), + }; + } +} +export type KyveLCDClientType = { + kyve: KyveLCDClient; +}; +export function createKyveLCDClient(restEndpoint: string): KyveLCDClientType { + return { + kyve: new KyveLCDClient(restEndpoint), + }; +} diff --git a/common/sdk/src/clients/lcd-client/lcd-client.abstract.ts b/common/sdk/src/clients/lcd-client/lcd-client.abstract.ts new file mode 100644 index 00000000..5c440479 --- /dev/null +++ b/common/sdk/src/clients/lcd-client/lcd-client.abstract.ts @@ -0,0 +1,28 @@ +import axios from "axios"; +import qs from "qs"; + +axios.interceptors.request.use((config) => { + config.paramsSerializer = (params) => { + return qs.stringify(params, { + allowDots: true, + encode: false, + }); + }; + + return config; +}); +export class AbstractKyveLCDClient { + private restEndpoint: string; + protected request: ( + url: string, + params?: Record + ) => Promise; + + constructor(restEndpoint: string) { + this.restEndpoint = restEndpoint; + this.request = (url: string, params?: Record) => + axios + .get(new URL(url, this.restEndpoint).href, { params }) + .then((res) => res.data); + } +} diff --git a/common/sdk/src/clients/lcd-client/query/v1beta1/query.ts b/common/sdk/src/clients/lcd-client/query/v1beta1/query.ts new file mode 100644 index 00000000..ca5eb15b --- /dev/null +++ b/common/sdk/src/clients/lcd-client/query/v1beta1/query.ts @@ -0,0 +1,252 @@ +import paginationQuery from "@kyvejs/types/client/cosmos/base/query/v1beta1/pagination"; +import kyveQueryAccount from "@kyvejs/types/client/kyve/query/v1beta1/account"; +import kyveQueryBundles from "@kyvejs/types/client/kyve/query/v1beta1/bundles"; +import kyveQueryDelegation from "@kyvejs/types/client/kyve/query/v1beta1/delegation"; +import kyveQueryParamsRes from "@kyvejs/types/client/kyve/query/v1beta1/params"; +import kyveQueryPools from "@kyvejs/types/client/kyve/query/v1beta1/pools"; +import kyveQueryStakers from "@kyvejs/types/client/kyve/query/v1beta1/stakers"; +import kyveQueryAccountRes from "@kyvejs/types/lcd/kyve/query/v1beta1/account"; +import kyveQueryBundlesRes from "@kyvejs/types/lcd/kyve/query/v1beta1/bundles"; +import kyveQueryDelegationRes from "@kyvejs/types/lcd/kyve/query/v1beta1/delegation"; +import kyveQueryPoolsRes from "@kyvejs/types/lcd/kyve/query/v1beta1/pools"; +import kyveQueryStakersRes from "@kyvejs/types/lcd/kyve/query/v1beta1/stakers"; + +import { AbstractKyveLCDClient } from "../../lcd-client.abstract"; + +type NestedPartial = { + [K in keyof T]?: T[K] extends Array + ? Array> + : NestedPartial; +}; +type Overwrite = Pick> & U; +type PaginationRequestType = { + offset: string; + limit: string; + count_total: boolean; + reverse: boolean; + key: string; +}; +type PaginationPartialRequestUtilType< + T extends { pagination?: paginationQuery.PageRequest } +> = Overwrite }>; +type PaginationAllPartialRequestUtilType = NestedPartial< + Overwrite< + T, + { + pagination?: { + offset: string; + limit: string; + count_total: boolean; + reverse: boolean; + key: string; + }; + } + > +>; + +type PaginationResponseTypeUtil = Overwrite< + T, + { pagination?: { next_key: string; total: string } } +>; + +export class KyveRegistryLCDClient extends AbstractKyveLCDClient { + constructor(restEndpoint: string) { + super(restEndpoint); + } + + async params(): Promise { + const endpoint = `/kyve/query/v1beta1/params`; + return await this.request(endpoint); + } + + /** Pools **/ + async pool( + params: kyveQueryPools.QueryPoolRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/pool/${params.id}`; + return await this.request(endpoint); + } + + async pools( + params?: PaginationAllPartialRequestUtilType + ): Promise> { + const parameters: Record = {}; + if (typeof params?.pagination !== "undefined") { + parameters.pagination = params.pagination; + } + + if (typeof params?.search !== "undefined") { + parameters.search = params.search; + } + + if (typeof params?.runtime !== "undefined") { + parameters.runtime = params.runtime; + } + + if (typeof params?.paused !== "undefined") { + parameters.paused = params.paused; + } + + if (typeof params?.storage_provider_id !== "undefined") { + parameters.storageProviderId = params.storage_provider_id; + } + + const endpoint = `/kyve/query/v1beta1/pools`; + return await this.request(endpoint, parameters); + } + /** end Pools **/ + /** Stakers **/ + async stakers( + params: PaginationPartialRequestUtilType + ): Promise< + PaginationResponseTypeUtil + > { + const parameters: Record = {}; + + if (typeof params?.pagination !== "undefined") { + parameters.pagination = params.pagination; + } + const endpoint = `/kyve/query/v1beta1/stakers`; + return await this.request(endpoint, params); + } + + async staker( + params: kyveQueryStakers.QueryStakerRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/staker/${params.address}`; + return await this.request(endpoint); + } + + async stakersByPool( + params: kyveQueryStakers.QueryStakersByPoolRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/stakers_by_pool/${params.pool_id}`; + return await this.request(endpoint); + } + /** end stakers **/ + + // async finalizedBundles( + // params: PaginationPartialRequestUtilType + // ): Promise< + // PaginationResponseTypeUtil + // > { + // const parameters: Record = {}; + // + // if (typeof params?.pagination !== "undefined") { + // parameters.pagination = params.pagination; + // } + // const endpoint = `kyve/query/v1beta1/finalized_bundles/${params.pool_id}`; + // return await this.request(endpoint, parameters); + // } + /** Bundles **/ + async finalizedBundle( + params: kyveQueryBundles.QueryFinalizedBundleRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/finalized_bundle/${params.pool_id}/${params.id}`; + return await this.request(endpoint); + } + + async finalizedBundles( + params: PaginationPartialRequestUtilType + ): Promise< + PaginationResponseTypeUtil + > { + const parameters: Record = {}; + + if (typeof params?.pagination !== "undefined") { + parameters.pagination = params.pagination; + } + const endpoint = `/kyve/query/v1beta1/finalized_bundles/${params.pool_id}`; + return await this.request(endpoint, parameters); + } + async currentVoteStatus( + params: kyveQueryBundles.QueryCurrentVoteStatusRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/current_vote_status/${params.pool_id}`; + return await this.request(endpoint); + } + + async canValidate( + params: kyveQueryBundles.QueryCanValidateRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/can_validate/${params.pool_id}/${params.valaddress}`; + return await this.request(endpoint); + } + async canPropose( + params: kyveQueryBundles.QueryCanProposeRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/can_propose/${params.pool_id}/${params.staker}/${params.proposer}/${params.from_index}`; + return await this.request(endpoint); + } + async canVote( + params: kyveQueryBundles.QueryCanVoteRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/can_vote/${params.pool_id}/${params.staker}/${params.voter}/${params.storage_id}`; + return await this.request(endpoint); + } + /** end Bundles **/ + /** Delegations **/ + async delegator( + params: kyveQueryDelegation.QueryDelegatorRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/delegator/${params.staker}/${params.delegator}`; + return await this.request(endpoint); + } + async delegatorsByStaker( + params: PaginationPartialRequestUtilType + ): Promise< + PaginationResponseTypeUtil + > { + const parameters: Record = {}; + + if (typeof params?.pagination !== "undefined") { + parameters.pagination = params.pagination; + } + const endpoint = `/kyve/query/v1beta1/delegators_by_staker/${params.staker}`; + return await this.request(endpoint, parameters); + } + async stakersByDelegator( + params: PaginationPartialRequestUtilType + ): Promise< + PaginationResponseTypeUtil + > { + const parameters: Record = {}; + + if (typeof params?.pagination !== "undefined") { + parameters.pagination = params.pagination; + } + const endpoint = `/kyve/query/v1beta1/stakers_by_delegator/${params.delegator}`; + return await this.request(endpoint, parameters); + } + /** end Delegations **/ + + /*** Account **/ + async accountAssets( + params: kyveQueryAccount.QueryAccountAssetsRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/account_assets/${params.address}`; + return await this.request(endpoint); + } + + async accountDelegationUnbondings( + params: PaginationPartialRequestUtilType + ): Promise< + PaginationResponseTypeUtil + > { + const endpoint = `/kyve/query/v1beta1/account_delegation_unbondings/${params.address}`; + return await this.request(endpoint); + } + async accountFundedList( + params: kyveQueryAccount.QueryAccountFundedListRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/account_funded_list/${params.address}`; + return await this.request(endpoint); + } + async accountRedelegation( + params: kyveQueryAccount.QueryAccountRedelegationRequest + ): Promise { + const endpoint = `/kyve/query/v1beta1/account_redelegation/${params.address}`; + return await this.request(endpoint); + } + /** End Account **/ +} diff --git a/common/sdk/src/clients/rpc-client/client.ts b/common/sdk/src/clients/rpc-client/client.ts new file mode 100644 index 00000000..ec4cd25b --- /dev/null +++ b/common/sdk/src/clients/rpc-client/client.ts @@ -0,0 +1,77 @@ +import { StdSignature } from "@cosmjs/amino"; +import { AccountData, OfflineAminoSigner } from "@cosmjs/amino/build/signer"; +import { SigningStargateClient } from "@cosmjs/stargate"; +import { makeADR36AminoSignDoc } from "@keplr-wallet/cosmos"; + +import KyveBaseMethods from "./kyve/base/v1beta1/base"; +import KyveBundlesMethods from "./kyve/bundles/v1beta1/bundles"; +import KyveDelegationMethods from "./kyve/delegation/v1beta1/delegation"; +import KyveGovMethodsV1 from "./kyve/gov/v1/gov"; +import KyvePoolMethods from "./kyve/pool/v1beta1/pool"; +import KyveStakersMethods from "./kyve/stakers/v1beta1/stakers"; + +export default class KyveClient { + public nativeClient: SigningStargateClient; + public readonly account: AccountData; + public kyve: { + base: { + v1beta1: KyveBaseMethods; + }; + gov: { + v1: KyveGovMethodsV1; + }; + bundles: { + v1beta1: KyveBundlesMethods; + }; + delegation: { + v1beta1: KyveDelegationMethods; + }; + pool: { + v1beta1: KyvePoolMethods; + }; + stakers: { + v1beta1: KyveStakersMethods; + }; + }; + private aminoSigner: OfflineAminoSigner | null; + + constructor( + client: SigningStargateClient, + account: AccountData, + aminoSigner: OfflineAminoSigner | null + ) { + this.account = account; + this.nativeClient = client; + this.aminoSigner = aminoSigner; + this.kyve = { + base: { + v1beta1: new KyveBaseMethods(this.nativeClient, this.account), + }, + bundles: { + v1beta1: new KyveBundlesMethods(this.nativeClient, this.account), + }, + delegation: { + v1beta1: new KyveDelegationMethods(this.nativeClient, this.account), + }, + gov: { + v1: new KyveGovMethodsV1(this.nativeClient, this.account), + }, + pool: { + v1beta1: new KyvePoolMethods(this.nativeClient, this.account), + }, + stakers: { + v1beta1: new KyveStakersMethods(this.nativeClient, this.account), + }, + }; + } + async signString(message: string): Promise { + if (this.aminoSigner === null) + throw new Error("Wallet doesn't support adr-036"); + const signDoc = makeADR36AminoSignDoc(this.account.address, message); + const { signature } = await this.aminoSigner.signAmino( + this.account.address, + signDoc + ); + return signature; + } +} diff --git a/common/sdk/src/clients/rpc-client/kyve/base/v1beta1/base.ts b/common/sdk/src/clients/rpc-client/kyve/base/v1beta1/base.ts new file mode 100644 index 00000000..c317048d --- /dev/null +++ b/common/sdk/src/clients/rpc-client/kyve/base/v1beta1/base.ts @@ -0,0 +1,72 @@ +import { StdFee } from "@cosmjs/amino/build/signdoc"; +import { AccountData } from "@cosmjs/amino/build/signer"; +import { coins, SigningStargateClient } from "@cosmjs/stargate"; +import BigNumber from "bignumber.js"; + +import { DENOM } from "../../../../../constants"; +import { signTx, TxPromise } from "../../../../../utils/helper"; + +export default class KyveBaseMsg { + private nativeClient: SigningStargateClient; + public readonly account: AccountData; + + constructor(client: SigningStargateClient, account: AccountData) { + this.account = account; + this.nativeClient = client; + } + + async transfer( + recipient: string, + amount: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: { + fromAddress: this.account.address, + toAddress: recipient, + amount: coins(amount, DENOM), + }, + }; + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + async multiTransfer(recipient: string[], amount: string) { + const allAmount = new BigNumber(amount).multipliedBy(recipient.length); + const tx = { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", + value: { + inputs: [ + { + address: this.account.address, + coins: coins(allAmount.toString(), DENOM), + }, + ], + outputs: recipient.map((address) => ({ + address, + coins: coins(amount, DENOM), + })), + }, + }; + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx) + ); + } + + async getKyveBalance() { + const data = await this.nativeClient.getBalance( + this.account.address, + DENOM + ); + return data.amount; + } +} diff --git a/common/sdk/src/clients/rpc-client/kyve/bundles/v1beta1/bundles.ts b/common/sdk/src/clients/rpc-client/kyve/bundles/v1beta1/bundles.ts new file mode 100644 index 00000000..39d2b238 --- /dev/null +++ b/common/sdk/src/clients/rpc-client/kyve/bundles/v1beta1/bundles.ts @@ -0,0 +1,87 @@ +import { StdFee } from "@cosmjs/amino/build/signdoc"; +import { AccountData } from "@cosmjs/amino/build/signer"; +import { SigningStargateClient } from "@cosmjs/stargate"; +import { MsgSubmitBundleProposal } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgVoteBundleProposal } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgClaimUploaderRole } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgSkipUploaderRole } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; + +import { withTypeUrl } from "../../../../../registry/tx.registry"; +import { signTx, TxPromise } from "../../../../../utils/helper"; + +export default class { + private nativeClient: SigningStargateClient; + public readonly account: AccountData; + + constructor(client: SigningStargateClient, account: AccountData) { + this.account = account; + this.nativeClient = client; + } + + public async submitBundleProposal( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.submitBundleProposal({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async voteBundleProposal( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.voteBundleProposal({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async claimUploaderRole( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.claimUploaderRole({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + public async skipUploaderRole( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.skipUploaderRole({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } +} diff --git a/common/sdk/src/clients/rpc-client/kyve/delegation/v1beta1/delegation.ts b/common/sdk/src/clients/rpc-client/kyve/delegation/v1beta1/delegation.ts new file mode 100644 index 00000000..ad93c9cb --- /dev/null +++ b/common/sdk/src/clients/rpc-client/kyve/delegation/v1beta1/delegation.ts @@ -0,0 +1,86 @@ +import { StdFee } from "@cosmjs/amino/build/signdoc"; +import { AccountData } from "@cosmjs/amino/build/signer"; +import { SigningStargateClient } from "@cosmjs/stargate"; +import { MsgDelegate } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgWithdrawRewards } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgUndelegate } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgRedelegate } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; + +import { withTypeUrl } from "../../../../../registry/tx.registry"; +import { signTx, TxPromise } from "../../../../../utils/helper"; +export default class { + private nativeClient: SigningStargateClient; + public readonly account: AccountData; + + constructor(client: SigningStargateClient, account: AccountData) { + this.account = account; + this.nativeClient = client; + } + + public async delegate( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.delegate({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + public async withdrawRewards( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.withdrawRewards({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async undelegate( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.undelegate({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async redelegate( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.redelegate({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } +} diff --git a/common/sdk/src/clients/rpc-client/kyve/gov/v1/gov.ts b/common/sdk/src/clients/rpc-client/kyve/gov/v1/gov.ts new file mode 100644 index 00000000..6ccdfd35 --- /dev/null +++ b/common/sdk/src/clients/rpc-client/kyve/gov/v1/gov.ts @@ -0,0 +1,326 @@ +import { StdFee } from "@cosmjs/amino/build/signdoc"; +import { AccountData } from "@cosmjs/amino/build/signer"; +import { coins, SigningStargateClient } from "@cosmjs/stargate"; +import { VoteOption } from "@kyvejs/types/client/cosmos/gov/v1/gov"; +import { MsgUpdateParams as MsgUpdateParamsBundles } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgUpdateParams as MsgUpdateParamsDelegation } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgUpdateParams as MsgUpdateParamsFees } from "@kyvejs/types/client/kyve/fees/v1beta1/tx"; +import { + MsgCancelRuntimeUpgrade, + MsgCreatePool, + MsgPausePool, + MsgScheduleRuntimeUpgrade, + MsgUnpausePool, + MsgUpdatePool, +} from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +import { MsgUpdateParams as MsgUpdateParamsStakers } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; + +import { DENOM, GOV_AUTHORITY } from "../../../../../constants"; +import { encodeTxMsg } from "../../../../../registry/tx.registry"; +import { signTx, TxPromise } from "../../../../../utils/helper"; + +export default class KyveGovMsg { + protected nativeClient: SigningStargateClient; + public readonly account: AccountData; + + constructor(client: SigningStargateClient, account: AccountData) { + this.account = account; + this.nativeClient = client; + } + + private createGovTx( + content: { type_url: string; value: unknown }, + deposit: string, + metadata?: string + ) { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: { + messages: [content], + initial_deposit: coins(deposit.toString(), DENOM), + proposer: this.account.address, + metadata, + }, + }; + } + + public async createPool( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = this.createGovTx( + encodeTxMsg.createPool({ + ...value, + authority: GOV_AUTHORITY, + }), + deposit, + metadata + ); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async updatePool( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = this.createGovTx( + encodeTxMsg.updatePool({ + ...value, + authority: GOV_AUTHORITY, + }), + deposit, + metadata + ); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async pausePool( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = this.createGovTx( + encodeTxMsg.pausePool({ + ...value, + authority: GOV_AUTHORITY, + }), + deposit, + metadata + ); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async unpausePool( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = this.createGovTx( + encodeTxMsg.unpausePool({ + ...value, + authority: GOV_AUTHORITY, + }), + deposit, + metadata + ); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async scheduleRuntimeUpgrade( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = this.createGovTx( + encodeTxMsg.scheduleRuntimeUpgrade({ + ...value, + authority: GOV_AUTHORITY, + }), + deposit, + metadata + ); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async cancelRuntimeUpgrade( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = this.createGovTx( + encodeTxMsg.cancelRuntimeUpgrade({ + ...value, + authority: GOV_AUTHORITY, + }), + deposit, + metadata + ); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async updateParamsStakers( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = this.createGovTx( + encodeTxMsg.updateParamsStakers({ + ...value, + authority: GOV_AUTHORITY, + }), + deposit, + metadata + ); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async updateParamsDelegation( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = this.createGovTx( + encodeTxMsg.updateParamsDelegation({ + ...value, + authority: GOV_AUTHORITY, + }), + deposit, + metadata + ); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async updateParamsBundles( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = this.createGovTx( + encodeTxMsg.updateParamsBundles({ + ...value, + authority: GOV_AUTHORITY, + }), + deposit, + metadata + ); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async updateParamsFees( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = this.createGovTx( + encodeTxMsg.updateParamsFees({ + ...value, + authority: GOV_AUTHORITY, + }), + deposit, + metadata + ); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async vote( + id: string, + voteOption: "Yes" | "Abstain" | "No" | "NoWithVeto", + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + let _option = VoteOption.VOTE_OPTION_UNSPECIFIED; + + switch (voteOption) { + case "Yes": + _option = VoteOption.VOTE_OPTION_YES; + break; + case "Abstain": + _option = VoteOption.VOTE_OPTION_ABSTAIN; + break; + case "No": + _option = VoteOption.VOTE_OPTION_NO; + break; + case "NoWithVeto": + _option = VoteOption.VOTE_OPTION_NO_WITH_VETO; + break; + } + + const tx = { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: { + proposal_id: id, + voter: this.account.address, + option: _option, + }, + }; + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } +} diff --git a/common/sdk/src/clients/rpc-client/kyve/pool/v1beta1/pool.ts b/common/sdk/src/clients/rpc-client/kyve/pool/v1beta1/pool.ts new file mode 100644 index 00000000..8e08b4c0 --- /dev/null +++ b/common/sdk/src/clients/rpc-client/kyve/pool/v1beta1/pool.ts @@ -0,0 +1,87 @@ +import { StdFee } from "@cosmjs/amino/build/signdoc"; +import { AccountData } from "@cosmjs/amino/build/signer"; +import { coins, SigningStargateClient } from "@cosmjs/stargate"; +import { + MsgCreatePool, + MsgDefundPool, +} from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +import { MsgFundPool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; + +import { DENOM, GOV_AUTHORITY } from "../../../../../constants"; +import { encodeTxMsg, withTypeUrl } from "../../../../../registry/tx.registry"; +import { signTx, TxPromise } from "../../../../../utils/helper"; + +export default class { + private nativeClient: SigningStargateClient; + public readonly account: AccountData; + + constructor(client: SigningStargateClient, account: AccountData) { + this.account = account; + this.nativeClient = client; + } + + public async fundPool( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.fundPool({ + ...value, + creator: this.account.address, + }); + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async defundPool( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.defundPool({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async createPoolProposal( + value: Omit, + deposit: string, + metadata?: string, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: { + messages: [ + encodeTxMsg.createPool({ + ...value, + authority: GOV_AUTHORITY, + }), + ], + initial_deposit: coins(deposit.toString(), DENOM), + proposer: this.account.address, + metadata, + }, + }; + + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } +} diff --git a/common/sdk/src/clients/rpc-client/kyve/stakers/v1beta1/stakers.ts b/common/sdk/src/clients/rpc-client/kyve/stakers/v1beta1/stakers.ts new file mode 100644 index 00000000..1f3049f6 --- /dev/null +++ b/common/sdk/src/clients/rpc-client/kyve/stakers/v1beta1/stakers.ts @@ -0,0 +1,105 @@ +import { StdFee } from "@cosmjs/amino/build/signdoc"; +import { AccountData } from "@cosmjs/amino/build/signer"; +import { SigningStargateClient } from "@cosmjs/stargate"; +import { MsgCreateStaker as MsgStake } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgUpdateMetadata } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgUpdateCommission } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgJoinPool } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgLeavePool } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; + +import { withTypeUrl } from "../../../../../registry/tx.registry"; +import { signTx, TxPromise } from "../../../../../utils/helper"; + +export default class { + private nativeClient: SigningStargateClient; + public readonly account: AccountData; + + constructor(client: SigningStargateClient, account: AccountData) { + this.account = account; + this.nativeClient = client; + } + + public async createStaker( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.createStaker({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async updateMetadata( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.updateMetadata({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async updateCommission( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.updateCommission({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + public async joinPool( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.joinPool({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } + + public async leavePool( + value: Omit, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } + ) { + const tx = withTypeUrl.leavePool({ + ...value, + creator: this.account.address, + }); + return new TxPromise( + this.nativeClient, + await signTx(this.nativeClient, this.account.address, tx, options) + ); + } +} diff --git a/common/sdk/src/clients/rpc-client/web.client.ts b/common/sdk/src/clients/rpc-client/web.client.ts new file mode 100644 index 00000000..dcc5eb69 --- /dev/null +++ b/common/sdk/src/clients/rpc-client/web.client.ts @@ -0,0 +1,21 @@ +import { AccountData, OfflineAminoSigner } from "@cosmjs/amino/build/signer"; +import { SigningStargateClient } from "@cosmjs/stargate"; + +import KyveClient from "./client"; + +export default class KyveWebClient extends KyveClient { + private readonly walletName: string; + constructor( + client: SigningStargateClient, + account: AccountData, + aminoSigner: OfflineAminoSigner | null, + walletName: string + ) { + super(client, account, aminoSigner); + this.walletName = walletName; + } + + public getWalletName() { + return this.walletName; + } +} diff --git a/common/sdk/src/constants.ts b/common/sdk/src/constants.ts new file mode 100644 index 00000000..3a176bbc --- /dev/null +++ b/common/sdk/src/constants.ts @@ -0,0 +1,103 @@ +import { AddChainParams } from "@cosmostation/extension-client/types/message"; +import { Bech32Address } from "@keplr-wallet/cosmos"; +import { ChainInfo } from "@keplr-wallet/types"; +export const KYVE_DECIMALS = 9; +export const DENOM = "tkyve"; +export const SUPPORTED_WALLETS = { + KEPLER: "KEPLER", + COSMOSTATION: "COSMOSTATION", +} as const; +type Networks = Record; + +export const KYVE_ENDPOINTS: Networks = { + local: { + rpc: "http://0.0.0.0:26657", + rest: "http://0.0.0.0:1317", + chainId: "kyve-local", + chainName: "KYVE - Local", + }, + alpha: { + rpc: "https://rpc.alpha.kyve.network", + rest: "https://api.alpha.kyve.network", + chainId: "kyve-alpha", + chainName: "KYVE - Alpha", + }, + beta: { + rpc: "https://rpc.beta.kyve.network", + rest: "https://api.beta.kyve.network", + chainId: "kyve-beta", + chainName: "KYVE - Beta", + }, + korellia: { + rpc: "https://rpc.korellia.kyve.network", + rest: "https://api.korellia.kyve.network", + chainId: "korellia", + chainName: "Korellia", + }, +}; + +export const PREFIX = "kyve"; + +export const GOV_AUTHORITY = "kyve10d07y265gmmuvt4z0w9aw880jnsr700jdv7nah"; + +export const KYVE_KEPLR_CONFIG: ChainInfo = { + rpc: "", + rest: "", + chainId: "", + chainName: "", + stakeCurrency: { + coinDenom: "KYVE", + coinMinimalDenom: "tkyve", + coinDecimals: KYVE_DECIMALS, + }, + bip44: { + coinType: 118, + }, + bech32Config: Bech32Address.defaultBech32Config("kyve"), + currencies: [ + { + coinDenom: "KYVE", + coinMinimalDenom: "tkyve", + coinDecimals: KYVE_DECIMALS, + }, + ], + feeCurrencies: [ + { + coinDenom: "KYVE", + coinMinimalDenom: "tkyve", + coinDecimals: KYVE_DECIMALS, + }, + ], + coinType: 118, + gasPriceStep: { + low: 2, + average: 2.5, + high: 10, + }, + features: ["ibc-transfer", "ibc-go"], +}; + +export const KYVE_COSMOSTATION_CONFIG: AddChainParams = { + chainId: "", + restURL: "", + chainName: "", + baseDenom: "tkyve", + displayDenom: "KYVE", + addressPrefix: PREFIX, + coinType: "118", + decimals: KYVE_DECIMALS, + gasRate: { + tiny: "1.6", + low: "2", + average: "0.8", + }, +}; + +export type KYVE_NETWORK = "local" | "alpha" | "beta" | "korellia"; + +export type Network = { + rpc: string; + rest: string; + chainId: string; + chainName: string; +}; diff --git a/common/sdk/src/index.ts b/common/sdk/src/index.ts new file mode 100644 index 00000000..51d606d8 --- /dev/null +++ b/common/sdk/src/index.ts @@ -0,0 +1,6 @@ +export * from "./clients/lcd-client/client"; +export { default as KyveClient } from "./clients/rpc-client/client"; +export { default as KyveWebClient } from "./clients/rpc-client/web.client"; +export * as constants from "./constants"; +export { registry } from "./registry/tx.registry"; +export { KyveSDK as default } from "./sdk"; diff --git a/common/sdk/src/registry/tx.registry.ts b/common/sdk/src/registry/tx.registry.ts new file mode 100644 index 00000000..47615d1f --- /dev/null +++ b/common/sdk/src/registry/tx.registry.ts @@ -0,0 +1,402 @@ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes } from "@cosmjs/stargate"; +/** cosmos **/ +import { MsgSubmitProposal } from "@kyvejs/types/client/cosmos/gov/v1/tx"; +import { MsgVote } from "@kyvejs/types/client/cosmos/gov/v1/tx"; +/** bundles **/ +import { MsgSubmitBundleProposal } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgVoteBundleProposal } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgClaimUploaderRole } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgSkipUploaderRole } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgUpdateParams as MsgUpdateParamsBundles } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +/** delegations **/ +import { MsgDelegate } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgWithdrawRewards } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgRedelegate } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgUndelegate } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgUpdateParams as MsgUpdateParamsDelegation } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +/** fees **/ +import { MsgUpdateParams as MsgUpdateParamsFees } from "@kyvejs/types/client/kyve/fees/v1beta1/tx"; +/** pool **/ +import { MsgFundPool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +import { MsgDefundPool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +import { MsgCreatePool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +import { MsgUpdatePool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +import { MsgPausePool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +import { MsgUnpausePool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +import { MsgScheduleRuntimeUpgrade } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +import { MsgCancelRuntimeUpgrade } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +/** stakers **/ +import { MsgCreateStaker } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgUpdateMetadata } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgJoinPool } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgUpdateCommission } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgLeavePool } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgUpdateParams as MsgUpdateParamsStakers } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; + +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ...defaultRegistryTypes, + /**pool **/ + ["/kyve.pool.v1beta1.MsgFundPool", MsgFundPool], + ["/kyve.pool.v1beta1.MsgDefundPool", MsgDefundPool], + ["/kyve.pool.v1beta1.MsgCreatePool", MsgCreatePool], + ["/kyve.pool.v1beta1.UpdatePool", MsgUpdatePool], + ["/kyve.pool.v1beta1.MsgPausePool", MsgPausePool], + ["/kyve.pool.v1beta1.MsgUnpausePool", MsgUnpausePool], + ["/kyve.pool.v1beta1.MsgScheduleRuntimeUpgrade", MsgScheduleRuntimeUpgrade], + ["/kyve.pool.v1beta1.MsgCancelRuntimeUpgrade", MsgCancelRuntimeUpgrade], + /** stakers **/ + ["/kyve.stakers.v1beta1.MsgCreateStaker", MsgCreateStaker], + ["/kyve.stakers.v1beta1.MsgUpdateMetadata", MsgUpdateMetadata], + ["/kyve.stakers.v1beta1.MsgUpdateCommission", MsgUpdateCommission], + ["/kyve.stakers.v1beta1.MsgJoinPool", MsgJoinPool], + ["/kyve.stakers.v1beta1.MsgLeavePool", MsgLeavePool], + /** delegations **/ + ["/kyve.delegation.v1beta1.MsgDelegate", MsgDelegate], + ["/kyve.delegation.v1beta1.MsgWithdrawRewards", MsgWithdrawRewards], + ["/kyve.delegation.v1beta1.MsgUndelegate", MsgUndelegate], + ["/kyve.delegation.v1beta1.MsgRedelegate", MsgRedelegate], + /** bundles **/ + ["/kyve.bundles.v1beta1.MsgSubmitBundleProposal", MsgSubmitBundleProposal], + ["/kyve.bundles.v1beta1.MsgVoteBundleProposal", MsgVoteBundleProposal], + ["/kyve.bundles.v1beta1.MsgClaimUploaderRole", MsgClaimUploaderRole], + ["/kyve.bundles.v1beta1.MsgSkipUploaderRole", MsgSkipUploaderRole], + /** cosmos **/ + ["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], + ["/cosmos.gov.v1.MsgVote", MsgVote], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const encodeTxMsg = { + fundPool(value: MsgFundPool) { + return { + type_url: "/kyve.pool.v1beta1.MsgFundPool", + value: MsgFundPool.encode(value).finish(), + }; + }, + + defundPool(value: MsgDefundPool) { + return { + type_url: "/kyve.pool.v1beta1.MsgDefundPool", + value: MsgDefundPool.encode(value).finish(), + }; + }, + + createPool(value: MsgCreatePool) { + return { + type_url: "/kyve.pool.v1beta1.MsgCreatePool", + value: MsgCreatePool.encode(value).finish(), + }; + }, + + updatePool(value: MsgUpdatePool) { + return { + type_url: "/kyve.pool.v1beta1.MsgUpdatePool", + value: MsgUpdatePool.encode(value).finish(), + }; + }, + + pausePool(value: MsgPausePool) { + return { + type_url: "/kyve.pool.v1beta1.MsgPausePool", + value: MsgPausePool.encode(value).finish(), + }; + }, + + unpausePool(value: MsgUnpausePool) { + return { + type_url: "/kyve.pool.v1beta1.MsgUnpausePool", + value: MsgUnpausePool.encode(value).finish(), + }; + }, + + scheduleRuntimeUpgrade(value: MsgScheduleRuntimeUpgrade) { + return { + type_url: "/kyve.pool.v1beta1.MsgScheduleRuntimeUpgrade", + value: MsgScheduleRuntimeUpgrade.encode(value).finish(), + }; + }, + + cancelRuntimeUpgrade(value: MsgCancelRuntimeUpgrade) { + return { + type_url: "/kyve.pool.v1beta1.MsgCancelRuntimeUpgrade", + value: MsgCancelRuntimeUpgrade.encode(value).finish(), + }; + }, + + createStaker(value: MsgCreateStaker) { + return { + type_url: "/kyve.stakers.v1beta1.MsgCreateStaker", + value: MsgCreateStaker.encode(value).finish(), + }; + }, + + updateMetadata(value: MsgUpdateMetadata) { + return { + type_url: "/kyve.stakers.v1beta1.MsgUpdateMetadata", + value: MsgUpdateMetadata.encode(value).finish(), + }; + }, + + updateCommission(value: MsgUpdateCommission) { + return { + type_url: "/kyve.stakers.v1beta1.MsgUpdateCommission", + value: MsgUpdateCommission.encode(value).finish(), + }; + }, + + joinPool(value: MsgJoinPool) { + return { + type_url: "/kyve.stakers.v1beta1.MsgJoinPool", + value: MsgJoinPool.encode(value).finish(), + }; + }, + + leavePool(value: MsgJoinPool) { + return { + type_url: "/kyve.stakers.v1beta1.MsgLeavePool", + value: MsgLeavePool.encode(value).finish(), + }; + }, + + delegate(value: MsgDelegate) { + return { + type_url: "/kyve.delegation.v1beta1.MsgDelegate", + value: MsgDelegate.encode(value).finish(), + }; + }, + + withdrawRewards(value: MsgWithdrawRewards) { + return { + type_url: "/kyve.delegation.v1beta1.MsgWithdrawRewards", + value: MsgWithdrawRewards.encode(value).finish(), + }; + }, + undelegate(value: MsgUndelegate) { + return { + type_url: "/kyve.delegation.v1beta1.MsgUndelegate", + value: MsgUndelegate.encode(value).finish(), + }; + }, + + redelegate(value: MsgRedelegate) { + return { + type_url: "/kyve.delegation.v1beta1.MsgRedelegate", + value: MsgRedelegate.encode(value).finish(), + }; + }, + + submitBundleProposal(value: MsgSubmitBundleProposal) { + return { + type_url: "/kyve.bundles.v1beta1.MsgSubmitBundleProposal", + value: MsgSubmitBundleProposal.encode(value).finish(), + }; + }, + + voteBundleProposal(value: MsgVoteBundleProposal) { + return { + type_url: "/kyve.bundles.v1beta1.MsgVoteBundleProposal", + value: MsgVoteBundleProposal.encode(value).finish(), + }; + }, + + claimUploaderRole(value: MsgClaimUploaderRole) { + return { + type_url: "/kyve.bundles.v1beta1.MsgClaimUploaderRole", + value: MsgClaimUploaderRole.encode(value).finish(), + }; + }, + + updateParamsStakers(value: MsgUpdateParamsStakers) { + return { + type_url: "/kyve.stakers.v1beta1.MsgUpdateParams", + value: MsgUpdateParamsStakers.encode(value).finish(), + }; + }, + + updateParamsDelegation(value: MsgUpdateParamsDelegation) { + return { + type_url: "/kyve.delegation.v1beta1.MsgUpdateParams", + value: MsgUpdateParamsDelegation.encode(value).finish(), + }; + }, + + updateParamsBundles(value: MsgUpdateParamsBundles) { + return { + type_url: "/kyve.bundles.v1beta1.MsgUpdateParams", + value: MsgUpdateParamsBundles.encode(value).finish(), + }; + }, + + updateParamsFees(value: MsgUpdateParamsFees) { + return { + type_url: "/kyve.fees.v1beta1.MsgUpdateParams", + value: MsgUpdateParamsFees.encode(value).finish(), + }; + }, +}; + +export const withTypeUrl = { + fundPool(value: MsgFundPool) { + return { + typeUrl: "/kyve.pool.v1beta1.MsgFundPool", + value, + }; + }, + + defundPool(value: MsgDefundPool) { + return { + typeUrl: "/kyve.pool.v1beta1.MsgDefundPool", + value, + }; + }, + + createPool(value: MsgCreatePool) { + return { + typeUrl: "/kyve.pool.v1beta1.MsgCreatePool", + value, + }; + }, + + updatePool(value: MsgUpdatePool) { + return { + typeUrl: "/kyve.pool.v1beta1.MsgUpdatePool", + value, + }; + }, + + pausePool(value: MsgPausePool) { + return { + typeUrl: "/kyve.pool.v1beta1.MsgPausePool", + value, + }; + }, + + unpausePool(value: MsgUnpausePool) { + return { + typeUrl: "/kyve.pool.v1beta1.MsgUnpausePool", + value, + }; + }, + + scheduleRuntimeUpgrade(value: MsgScheduleRuntimeUpgrade) { + return { + typeUrl: "/kyve.pool.v1beta1.MsgScheduleRuntimeUpgrade", + value, + }; + }, + + cancelRuntimeUpgrade(value: MsgCancelRuntimeUpgrade) { + return { + typeUrl: "/kyve.pool.v1beta1.MsgCancelRuntimeUpgrade", + value, + }; + }, + + createStaker(value: MsgCreateStaker) { + return { + typeUrl: "/kyve.stakers.v1beta1.MsgCreateStaker", + value, + }; + }, + + updateMetadata(value: MsgUpdateMetadata) { + return { + typeUrl: "/kyve.stakers.v1beta1.MsgUpdateMetadata", + value, + }; + }, + updateCommission(value: MsgUpdateCommission) { + return { + typeUrl: "/kyve.stakers.v1beta1.MsgUpdateCommission", + value, + }; + }, + joinPool(value: MsgJoinPool) { + return { + typeUrl: "/kyve.stakers.v1beta1.MsgJoinPool", + value, + }; + }, + leavePool(value: MsgLeavePool) { + return { + typeUrl: "/kyve.stakers.v1beta1.MsgLeavePool", + value, + }; + }, + delegate(value: MsgDelegate) { + return { + typeUrl: "/kyve.delegation.v1beta1.MsgDelegate", + value, + }; + }, + withdrawRewards(value: MsgWithdrawRewards) { + return { + typeUrl: "/kyve.delegation.v1beta1.MsgWithdrawRewards", + value, + }; + }, + undelegate(value: MsgUndelegate) { + return { + typeUrl: "/kyve.delegation.v1beta1.MsgUndelegate", + value, + }; + }, + redelegate(value: MsgRedelegate) { + return { + typeUrl: "/kyve.delegation.v1beta1.MsgRedelegate", + value, + }; + }, + submitBundleProposal(value: MsgSubmitBundleProposal) { + return { + typeUrl: "/kyve.bundles.v1beta1.MsgSubmitBundleProposal", + value, + }; + }, + voteBundleProposal(value: MsgVoteBundleProposal) { + return { + typeUrl: "/kyve.bundles.v1beta1.MsgVoteBundleProposal", + value, + }; + }, + skipUploaderRole(value: MsgSkipUploaderRole) { + return { + typeUrl: "/kyve.bundles.v1beta1.MsgSkipUploaderRole", + value, + }; + }, + claimUploaderRole(value: MsgClaimUploaderRole) { + return { + typeUrl: "/kyve.bundles.v1beta1.MsgClaimUploaderRole", + value, + }; + }, + updateParamsStakers(value: MsgUpdateParamsStakers) { + return { + typeUrl: "/kyve.stakers.v1beta1.MsgUpdateParams", + value, + }; + }, + updateParamsDelegation(value: MsgUpdateParamsDelegation) { + return { + typeUrl: "/kyve.delegation.v1beta1.MsgUpdateParams", + value, + }; + }, + updateParamsBundles(value: MsgUpdateParamsBundles) { + return { + typeUrl: "/kyve.bundles.v1beta1.MsgUpdateParams", + value, + }; + }, + updateParamsFees(value: MsgUpdateParamsFees) { + return { + typeUrl: "/kyve.fees.v1beta1.MsgUpdateParams", + value, + }; + }, +}; diff --git a/common/sdk/src/sdk.ts b/common/sdk/src/sdk.ts new file mode 100644 index 00000000..b6ac3b5c --- /dev/null +++ b/common/sdk/src/sdk.ts @@ -0,0 +1,243 @@ +import { + pubkeyToAddress, + Secp256k1HdWallet, + Secp256k1Wallet, +} from "@cosmjs/amino"; +import { fromBase64, fromHex } from "@cosmjs/encoding"; +import { + DirectSecp256k1HdWallet, + DirectSecp256k1Wallet, +} from "@cosmjs/proto-signing"; +import { + RequestAccountResponse, + SignOptions, +} from "@cosmostation/extension-client/types/message"; +import { verifyADR36Amino } from "@keplr-wallet/cosmos"; +import { BigNumber } from "bignumber.js"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore +import humanize from "humanize-number"; + +import { getSigningKyveClient } from "./clients/full-client"; +import { createKyveLCDClient } from "./clients/lcd-client/client"; +import KyveClient from "./clients/rpc-client/client"; +import KyveWebClient from "./clients/rpc-client/web.client"; +import { + KYVE_COSMOSTATION_CONFIG, + KYVE_DECIMALS, + KYVE_ENDPOINTS, + KYVE_KEPLR_CONFIG, + KYVE_NETWORK, + Network, + PREFIX, + SUPPORTED_WALLETS, +} from "./constants"; +import { + cosmostationMethods, + CosmostationSigner, +} from "./utils/cosmostation-helper"; +import { KeplrAminoSigner } from "./utils/keplr-helper"; + +/** Class representing a KyveSDK. */ +export class KyveSDK { + public readonly network: Network; + private walletSupports: Set; + + /** + * Create sdk instance. + * @param network - The network type, e.g mainnet, testnet, etc + */ + constructor(network: KYVE_NETWORK | Network) { + this.walletSupports = new Set(); + if (typeof network === "string") { + this.network = KYVE_ENDPOINTS[network]; + } else { + this.network = network; + } + } + + /** + * Create a client from mnemonic + * @param mnemonic + * @return Promise + */ + async fromMnemonic(mnemonic: string): Promise { + const aminoSigner = await Secp256k1HdWallet.fromMnemonic(mnemonic, { + prefix: PREFIX, + }); + const signedClient = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { + prefix: PREFIX, + }); + return getSigningKyveClient(this.network.rpc, signedClient, aminoSigner); + } + + /** + * create a client from private key + * @param privateKey - hex privateKey + * @return Promise + */ + async fromPrivateKey(privateKey: string): Promise { + const formattedKey = fromHex( + privateKey.startsWith("0x") ? privateKey.slice(2) : privateKey + ); + const signedClient = await DirectSecp256k1Wallet.fromKey( + formattedKey, + PREFIX + ); + const aminoSigner = await Secp256k1Wallet.fromKey(formattedKey, PREFIX); + return getSigningKyveClient(this.network.rpc, signedClient, aminoSigner); + } + + /** + * Crate a client from Keplr wallet if installed + * @return Promise + */ + async fromKeplr(): Promise { + if (typeof window === "undefined") throw new Error("Unsupported."); + if (!window.keplr) throw new Error("Please install Keplr."); + await window.keplr.experimentalSuggestChain({ + ...KYVE_KEPLR_CONFIG, + rpc: this.network.rpc, + rest: this.network.rest, + chainId: this.network.chainId, + chainName: this.network.chainName, + }); + await window.keplr.enable(this.network.chainId); + window.keplr.defaultOptions = { + sign: { + preferNoSetFee: true, + }, + }; + const signer = window.keplr.getOfflineSigner(this.network.chainId); + const walletName = (await window.keplr.getKey(this.network.chainId)).name; + const keplr = window.keplr; + const keplrAminoSigner = new KeplrAminoSigner(keplr, this.network); + const client = await getSigningKyveClient( + this.network.rpc, + signer, + keplrAminoSigner, + walletName + ); + this.walletSupports.add(SUPPORTED_WALLETS.KEPLER); + return client; + } + + /** + * Crate a client from Cosmostaion wallet if installed + * @return Promise + */ + async fromCosmostation(config?: SignOptions): Promise { + if (typeof window === "undefined") throw new Error("Unsupported."); + if (!window.cosmostation) throw new Error("Please install cosmostation."); + const chain = await cosmostationMethods.getSupportedChains(); + let cosmostationAccount: RequestAccountResponse; + if ( + chain.unofficial.includes(this.network.chainName.toLowerCase().trim()) + ) { + cosmostationAccount = await cosmostationMethods.requestAccount( + this.network.chainName + ); + } else { + await cosmostationMethods.addChain({ + ...KYVE_COSMOSTATION_CONFIG, + restURL: this.network.rest, + chainId: this.network.chainId, + chainName: this.network.chainName, + }); + cosmostationAccount = await cosmostationMethods.requestAccount( + this.network.chainName + ); + } + const cosmostationSigner = new CosmostationSigner( + cosmostationAccount, + this.network, + config ? config : {} + ); + const client = await getSigningKyveClient( + this.network.rpc, + cosmostationSigner, + null, + cosmostationAccount.name + ); + this.walletSupports.add(SUPPORTED_WALLETS.COSMOSTATION); + return client; + } + + /** + * Listener to detect if account in wallet changed, support fromKeplr and fromCosmostation instances + * @param cb + */ + async onAccountChange(cb: () => void) { + if (this.walletSupports.has(SUPPORTED_WALLETS.COSMOSTATION)) + return window.cosmostation.tendermint.on("accountChanged", cb); + if (this.walletSupports.has(SUPPORTED_WALLETS.KEPLER)) + return window.addEventListener("keplr_keystorechange", cb); + throw new Error("Need to initiate from wallet"); + } + + /** + * create LCD client to get data from Rest api + */ + createLCDClient() { + return createKyveLCDClient(this.network.rest); + } + + /** + * generate KyveClient instance without mnemonic + */ + async generate() { + const signer = await DirectSecp256k1HdWallet.generate(24, { + prefix: PREFIX, + }); + const aminoSigner = await Secp256k1HdWallet.fromMnemonic(signer.mnemonic, { + prefix: PREFIX, + }); + return getSigningKyveClient(this.network.rpc, signer, aminoSigner); + } + + static async generateMnemonic(): Promise { + const signer = await DirectSecp256k1HdWallet.generate(24, { + prefix: PREFIX, + }); + + return signer.mnemonic; + } + + static formatBalance(balance: string, decimals = 2): string { + return humanize( + new BigNumber(balance) + .dividedBy(new BigNumber(10).exponentiatedBy(KYVE_DECIMALS)) + .toFixed(decimals) + ); + } + + static getAddressFromPubKey(pubKey: string) { + return pubkeyToAddress( + { type: "tendermint/PubKeySecp256k1", value: pubKey }, + PREFIX + ); + } + + static async getAddressFromMnemonic(mnemonic: string) { + const aminoSigner = await Secp256k1HdWallet.fromMnemonic(mnemonic, { + prefix: PREFIX, + }); + + const [account] = await aminoSigner.getAccounts(); + return account.address; + } + + static async verifyString( + signature: string, + data: string, + pubKey: string + ): Promise { + return verifyADR36Amino( + PREFIX, + KyveSDK.getAddressFromPubKey(pubKey), + new TextEncoder().encode(data), + fromBase64(pubKey), + fromBase64(signature) + ); + } +} diff --git a/common/sdk/src/types/global.ts b/common/sdk/src/types/global.ts new file mode 100644 index 00000000..6f242eb9 --- /dev/null +++ b/common/sdk/src/types/global.ts @@ -0,0 +1,23 @@ +import { Window as KeplrWindow } from "@keplr-wallet/types/build/window"; + +interface WindowCosmostation { + cosmostation: { + ethereum: { + request: (message: unknown) => Promise; + on: (eventName: unknown, eventHandler: (event?: unknown) => void) => void; + }; + tendermint: { + request: (message: unknown) => Promise; + on: ( + eventName: unknown, + eventHandler: (event?: unknown) => void + ) => unknown; + off: (handler: unknown) => void; + }; + }; +} + +declare global { + interface Window extends KeplrWindow, WindowCosmostation {} +} +export {}; diff --git a/common/sdk/src/utils/cosmostation-helper.ts b/common/sdk/src/utils/cosmostation-helper.ts new file mode 100644 index 00000000..899f8dbf --- /dev/null +++ b/common/sdk/src/utils/cosmostation-helper.ts @@ -0,0 +1,117 @@ +import { StdSignDoc } from "@cosmjs/amino/build/signdoc"; +import { makeSignDoc } from "@cosmjs/proto-signing"; +import { + AccountData, + OfflineDirectSigner, +} from "@cosmjs/proto-signing/build/signer"; +import { + AddChainParams, + RequestAccountResponse, + SignAminoResponse, + SignOptions, +} from "@cosmostation/extension-client/types/message"; +import { SignDoc } from "cosmjs-types/cosmos/tx/v1beta1/tx"; + +import { Network } from "../constants"; + +export const cosmostationMethods = { + getSupportedChains() { + return window.cosmostation.tendermint.request({ + method: "ten_supportedChainNames", + }); + }, + addChain(params: AddChainParams) { + return window.cosmostation.tendermint.request({ + method: "ten_addChain", + params, + }); + }, + requestAccount(chainId: string) { + return window.cosmostation.tendermint.request({ + method: "ten_requestAccount", + params: { chainName: chainId }, + }); + }, + signDirect(chainName: string, doc: unknown, options?: SignOptions) { + return window.cosmostation.tendermint.request({ + method: "ten_signDirect", + params: { + chainName, + doc, + isEditMemo: !!options?.memo, + isEditFee: !!options?.fee, + gasRate: options?.gasRate, + }, + }); + }, + signAmino(chainName: string, doc: StdSignDoc, options?: SignOptions) { + return window.cosmostation.tendermint.request({ + method: "ten_signAmino", + params: { + chainName, + doc, + isEditMemo: !!options?.memo, + isEditFee: !!options?.fee, + gasRate: options?.gasRate, + }, + }) as Promise; + }, +}; + +export class CosmostationSigner implements OfflineDirectSigner { + private network: Network; + private cosmostationAccount: RequestAccountResponse; + private cosmostationOption: SignOptions | undefined; + + constructor( + cosmostationAccount: RequestAccountResponse, + network: Network, + cosmostationOption?: SignOptions + ) { + this.network = network; + this.cosmostationAccount = cosmostationAccount; + this.cosmostationOption = cosmostationOption; + } + + async getAccounts(): Promise { + return [ + { + address: this.cosmostationAccount.address, + // Currently, only secp256k1 is supported. + algo: "secp256k1", + pubkey: this.cosmostationAccount.publicKey, + }, + ]; + } + + async signDirect(signerAddress: string, signDoc: SignDoc) { + const signedResult = await cosmostationMethods.signDirect( + this.network.chainId, + { + chain_id: signDoc.chainId, + body_bytes: signDoc.bodyBytes, + auth_info_bytes: signDoc.authInfoBytes, + account_number: signDoc.accountNumber.toString(), + }, + this.cosmostationOption + ); + const currentAccountAddress = await cosmostationMethods.requestAccount( + this.network.chainId + ); + if (this.cosmostationAccount.address !== currentAccountAddress.address) { + throw new Error("Unknown signer address"); + } + return { + signed: makeSignDoc( + signedResult.signed_doc.body_bytes, + signedResult.signed_doc.auth_info_bytes, + signedResult.signed_doc.chain_id, + Number(signedResult.signed_doc.account_number) + ), + signature: { + pub_key: signedResult.pub_key, + signature: signedResult.signature, + }, + }; + } +} diff --git a/common/sdk/src/utils/helper.ts b/common/sdk/src/utils/helper.ts new file mode 100644 index 00000000..524fec0b --- /dev/null +++ b/common/sdk/src/utils/helper.ts @@ -0,0 +1,88 @@ +import { EncodeObject } from "@cosmjs/proto-signing"; +import { cosmos } from "@keplr-wallet/cosmos"; +import TxRaw = cosmos.tx.v1beta1.TxRaw; +import { StdFee } from "@cosmjs/amino/build/signdoc"; +import { sha256 } from "@cosmjs/crypto"; +import { toHex } from "@cosmjs/encoding"; +import { coins, SigningStargateClient } from "@cosmjs/stargate"; + +type signTxResponseType = { + txRawBytes: Uint8Array; + fee: StdFee; +}; +export class TxPromise { + private nativeClient: SigningStargateClient; + private txBytes: Uint8Array; + readonly txHash: string; + readonly fee: StdFee; + constructor(nativeClient: SigningStargateClient, tx: signTxResponseType) { + this.nativeClient = nativeClient; + this.txBytes = tx.txRawBytes; + this.fee = tx.fee; + this.txHash = toHex(sha256(this.txBytes)).toUpperCase(); + } + async execute() { + return await this.nativeClient.broadcastTx(this.txBytes); + } +} +async function calcFee(gasEstimation: number, fee: "auto" | number) { + const multiplier = typeof fee === "number" ? fee : 1.5; + // calculateFee(Math.round(gasEstimation * multiplier), "5000000tkyve"); + return { + amount: coins("5000000", "tkyve"), + gas: Math.floor(gasEstimation * multiplier).toString(), + }; +} + +export async function signTx( + nativeClient: SigningStargateClient, + address: string, + tx: EncodeObject, + options?: { + fee?: StdFee | "auto" | number; + memo?: string; + } +): Promise { + if (!options || options.fee == undefined) { + const gasEstimation = await nativeClient.simulate(address, [tx], undefined); + const fee = await calcFee(gasEstimation, "auto"); + const txRaw = await nativeClient.sign( + address, + [tx], + fee, + options?.memo ? options?.memo : "" + ); + return { + txRawBytes: TxRaw.encode(txRaw).finish(), + fee, + }; + } else if (options.fee === "auto" || typeof options.fee == "number") { + const gasEstimation = await nativeClient.simulate( + address, + [tx], + options?.memo + ); + const fee = await calcFee(gasEstimation, options.fee); + const txRaw = await nativeClient.sign( + address, + [tx], + fee, + options?.memo ? options?.memo : "" + ); + return { + txRawBytes: TxRaw.encode(txRaw).finish(), + fee, + }; + } else { + const txRaw = await nativeClient.sign( + address, + [tx], + options.fee, + options?.memo ? options?.memo : "" + ); + return { + txRawBytes: TxRaw.encode(txRaw).finish(), + fee: options.fee, + }; + } +} diff --git a/common/sdk/src/utils/keplr-helper.ts b/common/sdk/src/utils/keplr-helper.ts new file mode 100644 index 00000000..b74ee2d8 --- /dev/null +++ b/common/sdk/src/utils/keplr-helper.ts @@ -0,0 +1,56 @@ +import { StdSignDoc } from "@cosmjs/amino/build/signdoc"; +import { + AccountData, + AminoSignResponse, + OfflineAminoSigner, +} from "@cosmjs/amino/build/signer"; +import { Keplr } from "@keplr-wallet/types"; + +import { Network } from "../constants"; + +export class KeplrAminoSigner implements OfflineAminoSigner { + private keplr: Keplr; + private network: Network; + constructor(keplr: Keplr, network: Network) { + this.keplr = keplr; + this.network = network; + } + public async getAccounts(): Promise { + const key = await this.keplr.getKey(this.network.chainId); + return [ + { + address: key.bech32Address, + // Currently, only secp256k1 is supported. + algo: "secp256k1", + pubkey: key.pubKey, + }, + ]; + } + public async signAmino( + signerAddress: string, + signDoc: StdSignDoc + ): Promise { + // support for https://docs.keplr.app/api/#request-signature-for-arbitrary-message + // https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-036-arbitrary-signature.md + if (signDoc.msgs[0].type === "sign/MsgSignData") { + return await this.keplr.signAmino( + this.network.chainId, + signerAddress, + signDoc + ); + } + if (this.network.chainId !== signDoc.chain_id) { + throw new Error("Unmatched chain id with the offline signer"); + } + const key = await this.keplr.getKey(this.network.chainId); + + if (key.bech32Address !== signerAddress) { + throw new Error("Unknown signer address"); + } + return await this.keplr.signAmino( + this.network.chainId, + signerAddress, + signDoc + ); + } +} diff --git a/common/sdk/test/helper.ts b/common/sdk/test/helper.ts new file mode 100644 index 00000000..7c425d67 --- /dev/null +++ b/common/sdk/test/helper.ts @@ -0,0 +1,52 @@ +// optionally pass argument to schema generator +import * as TJS from "typescript-json-schema"; +import { Definition } from "typescript-json-schema"; +import { ErrorObject } from "ajv/lib/types"; +import { JsonSchemaGenerator } from "typescript-json-schema/typescript-json-schema"; +import AJV from "ajv"; + +const settings: TJS.PartialArgs = { + required: true, + noExtraProps: true, + esModuleInterop: true, +}; + +// optionally pass ts compiler options +const compilerOptions: TJS.CompilerOptions = { + strictNullChecks: false, + additionalProperties: false, + esModuleInterop: true, +}; + +export function createValidator(pathToTypes: string[]) { + const program = TJS.getProgramFromFiles(pathToTypes, compilerOptions); + const typeQuerySchemas = TJS.buildGenerator( + program, + settings + ) as unknown as JsonSchemaGenerator; + const ajv = new AJV({ strict: true }); + if (!typeQuerySchemas) { + throw new Error("Can't find query type to generate JSON schema "); + } + + function validate( + schema: Definition, + data: any + ): { valid: boolean; errors: ErrorObject[] | null } { + const validate = ajv.compile(schema); + validate(data); + if (validate.errors) + return { + valid: false, + errors: validate.errors, + }; + return { + valid: true, + errors: null, + }; + } + return { + typeQuerySchemas, + validate, + }; +} diff --git a/common/sdk/test/integrations/lcd.test.ts b/common/sdk/test/integrations/lcd.test.ts new file mode 100644 index 00000000..e7905d79 --- /dev/null +++ b/common/sdk/test/integrations/lcd.test.ts @@ -0,0 +1,460 @@ +import KyveSDK from "../../src"; +import { JsonSchemaGenerator } from "typescript-json-schema/typescript-json-schema"; +import { KyveLCDClientType } from "../../src"; +import { createValidator } from "../helper"; +const TEST_NETWORK = "korellia"; +const PATH_TO_QUERY_TYPES = + "./node_modules/@kyvejs/types/dist/proto/kyve/registry/v1beta1/query"; +const TEST_HEIGHT = "1000000"; + +let lcdClient: KyveLCDClientType; +let typeQuerySchemas: JsonSchemaGenerator; +let validate: Function; +beforeAll(async () => { + const sdk = new KyveSDK(TEST_NETWORK); + lcdClient = await sdk.createLCDClient(); + const result = createValidator([PATH_TO_QUERY_TYPES]); + validate = result.validate; + typeQuerySchemas = result.typeQuerySchemas; +}); + +it("Query ", async () => { + const result = await lcdClient.kyve.registry.v1beta1.params(); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryParamsResponse"); + const validationResult = validate(schema, result); + expect(validationResult.valid).toBeTruthy(); +}); + +it("Query and by id", async () => { + const poolsResponse = await lcdClient.kyve.registry.v1beta1.pools(); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryPoolsResponse"); + //do not test pagination property + delete schema.properties?.pagination; + delete poolsResponse.pagination; + const vResult = validate(schema, poolsResponse); + expect(vResult.valid).toBeTruthy(); + // jest doesn't support nested generative test, needs a solution how to split into separate test cases + // maybe another test runner? + for (let pool of poolsResponse.pools) { + const poolsResponse = await lcdClient.kyve.registry.v1beta1.pool({ + id: pool.id, + }); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryPoolResponse"); + const vResult = validate(schema, poolsResponse); + expect(vResult.valid).toBeTruthy(); + } +}); + +it("Query ", async () => { + const poolsResponse = await lcdClient.kyve.registry.v1beta1.pools(); + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryFundersListResponse" + ); + for (let pool of poolsResponse.pools) { + const poolsResponse = await lcdClient.kyve.registry.v1beta1.fundersList({ + pool_id: pool.id, + }); + const vResult = validate(schema, poolsResponse); + expect(vResult.valid).toBeTruthy(); + } +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const founders = await lcdClient.kyve.registry.v1beta1.fundersList({ + pool_id: pool.pools[0].id, + }); + const founder = await lcdClient.kyve.registry.v1beta1.funder({ + pool_id: pool.pools[0].id, + funder: founders.funders[0].account, + }); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryFunderResponse"); + const vResult = validate(schema, founder); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakers = await lcdClient.kyve.registry.v1beta1.stakersList({ + pool_id: pool.pools[0].id, + status: 1, + }); + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryStakersListResponse" + ); + const vResult = validate(schema, stakers); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + const stakerResponse = await lcdClient.kyve.registry.v1beta1.staker({ + pool_id: pool.pools[0].id, + staker: stakersListResponse.stakers[0].staker, + }); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryStakerResponse"); + const vResult = validate(schema, stakerResponse); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const proposals = await lcdClient.kyve.registry.v1beta1.proposals({ + pool_id: pool.pools[0].id, + }); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryProposalsResponse"); + //do not test pagination property + delete schema.properties?.pagination; + delete proposals.pagination; + const vResult = validate(schema, proposals); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const proposals = await lcdClient.kyve.registry.v1beta1.proposals({ + pool_id: pool.pools[0].id, + }); + const proposal = await lcdClient.kyve.registry.v1beta1.proposal({ + storage_id: proposals.proposals[0].storage_id, + }); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryProposalResponse"); + const vResult = validate(schema, proposal); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const proposalByHeightResponse = + await lcdClient.kyve.registry.v1beta1.proposalByHeight({ + pool_id: pool.pools[0].id, + height: TEST_HEIGHT, + }); + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryProposalByHeightResponse" + ); + const vResult = validate(schema, proposalByHeightResponse); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + const canProposeRes = await lcdClient.kyve.registry.v1beta1.canPropose({ + pool_id: pool.pools[0].id, + proposer: stakersListResponse.stakers[0].staker, + from_height: TEST_HEIGHT, + }); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryCanProposeResponse"); + const vResult = validate(schema, canProposeRes); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + const proposals = await lcdClient.kyve.registry.v1beta1.proposals({ + pool_id: pool.pools[0].id, + }); + const canVoteRes = await lcdClient.kyve.registry.v1beta1.canVote({ + pool_id: pool.pools[0].id, + voter: stakersListResponse.stakers[0].staker, + storage_id: proposals.proposals[0].storage_id, + }); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryCanVoteResponse"); + const vResult = validate(schema, canVoteRes); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + const stakeInfoRes = await lcdClient.kyve.registry.v1beta1.stakeInfo({ + pool_id: pool.pools[0].id, + staker: stakersListResponse.stakers[0].staker, + }); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryStakeInfoResponse"); + const vResult = validate(schema, stakeInfoRes); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + const accountAssetsRes = await lcdClient.kyve.registry.v1beta1.accountAssets({ + address: stakersListResponse.stakers[0].account, + }); + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryAccountAssetsResponse" + ); + const vResult = validate(schema, accountAssetsRes); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const foundersRes = await lcdClient.kyve.registry.v1beta1.fundersList({ + pool_id: pool.pools[0].id, + }); + const accountFundedListRes = + await lcdClient.kyve.registry.v1beta1.accountFundedList({ + address: foundersRes.funders[0].account, + }); + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryAccountFundedListResponse" + ); + // do not test pagination property + delete schema.properties?.pagination; + delete accountFundedListRes.pagination; + const vResult = validate(schema, accountFundedListRes); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + const accountStakedListRes = + await lcdClient.kyve.registry.v1beta1.accountStakedList({ + address: stakersListResponse.stakers[0].account, + }); + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryAccountStakedListResponse" + ); + // do not test pagination property + delete schema.properties?.pagination; + delete accountStakedListRes.pagination; + const vResult = validate(schema, accountStakedListRes); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + const accountDelegationListRes = + await lcdClient.kyve.registry.v1beta1.accountDelegationList({ + address: stakersListResponse.stakers[0].account, + }); + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryAccountDelegationListResponse" + ); + // do not test pagination property + delete schema.properties?.pagination; + delete accountDelegationListRes.pagination; + + const vResult = validate(schema, accountDelegationListRes); + expect(vResult.valid).toBeTruthy(); +}); +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + const delegatorsRes = + await lcdClient.kyve.registry.v1beta1.delegatorsByPoolAndStaker({ + pool_id: pool.pools[0].id, + staker: stakersListResponse.stakers[0].staker, + }); + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryDelegatorsByPoolAndStakerResponse" + ); + //do not test pagination property + delete schema.properties?.pagination; + delete delegatorsRes.pagination; + const vResult = validate(schema, delegatorsRes); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + const delegatorsRes = + await lcdClient.kyve.registry.v1beta1.delegatorsByPoolAndStaker({ + pool_id: pool.pools[0].id, + staker: stakersListResponse.stakers[0].staker, + }); + const delegatorResponse = await lcdClient.kyve.registry.v1beta1.delegator({ + pool_id: pool.pools[0].id, + staker: stakersListResponse.stakers[0].staker, + delegator: delegatorsRes.delegators[0].delegator, + }); + const schema = typeQuerySchemas.getSchemaForSymbol("QueryDelegatorResponse"); + const vResult = validate(schema, delegatorResponse); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + const delegatorsRes = + await lcdClient.kyve.registry.v1beta1.delegatorsByPoolAndStaker({ + pool_id: pool.pools[0].id, + staker: stakersListResponse.stakers[0].staker, + }); + const stakersByPoolAndDelegatorRes = + await lcdClient.kyve.registry.v1beta1.stakersByPoolAndDelegator({ + pool_id: pool.pools[0].id, + delegator: delegatorsRes.delegators[0].delegator, + }); + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryStakersByPoolAndDelegatorResponse" + ); + //do not test pagination property + delete schema.properties?.pagination; + delete stakersByPoolAndDelegatorRes.pagination; + const vResult = validate(schema, stakersByPoolAndDelegatorRes); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + paused: false, + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + //todo: suppose that in a pool at least one unbonding staker, need mock data + const staker = stakersListResponse.stakers.filter( + (it) => it.unbonding_amount.length > 1 + ); + const accountStakingUnbondingResponse = + await lcdClient.kyve.registry.v1beta1.accountStakingUnbonding({ + address: staker[0].account, + }); + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryAccountStakingUnbondingsResponse" + ); + delete schema.properties?.pagination; + delete accountStakingUnbondingResponse.pagination; + const vResult = validate(schema, accountStakingUnbondingResponse); + expect(vResult.valid).toBeTruthy(); +}); + +it("Query ", async () => { + const pool = await lcdClient.kyve.registry.v1beta1.pools({ + paused: false, + pagination: { limit: "1" }, + }); + const stakersListResponse = await lcdClient.kyve.registry.v1beta1.stakersList( + { + pool_id: pool.pools[0].id, + status: 1, + } + ); + //todo: suppose that in a pool at least one unbonding staker, need mock data + const unboandingStakers = stakersListResponse.stakers.filter( + (it) => it.unbonding_amount.length > 1 + ); + const delegatorsRes = + await lcdClient.kyve.registry.v1beta1.delegatorsByPoolAndStaker({ + pool_id: pool.pools[0].id, + staker: unboandingStakers[0].staker, + }); + + const accountDelegationUnbondingRes = ( + await Promise.all( + delegatorsRes.delegators.map(async (delegator) => { + const accountStakingUnbondingResponse = + await lcdClient.kyve.registry.v1beta1.accountDelegationUnbondings({ + address: delegator.delegator, + }); + + if (accountStakingUnbondingResponse.unbondings.length) { + return accountStakingUnbondingResponse; + } + }) + ) + ).find(Boolean); + + const schema = typeQuerySchemas.getSchemaForSymbol( + "QueryAccountDelegationUnbondingsResponse" + ); + delete schema.properties?.pagination; + delete accountDelegationUnbondingRes?.pagination; + const vResult = validate(schema, accountDelegationUnbondingRes); + expect(vResult.valid).toBeTruthy(); +}); diff --git a/common/sdk/test/tsconfig.json b/common/sdk/test/tsconfig.json new file mode 100644 index 00000000..9a7a8fd2 --- /dev/null +++ b/common/sdk/test/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "esModuleInterop": true, + "outDir": "dist", + "strict": true + }, + "include": ["*"], +} diff --git a/common/sdk/test/unit/kyve-client.test.ts b/common/sdk/test/unit/kyve-client.test.ts new file mode 100644 index 00000000..3cf38125 --- /dev/null +++ b/common/sdk/test/unit/kyve-client.test.ts @@ -0,0 +1,403 @@ +import KyveClient from "../../src/clients/rpc-client/client"; +import { createValidator } from "../helper"; +import * as fs from "fs"; +import { resolve } from "path"; +// import { kyve, cosmos as cosmosProto } from "@kyvejs/types"; + +/** pool **/ +import { + MsgCancelRuntimeUpgrade, + MsgCreatePool, + MsgFundPool, + MsgPausePool, + MsgScheduleRuntimeUpgrade, + MsgUnpausePool, + MsgUpdatePool, +} from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +import { MsgDefundPool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; +/** stakers **/ +import { + MsgCreateStaker, + MsgUpdateParams as MsgUpdateParamsStakers, +} from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgUpdateMetadata } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgJoinPool } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgUpdateCommission } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +import { MsgLeavePool } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +/** delegations **/ +import { + MsgDelegate, + MsgUpdateParams as MsgUpdateParamsDelegation, +} from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgWithdrawRewards } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgRedelegate } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgUndelegate } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +/** bundles **/ +import { + MsgSubmitBundleProposal, + MsgUpdateParams as MsgUpdateParamsBundles, +} from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgVoteBundleProposal } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgClaimUploaderRole } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; +import { MsgSkipUploaderRole } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx"; + +/** gov **/ +import Mock = jest.Mock; +import { DENOM, GOV_AUTHORITY } from "../../src/constants"; + +import { SigningStargateClient } from "@cosmjs/stargate"; +import { cosmos } from "@keplr-wallet/cosmos"; +import TxRaw = cosmos.tx.v1beta1.TxRaw; +import { OfflineAminoSigner } from "@cosmjs/amino/build/signer"; +import { MsgUpdateParams as MsgUpdateParamsFees } from "@kyvejs/types/client/kyve/fees/v1beta1/tx"; + +function extractTsFromPath(path: string) { + return fs + .readdirSync(path) + .filter((files) => files.endsWith("d.ts")) + .map((dtsFiles) => resolve(path, dtsFiles)); +} + +const mockAccountData = { + address: "kyve19jc64sd773gtjljksjhls0n5mqay7xj83yeqvk", + algo: "secp256k1" as const, + pubkey: new Uint8Array(), +}; + +const TEST_MEMO = "test_memo"; +const TEST_FEE = 1; +const TEST_AMOUNT = "1000000000"; + +const methodsByGroup = [ + [ + { + name: "bundles", + pathToTypes: extractTsFromPath("../proto/client/kyve/bundles/v1beta1"), + }, + [ + { + methodName: "submitBundleProposal", + parameters: { + params: MsgSubmitBundleProposal.fromJSON({}), + schemaType: "MsgSubmitBundleProposal", + }, + }, + { + methodName: "voteBundleProposal", + parameters: { + params: MsgVoteBundleProposal.fromJSON({}), + schemaType: "MsgVoteBundleProposal", + }, + }, + { + methodName: "claimUploaderRole", + parameters: { + params: MsgClaimUploaderRole.fromJSON({}), + schemaType: "MsgClaimUploaderRole", + }, + }, + { + methodName: "skipUploaderRole", + parameters: { + params: MsgSkipUploaderRole.fromJSON({}), + schemaType: "MsgSkipUploaderRole", + }, + }, + ], + ], + [ + { + name: "delegation", + pathToTypes: extractTsFromPath("../proto/client/kyve/delegation/v1beta1"), + }, + [ + { + methodName: "delegate", + parameters: { + params: MsgDelegate.fromJSON({}), + schemaType: "MsgDelegate", + }, + }, + { + methodName: "withdrawRewards", + parameters: { + params: MsgWithdrawRewards.fromJSON({}), + schemaType: "MsgWithdrawRewards", + }, + }, + { + methodName: "undelegate", + parameters: { + params: MsgUndelegate.fromJSON({}), + schemaType: "MsgUndelegate", + }, + }, + { + methodName: "redelegate", + parameters: { + params: MsgRedelegate.fromJSON({}), + schemaType: "MsgRedelegate", + }, + }, + ], + ], + [ + { + name: "pool", + pathToTypes: extractTsFromPath("../proto/client/kyve//pool/v1beta1"), + }, + [ + { + methodName: "fundPool", + parameters: { + params: MsgFundPool.fromJSON({}), + schemaType: "MsgFundPool", + }, + }, + { + methodName: "defundPool", + parameters: { + params: MsgDefundPool.fromJSON({}), + schemaType: "MsgDefundPool", + }, + }, + ], + ], + [ + { + name: "stakers", + pathToTypes: extractTsFromPath("../proto/client/kyve/stakers/v1beta1"), + }, + [ + { + methodName: "createStaker", + parameters: { + params: MsgCreateStaker.fromJSON({}), + schemaType: "MsgCreateStaker", + }, + }, + { + methodName: "updateMetadata", + parameters: { + params: MsgUpdateMetadata.fromJSON({}), + schemaType: "MsgUpdateMetadata", + }, + }, + { + methodName: "updateCommission", + parameters: { + params: MsgUpdateCommission.fromJSON({}), + schemaType: "MsgUpdateCommission", + }, + }, + { + methodName: "joinPool", + parameters: { + params: MsgJoinPool.fromJSON({}), + schemaType: "MsgJoinPool", + }, + }, + { + methodName: "leavePool", + parameters: { + params: MsgLeavePool.fromJSON({}), + schemaType: "MsgLeavePool", + }, + }, + ], + ], +] as const; + +let kyveClient: KyveClient; +let mockSign: Mock; +let mockSendTokens: Mock; +let mockGetBalance: Mock; + +beforeEach(() => { + mockSign = jest.fn(() => TxRaw.create()); + mockSendTokens = jest.fn(); + mockGetBalance = jest.fn(() => ({ amount: 0 })); + const mockNativeClient = { + simulate: () => Promise.resolve(1), + sign: mockSign, + sendTokens: mockSendTokens, + getBalance: mockGetBalance, + } as unknown as SigningStargateClient; + const mockAminoSigner = { + signAmino() {}, + getAccounts() {}, + } as unknown as OfflineAminoSigner; + kyveClient = new KyveClient( + mockNativeClient, + mockAccountData, + mockAminoSigner + ); +}); +for (let [bundleConfig, methods] of methodsByGroup) { + describe(`Methods ${bundleConfig.name}`, () => { + const validator = createValidator(bundleConfig.pathToTypes); + methods.forEach((method) => { + it(`method ${method.methodName}`, async () => { + // @ts-ignore + await kyveClient.kyve[bundleConfig.name].v1beta1[method.methodName]( + //@ts-ignore have no idea how to create it generic. btw ts-ignore is ok, because we check params from json schema + method.parameters.params, + { memo: TEST_MEMO, fee: TEST_FEE } + ); + + expect(mockSign).toHaveBeenCalledTimes(1); + + const [[testAddress, [tx], fee, memo]] = mockSign.mock.calls; + expect(testAddress).toEqual(mockAccountData.address); + + expect(tx).toEqual( + expect.objectContaining({ + typeUrl: expect.any(String), + value: expect.any(Object), + }) + ); + expect(memo).toEqual(TEST_MEMO); + const validationResult = validator.validate( + validator.typeQuerySchemas.getSchemaForSymbol( + method.parameters.schemaType + ), + tx.value + ); + expect(validationResult.valid).toBeTruthy(); + expect(Object.keys(fee).sort()).toEqual(["amount", "gas"].sort()); + }); + }); + }); +} + +describe("Base methods", () => { + it("transfer", async () => { + const testRecipient = "kyveTestRecipient"; + const testAmount = "10000000000"; + await kyveClient.kyve.base.v1beta1.transfer(testRecipient, testAmount, { + memo: TEST_MEMO, + fee: TEST_FEE, + }); + expect(mockSign).toHaveBeenCalledTimes(1); + + const [[_, [tx], fee, memo]] = mockSign.mock.calls; + expect(tx.value.fromAddress).toEqual(mockAccountData.address); + expect(tx.value.toAddress).toEqual(testRecipient); + expect(memo).toEqual(TEST_MEMO); + expect(fee.gas.toString()).toEqual(TEST_FEE.toString()); + expect(tx.value.amount[0]).toEqual({ + denom: DENOM, + amount: testAmount, + }); + }); + + it("getKyveBalance", async () => { + const result = await kyveClient.kyve.base.v1beta1.getKyveBalance(); + expect(mockGetBalance).toHaveBeenCalledTimes(1); + const [[ownerAddress, denom]] = mockGetBalance.mock.calls; + expect(ownerAddress).toEqual(mockAccountData.address); + expect(denom).toEqual(DENOM); + expect(result).toEqual(0); + }); +}); +const GovMethods = [ + { + method: "createPool", + decoder: MsgCreatePool, + }, + { + method: "updatePool", + decoder: MsgUpdatePool, + }, + { + method: "pausePool", + decoder: MsgPausePool, + }, + { + method: "unpausePool", + decoder: MsgUnpausePool, + }, + { + method: "scheduleRuntimeUpgrade", + decoder: MsgScheduleRuntimeUpgrade, + }, + { + method: "cancelRuntimeUpgrade", + decoder: MsgCancelRuntimeUpgrade, + }, + { + method: "updateParamsStakers", + decoder: MsgUpdateParamsStakers, + }, + { + method: "updateParamsDelegation", + decoder: MsgUpdateParamsDelegation, + }, + { + method: "updateParamsBundles", + decoder: MsgUpdateParamsBundles, + }, + { + method: "updateParamsFees", + decoder: MsgUpdateParamsFees, + }, +] as const; + +describe("Gov methods", () => { + GovMethods.forEach((method) => { + it(`${method.method}`, async () => { + const govParam = method.decoder.fromJSON({ authority: GOV_AUTHORITY }); + //@ts-ignore + await kyveClient.kyve.gov.v1[method.method](govParam, TEST_AMOUNT, { + isExpedited: true, + }); + expect(mockSign).toHaveBeenCalledTimes(1); + const [[testAddress, [tx], fee]] = mockSign.mock.calls; + expect(testAddress).toEqual(mockAccountData.address); + expect(tx).toEqual( + expect.objectContaining({ + typeUrl: expect.any(String), + value: { + messages: [ + { + type_url: expect.any(String), + value: expect.any(Uint8Array), + }, + ], + initial_deposit: [ + { + denom: DENOM, + amount: TEST_AMOUNT, + }, + ], + proposer: mockAccountData.address, + metadata: { isExpedited: true }, + }, + }) + ); + + expect(Object.keys(fee).sort()).toEqual(["amount", "gas"].sort()); + expect(method.decoder.decode(tx.value.messages[0].value)).toEqual( + govParam + ); + }); + }); + + it("`govVote`", async () => { + const testProposalNumber = "1"; + const testVoteOptions = "Yes"; + await kyveClient.kyve.gov.v1.vote(testProposalNumber, testVoteOptions); + expect(mockSign).toHaveBeenCalledTimes(1); + const [[testAddress, [tx], fee]] = mockSign.mock.calls; + expect(testAddress).toEqual(mockAccountData.address); + expect(Object.keys(fee).sort()).toEqual(["amount", "gas"].sort()); + expect(tx).toEqual({ + typeUrl: "/cosmos.gov.v1.MsgVote", + value: { + proposal_id: testProposalNumber, + voter: mockAccountData.address, + option: 1, + }, + }); + }); +}); diff --git a/common/sdk/test/unit/sign-string.test.ts b/common/sdk/test/unit/sign-string.test.ts new file mode 100644 index 00000000..e13d7e3e --- /dev/null +++ b/common/sdk/test/unit/sign-string.test.ts @@ -0,0 +1,165 @@ +import KyveClient from "../../src/clients/rpc-client/client"; +import { SigningStargateClient } from "@cosmjs/stargate"; +import { OfflineAminoSigner } from "@cosmjs/amino/build/signer"; +import Mock = jest.Mock; +import { cosmos } from "@keplr-wallet/cosmos"; +import TxRaw = cosmos.tx.v1beta1.TxRaw; +import { Secp256k1HdWallet, Secp256k1Wallet } from "@cosmjs/amino"; +import { PREFIX } from "../../src/constants"; +import KyveSDK from "../../src"; +import { fromHex } from "@cosmjs/encoding"; +import { KeplrAminoSigner } from "../../src/utils/keplr-helper"; +import { Keplr } from "@keplr-wallet/types"; +import { Network } from "../../src/constants"; +const TEST_PRIVATE_KEY = + "3fff4f4365485545348c2fb5dd85775058b16b7c5117d9f2c8824d9e9e28dcef"; +const TEST_MNEMONIC = + "slogan taxi lonely path hazard laundry cruise luggage exile upgrade figure toward"; +const TEST_STRING = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; + +describe("sign string", () => { + let kyvePrivateKeySignerClient: KyveClient; + let kyveMnemonicSignerClient: KyveClient; + let kyveKeplrSignerClient: KyveClient; + let mockSign: Mock; + let mockSendTokens: Mock; + let mockGetBalance: Mock; + let mockKeplrAminoSign: Mock; + beforeEach(async () => { + mockSign = jest.fn(() => TxRaw.create()); + mockSendTokens = jest.fn(); + mockGetBalance = jest.fn(() => ({ amount: 0 })); + const mockNativeClient = { + simulate: () => Promise.resolve(1), + sign: mockSign, + sendTokens: mockSendTokens, + getBalance: mockGetBalance, + } as unknown as SigningStargateClient; + /** INIT clients with different amino signers **/ + const aminoPrivateKeySigner = await Secp256k1Wallet.fromKey( + fromHex(TEST_PRIVATE_KEY), + PREFIX + ); + const [accountKey] = await aminoPrivateKeySigner.getAccounts(); + kyvePrivateKeySignerClient = new KyveClient( + mockNativeClient, + accountKey, + aminoPrivateKeySigner + ); + const aminoMnemonicSigner = await Secp256k1HdWallet.fromMnemonic( + TEST_MNEMONIC, + { + prefix: PREFIX, + } + ); + const [accMnemonic] = await aminoMnemonicSigner.getAccounts(); + kyveMnemonicSignerClient = new KyveClient( + mockNativeClient, + accMnemonic, + aminoMnemonicSigner + ); + mockKeplrAminoSign = jest.fn((...args) => + aminoMnemonicSigner.signAmino.apply(aminoMnemonicSigner, [ + args[1], + args[2], + ]) + ); + const mockKeplr = { + signAmino: mockKeplrAminoSign, + getKey() { + return { + bech32Address: accMnemonic.address, + pubkey: accMnemonic.pubkey, + }; + }, + } as unknown as Keplr; + const aminoKeplrSigner = new KeplrAminoSigner(mockKeplr, { + chainId: "test-chain", + } as unknown as Network); + kyveKeplrSignerClient = new KyveClient( + mockNativeClient, + accMnemonic, + aminoKeplrSigner + ); + }); + describe("from private key", () => { + test("should verify same string as truthy", async () => { + const sign = await kyvePrivateKeySignerClient.signString(TEST_STRING); + const result = await KyveSDK.verifyString( + sign.signature, + TEST_STRING, + sign.pub_key.value + ); + expect(result).toEqual(true); + }); + test("should verify opposite string as falsy", async () => { + const sign = await kyvePrivateKeySignerClient.signString( + TEST_STRING + Date.now() + ); + const result = await KyveSDK.verifyString( + sign.signature, + TEST_STRING, + sign.pub_key.value + ); + expect(result).toEqual(false); + }); + }); + + describe("from mnemonic", () => { + test("should verify same string as truthy", async () => { + const sign = await kyveMnemonicSignerClient.signString(TEST_STRING); + const result = await KyveSDK.verifyString( + sign.signature, + TEST_STRING, + sign.pub_key.value + ); + expect(result).toEqual(true); + }); + test("should verify opposite string as falsy", async () => { + const sign = await kyveMnemonicSignerClient.signString( + TEST_STRING + Date.now() + ); + + const result = await KyveSDK.verifyString( + sign.signature, + TEST_STRING, + sign.pub_key.value + ); + expect(result).toEqual(false); + }); + }); + describe("from keplr", () => { + function verifyADR36Behavior() { + //https://docs.keplr.app/api/#request-signature-for-arbitrary-message + expect(mockKeplrAminoSign).toHaveBeenCalledTimes(1); + const [[_1, _2, signDoc]] = mockKeplrAminoSign.mock.calls; + expect(signDoc.chain_id).toEqual(""); + expect(signDoc.account_number).toEqual("0"); + expect(signDoc.fee).toEqual({ gas: "0", amount: [] }); + expect(signDoc.msgs[0].type).toEqual("sign/MsgSignData"); + expect(signDoc.memo).toEqual(""); + } + test("should verify same string as truthy", async () => { + const sign = await kyveKeplrSignerClient.signString(TEST_STRING); + verifyADR36Behavior(); + const result = KyveSDK.verifyString( + sign.signature, + TEST_STRING, + sign.pub_key.value + ); + expect(result).toBeTruthy(); + }); + test("should verify opposite string as falsy", async () => { + const sign = await kyveKeplrSignerClient.signString( + TEST_STRING + Date.now() + ); + const result = await KyveSDK.verifyString( + sign.signature, + TEST_STRING, + sign.pub_key.value + ); + verifyADR36Behavior(); + expect(result).toEqual(false); + }); + }); +}); diff --git a/common/sdk/tsconfig.json b/common/sdk/tsconfig.json new file mode 100644 index 00000000..6e3996cd --- /dev/null +++ b/common/sdk/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "esModuleInterop": true, + "outDir": "dist", + "strict": true + }, + "include": ["src/types/"], + "files": ["src/index.ts"] +} diff --git a/common/sdk/typedoc.json b/common/sdk/typedoc.json new file mode 100644 index 00000000..1d5a4fc7 --- /dev/null +++ b/common/sdk/typedoc.json @@ -0,0 +1,11 @@ +{ + "entryPoints": ["./src/index.ts"], + "includes": ["./src"], + "out": "docs", + "excludeExternals": false, + "theme": "default", + "name": "@kyvejs/sdk", + "excludePrivate": true, + "excludeProtected": true, + "hideGenerator": true +} diff --git a/common/types/.gitignore b/common/types/.gitignore new file mode 100644 index 00000000..6196a904 --- /dev/null +++ b/common/types/.gitignore @@ -0,0 +1,666 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,macos,windows,node,webstorm+all + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +# dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache +.stylelintcache + +# SvelteKit build / generate output +.svelte-kit + +### WebStorm+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### WebStorm+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Nuget personal access tokens and Credentials +# nuget.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs + +# JetBrains Rider +*.sln.iml +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all \ No newline at end of file diff --git a/common/types/LICENSE b/common/types/LICENSE new file mode 100644 index 00000000..21e34717 --- /dev/null +++ b/common/types/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2022 BCP Innovations UG (haftungsbeschränkt) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/common/types/README.md b/common/types/README.md new file mode 100644 index 00000000..2eb1aa28 --- /dev/null +++ b/common/types/README.md @@ -0,0 +1,5 @@ +
+

@kyvejs/types

+
+ +![banner](https://arweave.net/Gs2PvyzkWt9d2CfwTYtwDGGqv-HhV-qXjTURTCW0LuU) diff --git a/common/types/package.json b/common/types/package.json new file mode 100644 index 00000000..86a9abd1 --- /dev/null +++ b/common/types/package.json @@ -0,0 +1,35 @@ +{ + "name": "@kyvejs/types", + "version": "1.0.0-beta.0", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "repository": { + "type": "git", + "url": "git+https://github.com/KYVENetwork/kyvejs.git" + }, + "author": "ruslan glaznyov , Troy Kessler , John Letey ", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "rimraf ./dist && tsc && yarn prepare-publishing", + "prepare-publishing": "./scripts/prepare-publishing.sh", + "generate": "sh scripts/proto-gen.sh" + }, + "files": [ + "lcd/", + "client/" + ], + "dependencies": { + "@protobufs/cosmos": "^0.0.11", + "@protobufs/gogoproto": "^0.0.10", + "@protobufs/google": "^0.0.10", + "nx": "^14.4.3", + "ts-proto": "^1.115.4" + }, + "devDependencies": { + "rimraf": "^3.0.2", + "typescript": "^4.7.3" + } +} diff --git a/common/types/scripts/prepare-publishing.sh b/common/types/scripts/prepare-publishing.sh new file mode 100755 index 00000000..fc246394 --- /dev/null +++ b/common/types/scripts/prepare-publishing.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -o errexit -o nounset -o pipefail +command -v shellcheck >/dev/null && shellcheck "$0" + +DIRS="client lcd" + +for dir in $DIRS; do + rm -rf "$dir" + cp -R "./dist/$dir" ./ +done diff --git a/common/types/scripts/proto-gen.sh b/common/types/scripts/proto-gen.sh new file mode 100755 index 00000000..3783c21c --- /dev/null +++ b/common/types/scripts/proto-gen.sh @@ -0,0 +1,35 @@ +#!/bin/bash +rm -rf temp +mkdir temp +KYVE_CHAIN_REPO="git@github.com:KYVENetwork/chain-beta.git" +BRANCH_KYVE="development" +git -C ./temp clone -b ${BRANCH_KYVE} --single-branch ${KYVE_CHAIN_REPO} +rm -rf ./src/client +rm -rf ./src/lcd +mkdir ./src/client +mkdir ./src/lcd +# generate TypeScript proto +PROTO_DIR="../../node_modules/@protobufs" +PROTOC_GEN_TS_PROTO_PATH="./node_modules/.bin/protoc-gen-ts_proto" +OUT_DIR="./src/client" +KYVE_PROTO='./temp/chain-beta/proto' +protoc --plugin="protoc-gen-ts_proto=${PROTOC_GEN_TS_PROTO_PATH}" \ +--ts_proto_out="${OUT_DIR}" \ +--ts_proto_opt="esModuleInterop=true,forceLong=string,useOptionals=messages,snakeToCamel=false" \ +--proto_path="$PROTO_DIR" \ +--proto_path="$KYVE_PROTO" \ +$(find ${PROTO_DIR} -path -prune -o -name '*.proto' -print0 | xargs -0) \ +$(find ${KYVE_PROTO} -path -prune -o -name '*.proto' -print0 | xargs -0) + +OUT_DIR_RES="./src/lcd" + +protoc --plugin="protoc-gen-ts_proto=${PROTOC_GEN_TS_PROTO_PATH}" \ +--ts_proto_out="${OUT_DIR_RES}" \ +--ts_proto_opt="esModuleInterop=true,forceLong=string,useOptionals=messages,snakeToCamel=false,stringEnums=true" \ +--proto_path="$PROTO_DIR" \ +--proto_path="$KYVE_PROTO" \ +$(find ${PROTO_DIR} -path -prune -o -name '*.proto' -print0 | xargs -0) \ +$(find ${KYVE_PROTO} -path -prune -o -name '*.proto' -print0 | xargs -0) +rm -rf temp +git add ./src/client +git add ./src/lcd \ No newline at end of file diff --git a/common/types/src/client/cosmos/app/v1alpha1/config.ts b/common/types/src/client/cosmos/app/v1alpha1/config.ts new file mode 100644 index 00000000..2a4ecfb5 --- /dev/null +++ b/common/types/src/client/cosmos/app/v1alpha1/config.ts @@ -0,0 +1,167 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.app.v1alpha1"; + +/** + * Config represents the configuration for a Cosmos SDK ABCI app. + * It is intended that all state machine logic including the version of + * baseapp and tx handlers (and possibly even Tendermint) that an app needs + * can be described in a config object. For compatibility, the framework should + * allow a mixture of declarative and imperative app wiring, however, apps + * that strive for the maximum ease of maintainability should be able to describe + * their state machine with a config object alone. + */ +export interface Config { + /** modules are the module configurations for the app. */ + modules: ModuleConfig[]; +} + +/** ModuleConfig is a module configuration for an app. */ +export interface ModuleConfig { + /** + * name is the unique name of the module within the app. It should be a name + * that persists between different versions of a module so that modules + * can be smoothly upgraded to new versions. + * + * For example, for the module cosmos.bank.module.v1.Module, we may chose + * to simply name the module "bank" in the app. When we upgrade to + * cosmos.bank.module.v2.Module, the app-specific name "bank" stays the same + * and the framework knows that the v2 module should receive all the same state + * that the v1 module had. Note: modules should provide info on which versions + * they can migrate from in the ModuleDescriptor.can_migration_from field. + */ + name: string; + /** + * config is the config object for the module. Module config messages should + * define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension. + */ + config?: Any; +} + +function createBaseConfig(): Config { + return { modules: [] }; +} + +export const Config = { + encode(message: Config, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.modules) { + ModuleConfig.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Config { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.modules.push(ModuleConfig.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Config { + return { modules: Array.isArray(object?.modules) ? object.modules.map((e: any) => ModuleConfig.fromJSON(e)) : [] }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.modules) { + obj.modules = message.modules.map((e) => e ? ModuleConfig.toJSON(e) : undefined); + } else { + obj.modules = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.modules = object.modules?.map((e) => ModuleConfig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseModuleConfig(): ModuleConfig { + return { name: "", config: undefined }; +} + +export const ModuleConfig = { + encode(message: ModuleConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.config !== undefined) { + Any.encode(message.config, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleConfig { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.config = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleConfig { + return { + name: isSet(object.name) ? String(object.name) : "", + config: isSet(object.config) ? Any.fromJSON(object.config) : undefined, + }; + }, + + toJSON(message: ModuleConfig): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.config !== undefined && (obj.config = message.config ? Any.toJSON(message.config) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): ModuleConfig { + const message = createBaseModuleConfig(); + message.name = object.name ?? ""; + message.config = (object.config !== undefined && object.config !== null) + ? Any.fromPartial(object.config) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/app/v1alpha1/module.ts b/common/types/src/client/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..eaebc57e --- /dev/null +++ b/common/types/src/client/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,288 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.app.v1alpha1"; + +/** ModuleDescriptor describes an app module. */ +export interface ModuleDescriptor { + /** + * go_import names the package that should be imported by an app to load the + * module in the runtime module registry. Either go_import must be defined here + * or the go_package option must be defined at the file level to indicate + * to users where to location the module implementation. go_import takes + * precedence over go_package when both are defined. + */ + go_import: string; + /** + * use_package refers to a protobuf package that this module + * uses and exposes to the world. In an app, only one module should "use" + * or own a single protobuf package. It is assumed that the module uses + * all of the .proto files in a single package. + */ + use_package: PackageReference[]; + /** + * can_migrate_from defines which module versions this module can migrate + * state from. The framework will check that one module version is able to + * migrate from a previous module version before attempting to update its + * config. It is assumed that modules can transitively migrate from earlier + * versions. For instance if v3 declares it can migrate from v2, and v2 + * declares it can migrate from v1, the framework knows how to migrate + * from v1 to v3, assuming all 3 module versions are registered at runtime. + */ + can_migrate_from: MigrateFromInfo[]; +} + +/** PackageReference is a reference to a protobuf package used by a module. */ +export interface PackageReference { + /** name is the fully-qualified name of the package. */ + name: string; + /** + * revision is the optional revision of the package that is being used. + * Protobuf packages used in Cosmos should generally have a major version + * as the last part of the package name, ex. foo.bar.baz.v1. + * The revision of a package can be thought of as the minor version of a + * package which has additional backwards compatible definitions that weren't + * present in a previous version. + * + * A package should indicate its revision with a source code comment + * above the package declaration in one of its fields containing the + * test "Revision N" where N is an integer revision. All packages start + * at revision 0 the first time they are released in a module. + * + * When a new version of a module is released and items are added to existing + * .proto files, these definitions should contain comments of the form + * "Since Revision N" where N is an integer revision. + * + * When the module runtime starts up, it will check the pinned proto + * image and panic if there are runtime protobuf definitions that are not + * in the pinned descriptor which do not have + * a "Since Revision N" comment or have a "Since Revision N" comment where + * N is <= to the revision specified here. This indicates that the protobuf + * files have been updated, but the pinned file descriptor hasn't. + * + * If there are items in the pinned file descriptor with a revision + * greater than the value indicated here, this will also cause a panic + * as it may mean that the pinned descriptor for a legacy module has been + * improperly updated or that there is some other versioning discrepancy. + * Runtime protobuf definitions will also be checked for compatibility + * with pinned file descriptors to make sure there are no incompatible changes. + * + * This behavior ensures that: + * * pinned proto images are up-to-date + * * protobuf files are carefully annotated with revision comments which + * are important good client UX + * * protobuf files are changed in backwards and forwards compatible ways + */ + revision: number; +} + +/** + * MigrateFromInfo is information on a module version that a newer module + * can migrate from. + */ +export interface MigrateFromInfo { + /** + * module is the fully-qualified protobuf name of the module config object + * for the previous module version, ex: "cosmos.group.module.v1.Module". + */ + module: string; +} + +function createBaseModuleDescriptor(): ModuleDescriptor { + return { go_import: "", use_package: [], can_migrate_from: [] }; +} + +export const ModuleDescriptor = { + encode(message: ModuleDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.go_import !== "") { + writer.uint32(10).string(message.go_import); + } + for (const v of message.use_package) { + PackageReference.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.can_migrate_from) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.go_import = reader.string(); + break; + case 2: + message.use_package.push(PackageReference.decode(reader, reader.uint32())); + break; + case 3: + message.can_migrate_from.push(MigrateFromInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + go_import: isSet(object.go_import) ? String(object.go_import) : "", + use_package: Array.isArray(object?.use_package) + ? object.use_package.map((e: any) => PackageReference.fromJSON(e)) + : [], + can_migrate_from: Array.isArray(object?.can_migrate_from) + ? object.can_migrate_from.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + message.go_import !== undefined && (obj.go_import = message.go_import); + if (message.use_package) { + obj.use_package = message.use_package.map((e) => e ? PackageReference.toJSON(e) : undefined); + } else { + obj.use_package = []; + } + if (message.can_migrate_from) { + obj.can_migrate_from = message.can_migrate_from.map((e) => e ? MigrateFromInfo.toJSON(e) : undefined); + } else { + obj.can_migrate_from = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.go_import = object.go_import ?? ""; + message.use_package = object.use_package?.map((e) => PackageReference.fromPartial(e)) || []; + message.can_migrate_from = object.can_migrate_from?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference = { + encode(message: PackageReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePackageReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.revision = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? String(object.name) : "", + revision: isSet(object.revision) ? Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.revision !== undefined && (obj.revision = Math.round(message.revision)); + return obj; + }, + + fromPartial, I>>(object: I): PackageReference { + const message = createBasePackageReference(); + message.name = object.name ?? ""; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseMigrateFromInfo(): MigrateFromInfo { + return { module: "" }; +} + +export const MigrateFromInfo = { + encode(message: MigrateFromInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMigrateFromInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.module = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + message.module !== undefined && (obj.module = message.module); + return obj; + }, + + fromPartial, I>>(object: I): MigrateFromInfo { + const message = createBaseMigrateFromInfo(); + message.module = object.module ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/app/v1alpha1/query.ts b/common/types/src/client/cosmos/app/v1alpha1/query.ts new file mode 100644 index 00000000..bffe40f9 --- /dev/null +++ b/common/types/src/client/cosmos/app/v1alpha1/query.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Config } from "./config"; + +export const protobufPackage = "cosmos.app.v1alpha1"; + +/** QueryConfigRequest is the Query/Config request type. */ +export interface QueryConfigRequest { +} + +/** QueryConfigRequest is the Query/Config response type. */ +export interface QueryConfigResponse { + /** config is the current app config. */ + config?: Config; +} + +function createBaseQueryConfigRequest(): QueryConfigRequest { + return {}; +} + +export const QueryConfigRequest = { + encode(_: QueryConfigRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryConfigRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryConfigRequest { + return {}; + }, + + toJSON(_: QueryConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryConfigRequest { + const message = createBaseQueryConfigRequest(); + return message; + }, +}; + +function createBaseQueryConfigResponse(): QueryConfigResponse { + return { config: undefined }; +} + +export const QueryConfigResponse = { + encode(message: QueryConfigResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.config !== undefined) { + Config.encode(message.config, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryConfigResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.config = Config.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryConfigResponse { + return { config: isSet(object.config) ? Config.fromJSON(object.config) : undefined }; + }, + + toJSON(message: QueryConfigResponse): unknown { + const obj: any = {}; + message.config !== undefined && (obj.config = message.config ? Config.toJSON(message.config) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryConfigResponse { + const message = createBaseQueryConfigResponse(); + message.config = (object.config !== undefined && object.config !== null) + ? Config.fromPartial(object.config) + : undefined; + return message; + }, +}; + +/** Query is the app module query service. */ +export interface Query { + /** Config returns the current app config. */ + Config(request: QueryConfigRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.app.v1alpha1.Query"; + this.rpc = rpc; + this.Config = this.Config.bind(this); + } + Config(request: QueryConfigRequest): Promise { + const data = QueryConfigRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Config", data); + return promise.then((data) => QueryConfigResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/auth/v1beta1/auth.ts b/common/types/src/client/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 00000000..7f0c9d19 --- /dev/null +++ b/common/types/src/client/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,304 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** + * 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; + pub_key?: Any; + account_number: string; + sequence: string; +} + +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccount { + base_account?: BaseAccount; + name: string; + permissions: string[]; +} + +/** Params defines the parameters for the auth module. */ +export interface Params { + max_memo_characters: string; + tx_sig_limit: string; + tx_size_cost_per_byte: string; + sig_verify_cost_ed25519: string; + sig_verify_cost_secp256k1: string; +} + +function createBaseBaseAccount(): BaseAccount { + return { address: "", pub_key: undefined, account_number: "0", sequence: "0" }; +} + +export const BaseAccount = { + encode(message: BaseAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pub_key !== undefined) { + Any.encode(message.pub_key, writer.uint32(18).fork()).ldelim(); + } + if (message.account_number !== "0") { + writer.uint32(24).uint64(message.account_number); + } + if (message.sequence !== "0") { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.pub_key = Any.decode(reader, reader.uint32()); + break; + case 3: + message.account_number = longToString(reader.uint64() as Long); + break; + case 4: + message.sequence = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BaseAccount { + return { + address: isSet(object.address) ? String(object.address) : "", + pub_key: isSet(object.pub_key) ? Any.fromJSON(object.pub_key) : undefined, + account_number: isSet(object.account_number) ? String(object.account_number) : "0", + sequence: isSet(object.sequence) ? String(object.sequence) : "0", + }; + }, + + toJSON(message: BaseAccount): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? Any.toJSON(message.pub_key) : undefined); + message.account_number !== undefined && (obj.account_number = message.account_number); + message.sequence !== undefined && (obj.sequence = message.sequence); + return obj; + }, + + fromPartial, I>>(object: I): BaseAccount { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? Any.fromPartial(object.pub_key) + : undefined; + message.account_number = object.account_number ?? "0"; + message.sequence = object.sequence ?? "0"; + return message; + }, +}; + +function createBaseModuleAccount(): ModuleAccount { + return { base_account: undefined, name: "", permissions: [] }; +} + +export const ModuleAccount = { + encode(message: ModuleAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_account !== undefined) { + BaseAccount.encode(message.base_account, 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: _m0.Reader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_account = 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; + }, + + fromJSON(object: any): ModuleAccount { + return { + base_account: isSet(object.base_account) ? BaseAccount.fromJSON(object.base_account) : undefined, + name: isSet(object.name) ? String(object.name) : "", + permissions: Array.isArray(object?.permissions) ? object.permissions.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: ModuleAccount): unknown { + const obj: any = {}; + message.base_account !== undefined && + (obj.base_account = message.base_account ? BaseAccount.toJSON(message.base_account) : undefined); + message.name !== undefined && (obj.name = message.name); + if (message.permissions) { + obj.permissions = message.permissions.map((e) => e); + } else { + obj.permissions = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ModuleAccount { + const message = createBaseModuleAccount(); + message.base_account = (object.base_account !== undefined && object.base_account !== null) + ? BaseAccount.fromPartial(object.base_account) + : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + max_memo_characters: "0", + tx_sig_limit: "0", + tx_size_cost_per_byte: "0", + sig_verify_cost_ed25519: "0", + sig_verify_cost_secp256k1: "0", + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.max_memo_characters !== "0") { + writer.uint32(8).uint64(message.max_memo_characters); + } + if (message.tx_sig_limit !== "0") { + writer.uint32(16).uint64(message.tx_sig_limit); + } + if (message.tx_size_cost_per_byte !== "0") { + writer.uint32(24).uint64(message.tx_size_cost_per_byte); + } + if (message.sig_verify_cost_ed25519 !== "0") { + writer.uint32(32).uint64(message.sig_verify_cost_ed25519); + } + if (message.sig_verify_cost_secp256k1 !== "0") { + writer.uint32(40).uint64(message.sig_verify_cost_secp256k1); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.max_memo_characters = longToString(reader.uint64() as Long); + break; + case 2: + message.tx_sig_limit = longToString(reader.uint64() as Long); + break; + case 3: + message.tx_size_cost_per_byte = longToString(reader.uint64() as Long); + break; + case 4: + message.sig_verify_cost_ed25519 = longToString(reader.uint64() as Long); + break; + case 5: + message.sig_verify_cost_secp256k1 = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + max_memo_characters: isSet(object.max_memo_characters) ? String(object.max_memo_characters) : "0", + tx_sig_limit: isSet(object.tx_sig_limit) ? String(object.tx_sig_limit) : "0", + tx_size_cost_per_byte: isSet(object.tx_size_cost_per_byte) ? String(object.tx_size_cost_per_byte) : "0", + sig_verify_cost_ed25519: isSet(object.sig_verify_cost_ed25519) ? String(object.sig_verify_cost_ed25519) : "0", + sig_verify_cost_secp256k1: isSet(object.sig_verify_cost_secp256k1) + ? String(object.sig_verify_cost_secp256k1) + : "0", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.max_memo_characters !== undefined && (obj.max_memo_characters = message.max_memo_characters); + message.tx_sig_limit !== undefined && (obj.tx_sig_limit = message.tx_sig_limit); + message.tx_size_cost_per_byte !== undefined && (obj.tx_size_cost_per_byte = message.tx_size_cost_per_byte); + message.sig_verify_cost_ed25519 !== undefined && (obj.sig_verify_cost_ed25519 = message.sig_verify_cost_ed25519); + message.sig_verify_cost_secp256k1 !== undefined && + (obj.sig_verify_cost_secp256k1 = message.sig_verify_cost_secp256k1); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.max_memo_characters = object.max_memo_characters ?? "0"; + message.tx_sig_limit = object.tx_sig_limit ?? "0"; + message.tx_size_cost_per_byte = object.tx_size_cost_per_byte ?? "0"; + message.sig_verify_cost_ed25519 = object.sig_verify_cost_ed25519 ?? "0"; + message.sig_verify_cost_secp256k1 = object.sig_verify_cost_secp256k1 ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/auth/v1beta1/genesis.ts b/common/types/src/client/cosmos/auth/v1beta1/genesis.ts new file mode 100644 index 00000000..c67683fe --- /dev/null +++ b/common/types/src/client/cosmos/auth/v1beta1/genesis.ts @@ -0,0 +1,93 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Params } from "./auth"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** GenesisState defines the auth module's genesis state. */ +export interface GenesisState { + /** params defines all the paramaters of the module. */ + params?: Params; + /** accounts are the accounts present at genesis. */ + accounts: Any[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, accounts: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.accounts.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.accounts) { + obj.accounts = message.accounts.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.accounts = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/auth/v1beta1/query.ts b/common/types/src/client/cosmos/auth/v1beta1/query.ts new file mode 100644 index 00000000..4fe0cbf9 --- /dev/null +++ b/common/types/src/client/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,900 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Params } from "./auth"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** + * 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; +} + +/** + * 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: Any[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + /** address defines the address to query for. */ + address: string; +} + +/** QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. */ +export interface QueryModuleAccountsRequest { +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponse { + /** account defines the account of the corresponding address. */ + account?: Any; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. */ +export interface QueryModuleAccountsResponse { + accounts: Any[]; +} + +/** Bech32PrefixRequest is the request type for Bech32Prefix rpc method */ +export interface Bech32PrefixRequest { +} + +/** Bech32PrefixResponse is the response type for Bech32Prefix rpc method */ +export interface Bech32PrefixResponse { + bech32_prefix: string; +} + +/** AddressBytesToStringRequest is the request type for AddressString rpc method */ +export interface AddressBytesToStringRequest { + address_bytes: Uint8Array; +} + +/** AddressBytesToStringResponse is the response type for AddressString rpc method */ +export interface AddressBytesToStringResponse { + address_string: string; +} + +/** AddressStringToBytesRequest is the request type for AccountBytes rpc method */ +export interface AddressStringToBytesRequest { + address_string: string; +} + +/** AddressStringToBytesResponse is the response type for AddressBytes rpc method */ +export interface AddressStringToBytesResponse { + address_bytes: Uint8Array; +} + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest = { + encode(message: QueryAccountsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountsResponse(): QueryAccountsResponse { + return { accounts: [], pagination: undefined }; +} + +export const QueryAccountsResponse = { + encode(message: QueryAccountsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(Any.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountsResponse { + return { + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAccountsResponse): unknown { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.accounts = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountsResponse { + const message = createBaseQueryAccountsResponse(); + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountRequest(): QueryAccountRequest { + return { address: "" }; +} + +export const QueryAccountRequest = { + encode(message: QueryAccountRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { + return {}; +} + +export const QueryModuleAccountsRequest = { + encode(_: QueryModuleAccountsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleAccountsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryModuleAccountsRequest { + return {}; + }, + + toJSON(_: QueryModuleAccountsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountResponse(): QueryAccountResponse { + return { account: undefined }; +} + +export const QueryAccountResponse = { + encode(message: QueryAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryAccountResponse): unknown { + const obj: any = {}; + message.account !== undefined && (obj.account = message.account ? Any.toJSON(message.account) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountResponse { + const message = createBaseQueryAccountResponse(); + message.account = (object.account !== undefined && object.account !== null) + ? Any.fromPartial(object.account) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { + return { accounts: [] }; +} + +export const QueryModuleAccountsResponse = { + encode(message: QueryModuleAccountsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleAccountsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountsResponse { + return { accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryModuleAccountsResponse): unknown { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.accounts = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBech32PrefixRequest(): Bech32PrefixRequest { + return {}; +} + +export const Bech32PrefixRequest = { + encode(_: Bech32PrefixRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Bech32PrefixRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): Bech32PrefixRequest { + return {}; + }, + + toJSON(_: Bech32PrefixRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, +}; + +function createBaseBech32PrefixResponse(): Bech32PrefixResponse { + return { bech32_prefix: "" }; +} + +export const Bech32PrefixResponse = { + encode(message: Bech32PrefixResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bech32_prefix !== "") { + writer.uint32(10).string(message.bech32_prefix); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Bech32PrefixResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.bech32_prefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Bech32PrefixResponse { + return { bech32_prefix: isSet(object.bech32_prefix) ? String(object.bech32_prefix) : "" }; + }, + + toJSON(message: Bech32PrefixResponse): unknown { + const obj: any = {}; + message.bech32_prefix !== undefined && (obj.bech32_prefix = message.bech32_prefix); + return obj; + }, + + fromPartial, I>>(object: I): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + message.bech32_prefix = object.bech32_prefix ?? ""; + return message; + }, +}; + +function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { + return { address_bytes: new Uint8Array() }; +} + +export const AddressBytesToStringRequest = { + encode(message: AddressBytesToStringRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address_bytes.length !== 0) { + writer.uint32(10).bytes(message.address_bytes); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddressBytesToStringRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address_bytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringRequest { + return { address_bytes: isSet(object.address_bytes) ? bytesFromBase64(object.address_bytes) : new Uint8Array() }; + }, + + toJSON(message: AddressBytesToStringRequest): unknown { + const obj: any = {}; + message.address_bytes !== undefined && + (obj.address_bytes = base64FromBytes( + message.address_bytes !== undefined ? message.address_bytes : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + message.address_bytes = object.address_bytes ?? new Uint8Array(); + return message; + }, +}; + +function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { + return { address_string: "" }; +} + +export const AddressBytesToStringResponse = { + encode(message: AddressBytesToStringResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address_string !== "") { + writer.uint32(10).string(message.address_string); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddressBytesToStringResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address_string = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringResponse { + return { address_string: isSet(object.address_string) ? String(object.address_string) : "" }; + }, + + toJSON(message: AddressBytesToStringResponse): unknown { + const obj: any = {}; + message.address_string !== undefined && (obj.address_string = message.address_string); + return obj; + }, + + fromPartial, I>>(object: I): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + message.address_string = object.address_string ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { + return { address_string: "" }; +} + +export const AddressStringToBytesRequest = { + encode(message: AddressStringToBytesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address_string !== "") { + writer.uint32(10).string(message.address_string); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddressStringToBytesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address_string = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesRequest { + return { address_string: isSet(object.address_string) ? String(object.address_string) : "" }; + }, + + toJSON(message: AddressStringToBytesRequest): unknown { + const obj: any = {}; + message.address_string !== undefined && (obj.address_string = message.address_string); + return obj; + }, + + fromPartial, I>>(object: I): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + message.address_string = object.address_string ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { + return { address_bytes: new Uint8Array() }; +} + +export const AddressStringToBytesResponse = { + encode(message: AddressStringToBytesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address_bytes.length !== 0) { + writer.uint32(10).bytes(message.address_bytes); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddressStringToBytesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address_bytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesResponse { + return { address_bytes: isSet(object.address_bytes) ? bytesFromBase64(object.address_bytes) : new Uint8Array() }; + }, + + toJSON(message: AddressStringToBytesResponse): unknown { + const obj: any = {}; + message.address_bytes !== undefined && + (obj.address_bytes = base64FromBytes( + message.address_bytes !== undefined ? message.address_bytes : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + message.address_bytes = object.address_bytes ?? new Uint8Array(); + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Accounts returns all the existing accounts + * + * Since: cosmos-sdk 0.43 + */ + Accounts(request: QueryAccountsRequest): Promise; + /** Account returns account details based on address. */ + Account(request: QueryAccountRequest): Promise; + /** Params queries all parameters. */ + Params(request: QueryParamsRequest): Promise; + /** ModuleAccounts returns all the existing module accounts. */ + ModuleAccounts(request: QueryModuleAccountsRequest): Promise; + /** Bech32 queries bech32Prefix */ + Bech32Prefix(request: Bech32PrefixRequest): Promise; + /** AddressBytesToString converts Account Address bytes to string */ + AddressBytesToString(request: AddressBytesToStringRequest): Promise; + /** AddressStringToBytes converts Address string to bytes */ + AddressStringToBytes(request: AddressStringToBytesRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.auth.v1beta1.Query"; + this.rpc = rpc; + this.Accounts = this.Accounts.bind(this); + this.Account = this.Account.bind(this); + this.Params = this.Params.bind(this); + this.ModuleAccounts = this.ModuleAccounts.bind(this); + this.Bech32Prefix = this.Bech32Prefix.bind(this); + this.AddressBytesToString = this.AddressBytesToString.bind(this); + this.AddressStringToBytes = this.AddressStringToBytes.bind(this); + } + Accounts(request: QueryAccountsRequest): Promise { + const data = QueryAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Accounts", data); + return promise.then((data) => QueryAccountsResponse.decode(new _m0.Reader(data))); + } + + Account(request: QueryAccountRequest): Promise { + const data = QueryAccountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Account", data); + return promise.then((data) => QueryAccountResponse.decode(new _m0.Reader(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + ModuleAccounts(request: QueryModuleAccountsRequest): Promise { + const data = QueryModuleAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ModuleAccounts", data); + return promise.then((data) => QueryModuleAccountsResponse.decode(new _m0.Reader(data))); + } + + Bech32Prefix(request: Bech32PrefixRequest): Promise { + const data = Bech32PrefixRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Bech32Prefix", data); + return promise.then((data) => Bech32PrefixResponse.decode(new _m0.Reader(data))); + } + + AddressBytesToString(request: AddressBytesToStringRequest): Promise { + const data = AddressBytesToStringRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AddressBytesToString", data); + return promise.then((data) => AddressBytesToStringResponse.decode(new _m0.Reader(data))); + } + + AddressStringToBytes(request: AddressStringToBytesRequest): Promise { + const data = AddressStringToBytesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AddressStringToBytes", data); + return promise.then((data) => AddressStringToBytesResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/authz/v1beta1/authz.ts b/common/types/src/client/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 00000000..13d9662e --- /dev/null +++ b/common/types/src/client/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,325 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.authz.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** + * 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; +} + +/** + * Grant gives permissions to execute + * the provide method with expiration time. + */ +export interface Grant { + authorization?: Any; + /** + * 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; +} + +/** + * 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?: Any; + expiration?: Date; +} + +/** 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. */ + msg_type_urls: string[]; +} + +function createBaseGenericAuthorization(): GenericAuthorization { + return { msg: "" }; +} + +export const GenericAuthorization = { + encode(message: GenericAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): GenericAuthorization { + return { msg: isSet(object.msg) ? String(object.msg) : "" }; + }, + + toJSON(message: GenericAuthorization): unknown { + const obj: any = {}; + message.msg !== undefined && (obj.msg = message.msg); + return obj; + }, + + fromPartial, I>>(object: I): GenericAuthorization { + const message = createBaseGenericAuthorization(); + message.msg = object.msg ?? ""; + return message; + }, +}; + +function createBaseGrant(): Grant { + return { authorization: undefined, expiration: undefined }; +} + +export const Grant = { + encode(message: Grant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authorization !== undefined) { + Any.encode(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: _m0.Reader | Uint8Array, length?: number): Grant { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + case 2: + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Grant { + return { + authorization: isSet(object.authorization) ? Any.fromJSON(object.authorization) : undefined, + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: Grant): unknown { + const obj: any = {}; + message.authorization !== undefined && + (obj.authorization = message.authorization ? Any.toJSON(message.authorization) : undefined); + message.expiration !== undefined && (obj.expiration = message.expiration.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): Grant { + const message = createBaseGrant(); + message.authorization = (object.authorization !== undefined && object.authorization !== null) + ? Any.fromPartial(object.authorization) + : undefined; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBaseGrantAuthorization(): GrantAuthorization { + return { granter: "", grantee: "", authorization: undefined, expiration: undefined }; +} + +export const GrantAuthorization = { + encode(message: GrantAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + Any.encode(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: _m0.Reader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + case 4: + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GrantAuthorization { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + authorization: isSet(object.authorization) ? Any.fromJSON(object.authorization) : undefined, + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: GrantAuthorization): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.authorization !== undefined && + (obj.authorization = message.authorization ? Any.toJSON(message.authorization) : undefined); + message.expiration !== undefined && (obj.expiration = message.expiration.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): GrantAuthorization { + const message = createBaseGrantAuthorization(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.authorization = (object.authorization !== undefined && object.authorization !== null) + ? Any.fromPartial(object.authorization) + : undefined; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBaseGrantQueueItem(): GrantQueueItem { + return { msg_type_urls: [] }; +} + +export const GrantQueueItem = { + encode(message: GrantQueueItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.msg_type_urls) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GrantQueueItem { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_type_urls.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GrantQueueItem { + return { + msg_type_urls: Array.isArray(object?.msg_type_urls) ? object.msg_type_urls.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: GrantQueueItem): unknown { + const obj: any = {}; + if (message.msg_type_urls) { + obj.msg_type_urls = message.msg_type_urls.map((e) => e); + } else { + obj.msg_type_urls = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msg_type_urls = object.msg_type_urls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/authz/v1beta1/event.ts b/common/types/src/client/cosmos/authz/v1beta1/event.ts new file mode 100644 index 00000000..6a9f5469 --- /dev/null +++ b/common/types/src/client/cosmos/authz/v1beta1/event.ts @@ -0,0 +1,175 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.authz.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** EventGrant is emitted on Msg/Grant */ +export interface EventGrant { + /** Msg type URL for which an autorization is granted */ + msg_type_url: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} + +/** EventRevoke is emitted on Msg/Revoke */ +export interface EventRevoke { + /** Msg type URL for which an autorization is revoked */ + msg_type_url: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} + +function createBaseEventGrant(): EventGrant { + return { msg_type_url: "", granter: "", grantee: "" }; +} + +export const EventGrant = { + encode(message: EventGrant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg_type_url !== "") { + writer.uint32(18).string(message.msg_type_url); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventGrant { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.msg_type_url = reader.string(); + break; + case 3: + message.granter = reader.string(); + break; + case 4: + message.grantee = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventGrant { + return { + msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "", + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + }; + }, + + toJSON(message: EventGrant): unknown { + const obj: any = {}; + message.msg_type_url !== undefined && (obj.msg_type_url = message.msg_type_url); + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + return obj; + }, + + fromPartial, I>>(object: I): EventGrant { + const message = createBaseEventGrant(); + message.msg_type_url = object.msg_type_url ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseEventRevoke(): EventRevoke { + return { msg_type_url: "", granter: "", grantee: "" }; +} + +export const EventRevoke = { + encode(message: EventRevoke, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg_type_url !== "") { + writer.uint32(18).string(message.msg_type_url); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventRevoke { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.msg_type_url = reader.string(); + break; + case 3: + message.granter = reader.string(); + break; + case 4: + message.grantee = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventRevoke { + return { + msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "", + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + }; + }, + + toJSON(message: EventRevoke): unknown { + const obj: any = {}; + message.msg_type_url !== undefined && (obj.msg_type_url = message.msg_type_url); + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + return obj; + }, + + fromPartial, I>>(object: I): EventRevoke { + const message = createBaseEventRevoke(); + message.msg_type_url = object.msg_type_url ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/authz/v1beta1/genesis.ts b/common/types/src/client/cosmos/authz/v1beta1/genesis.ts new file mode 100644 index 00000000..5eb22427 --- /dev/null +++ b/common/types/src/client/cosmos/authz/v1beta1/genesis.ts @@ -0,0 +1,78 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { GrantAuthorization } from "./authz"; + +export const protobufPackage = "cosmos.authz.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** GenesisState defines the authz module's genesis state. */ +export interface GenesisState { + authorization: GrantAuthorization[]; +} + +function createBaseGenesisState(): GenesisState { + return { authorization: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.authorization) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authorization.push(GrantAuthorization.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + authorization: Array.isArray(object?.authorization) + ? object.authorization.map((e: any) => GrantAuthorization.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.authorization) { + obj.authorization = message.authorization.map((e) => e ? GrantAuthorization.toJSON(e) : undefined); + } else { + obj.authorization = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.authorization = object.authorization?.map((e) => GrantAuthorization.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/client/cosmos/authz/v1beta1/query.ts b/common/types/src/client/cosmos/authz/v1beta1/query.ts new file mode 100644 index 00000000..f8fa6414 --- /dev/null +++ b/common/types/src/client/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,518 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantAuthorization } from "./authz"; + +export const protobufPackage = "cosmos.authz.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ +export interface QueryGrantsRequest { + granter: string; + grantee: string; + /** Optional, msg_type_url, when set, will query only grants matching given msg type. */ + msg_type_url: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGrantsResponse is the response type for the Query/Authorizations RPC method. */ +export interface QueryGrantsResponse { + /** authorizations is a list of grants granted for grantee by granter. */ + grants: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +/** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsResponse { + /** grants is a list of grants granted by the granter. */ + grants: GrantAuthorization[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ +export interface QueryGranteeGrantsRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsResponse { + /** grants is a list of grants granted to the grantee. */ + grants: GrantAuthorization[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +function createBaseQueryGrantsRequest(): QueryGrantsRequest { + return { granter: "", grantee: "", msg_type_url: "", pagination: undefined }; +} + +export const QueryGrantsRequest = { + encode(message: QueryGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msg_type_url !== "") { + writer.uint32(26).string(message.msg_type_url); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGrantsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGrantsRequest(); + 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.msg_type_url = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGrantsRequest { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsRequest): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.msg_type_url !== undefined && (obj.msg_type_url = message.msg_type_url); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGrantsRequest { + const message = createBaseQueryGrantsRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msg_type_url = object.msg_type_url ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGrantsResponse(): QueryGrantsResponse { + return { grants: [], pagination: undefined }; +} + +export const QueryGrantsResponse = { + encode(message: QueryGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.grants) { + Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGrantsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(Grant.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGrantsResponse { + return { + grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => Grant.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsResponse): unknown { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => e ? Grant.toJSON(e) : undefined); + } else { + obj.grants = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGrantsResponse { + const message = createBaseQueryGrantsResponse(); + message.grants = object.grants?.map((e) => Grant.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest { + return { granter: "", pagination: undefined }; +} + +export const QueryGranterGrantsRequest = { + encode(message: QueryGranterGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranterGrantsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranterGrantsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsRequest { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsRequest): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGranterGrantsRequest { + const message = createBaseQueryGranterGrantsRequest(); + message.granter = object.granter ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse { + return { grants: [], pagination: undefined }; +} + +export const QueryGranterGrantsResponse = { + encode(message: QueryGranterGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranterGrantsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranterGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsResponse { + return { + grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => GrantAuthorization.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsResponse): unknown { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => e ? GrantAuthorization.toJSON(e) : undefined); + } else { + obj.grants = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGranterGrantsResponse { + const message = createBaseQueryGranterGrantsResponse(); + message.grants = object.grants?.map((e) => GrantAuthorization.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest { + return { grantee: "", pagination: undefined }; +} + +export const QueryGranteeGrantsRequest = { + encode(message: QueryGranteeGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranteeGrantsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranteeGrantsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grantee = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsRequest { + return { + grantee: isSet(object.grantee) ? String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsRequest): unknown { + const obj: any = {}; + message.grantee !== undefined && (obj.grantee = message.grantee); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGranteeGrantsRequest { + const message = createBaseQueryGranteeGrantsRequest(); + message.grantee = object.grantee ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse { + return { grants: [], pagination: undefined }; +} + +export const QueryGranteeGrantsResponse = { + encode(message: QueryGranteeGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranteeGrantsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranteeGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsResponse { + return { + grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => GrantAuthorization.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsResponse): unknown { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => e ? GrantAuthorization.toJSON(e) : undefined); + } else { + obj.grants = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGranteeGrantsResponse { + const message = createBaseQueryGranteeGrantsResponse(); + message.grants = object.grants?.map((e) => GrantAuthorization.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Returns list of `Authorization`, granted to the grantee by the granter. */ + Grants(request: QueryGrantsRequest): Promise; + /** + * GranterGrants returns list of `GrantAuthorization`, granted by granter. + * + * Since: cosmos-sdk 0.46 + */ + GranterGrants(request: QueryGranterGrantsRequest): Promise; + /** + * GranteeGrants returns a list of `GrantAuthorization` by grantee. + * + * Since: cosmos-sdk 0.46 + */ + GranteeGrants(request: QueryGranteeGrantsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.authz.v1beta1.Query"; + this.rpc = rpc; + this.Grants = this.Grants.bind(this); + this.GranterGrants = this.GranterGrants.bind(this); + this.GranteeGrants = this.GranteeGrants.bind(this); + } + Grants(request: QueryGrantsRequest): Promise { + const data = QueryGrantsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Grants", data); + return promise.then((data) => QueryGrantsResponse.decode(new _m0.Reader(data))); + } + + GranterGrants(request: QueryGranterGrantsRequest): Promise { + const data = QueryGranterGrantsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GranterGrants", data); + return promise.then((data) => QueryGranterGrantsResponse.decode(new _m0.Reader(data))); + } + + GranteeGrants(request: QueryGranteeGrantsRequest): Promise { + const data = QueryGranteeGrantsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GranteeGrants", data); + return promise.then((data) => QueryGranteeGrantsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/authz/v1beta1/tx.ts b/common/types/src/client/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 00000000..8341fcff --- /dev/null +++ b/common/types/src/client/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,495 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Grant } from "./authz"; + +export const protobufPackage = "cosmos.authz.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** + * 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; +} + +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} + +/** + * 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; + /** + * Authorization Msg requests to execute. Each msg must implement Authorization interface + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: Any[]; +} + +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse { +} + +/** + * 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; + msg_type_url: string; +} + +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponse { +} + +function createBaseMsgGrant(): MsgGrant { + return { granter: "", grantee: "", grant: undefined }; +} + +export const MsgGrant = { + encode(message: MsgGrant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgGrant { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined, + }; + }, + + toJSON(message: MsgGrant): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.grant !== undefined && (obj.grant = message.grant ? Grant.toJSON(message.grant) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { results: [] }; +} + +export const MsgExecResponse = { + encode(message: MsgExecResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgExecResponse { + return { results: Array.isArray(object?.results) ? object.results.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.results = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { grantee: "", msgs: [] }; +} + +export const MsgExec = { + encode(message: MsgExec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + grantee: isSet(object.grantee) ? String(object.grantee) : "", + msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + message.grantee !== undefined && (obj.grantee = message.grantee); + if (message.msgs) { + obj.msgs = message.msgs.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.msgs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} + +export const MsgGrantResponse = { + encode(_: MsgGrantResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgGrantResponse { + return {}; + }, + + toJSON(_: MsgGrantResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, +}; + +function createBaseMsgRevoke(): MsgRevoke { + return { granter: "", grantee: "", msg_type_url: "" }; +} + +export const MsgRevoke = { + encode(message: MsgRevoke, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msg_type_url !== "") { + writer.uint32(26).string(message.msg_type_url); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_type_url = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgRevoke { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "", + }; + }, + + toJSON(message: MsgRevoke): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.msg_type_url !== undefined && (obj.msg_type_url = message.msg_type_url); + return obj; + }, + + fromPartial, I>>(object: I): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msg_type_url = object.msg_type_url ?? ""; + return message; + }, +}; + +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} + +export const MsgRevokeResponse = { + encode(_: MsgRevokeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgRevokeResponse { + return {}; + }, + + toJSON(_: MsgRevokeResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgRevokeResponse { + const message = createBaseMsgRevokeResponse(); + return message; + }, +}; + +/** Msg defines the authz Msg service. */ +export interface Msg { + /** + * Grant grants the provided authorization to the grantee on the granter's + * account with the provided expiration time. If there is already a grant + * for the given (granter, grantee, Authorization) triple, then the grant + * will be overwritten. + */ + Grant(request: MsgGrant): Promise; + /** + * Exec 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. + */ + Exec(request: MsgExec): Promise; + /** + * Revoke revokes any authorization corresponding to the provided method name on the + * granter's account that has been granted to the grantee. + */ + Revoke(request: MsgRevoke): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.authz.v1beta1.Msg"; + this.rpc = rpc; + this.Grant = this.Grant.bind(this); + this.Exec = this.Exec.bind(this); + this.Revoke = this.Revoke.bind(this); + } + Grant(request: MsgGrant): Promise { + const data = MsgGrant.encode(request).finish(); + const promise = this.rpc.request(this.service, "Grant", data); + return promise.then((data) => MsgGrantResponse.decode(new _m0.Reader(data))); + } + + Exec(request: MsgExec): Promise { + const data = MsgExec.encode(request).finish(); + const promise = this.rpc.request(this.service, "Exec", data); + return promise.then((data) => MsgExecResponse.decode(new _m0.Reader(data))); + } + + Revoke(request: MsgRevoke): Promise { + const data = MsgRevoke.encode(request).finish(); + const promise = this.rpc.request(this.service, "Revoke", data); + return promise.then((data) => MsgRevokeResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/bank/v1beta1/authz.ts b/common/types/src/client/cosmos/bank/v1beta1/authz.ts new file mode 100644 index 00000000..ddcc3b3f --- /dev/null +++ b/common/types/src/client/cosmos/bank/v1beta1/authz.ts @@ -0,0 +1,79 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** + * SendAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account. + * + * Since: cosmos-sdk 0.43 + */ +export interface SendAuthorization { + spend_limit: Coin[]; +} + +function createBaseSendAuthorization(): SendAuthorization { + return { spend_limit: [] }; +} + +export const SendAuthorization = { + encode(message: SendAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.spend_limit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SendAuthorization { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.spend_limit.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SendAuthorization { + return { + spend_limit: Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: SendAuthorization): unknown { + const obj: any = {}; + if (message.spend_limit) { + obj.spend_limit = message.spend_limit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.spend_limit = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spend_limit = object.spend_limit?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/client/cosmos/bank/v1beta1/bank.ts b/common/types/src/client/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 00000000..6ad552cf --- /dev/null +++ b/common/types/src/client/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,604 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** Params defines the parameters for the bank module. */ +export interface Params { + send_enabled: SendEnabled[]; + default_send_enabled: boolean; +} + +/** + * SendEnabled maps coin denom to a send_enabled status (whether a denom is + * sendable). + */ +export interface SendEnabled { + denom: string; + enabled: boolean; +} + +/** Input models transaction input. */ +export interface Input { + address: string; + coins: Coin[]; +} + +/** Output models transaction outputs. */ +export interface Output { + address: string; + coins: Coin[]; +} + +/** + * 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[]; +} + +/** + * 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[]; +} + +/** + * 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 */ + denom_units: 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 + */ + uri_hash: string; +} + +function createBaseParams(): Params { + return { send_enabled: [], default_send_enabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.send_enabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.default_send_enabled === true) { + writer.uint32(16).bool(message.default_send_enabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.send_enabled.push(SendEnabled.decode(reader, reader.uint32())); + break; + case 2: + message.default_send_enabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + send_enabled: Array.isArray(object?.send_enabled) + ? object.send_enabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + default_send_enabled: isSet(object.default_send_enabled) ? Boolean(object.default_send_enabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.send_enabled) { + obj.send_enabled = message.send_enabled.map((e) => e ? SendEnabled.toJSON(e) : undefined); + } else { + obj.send_enabled = []; + } + message.default_send_enabled !== undefined && (obj.default_send_enabled = message.default_send_enabled); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.send_enabled = object.send_enabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.default_send_enabled = object.default_send_enabled ?? false; + return message; + }, +}; + +function createBaseSendEnabled(): SendEnabled { + return { denom: "", enabled: false }; +} + +export const SendEnabled = { + encode(message: SendEnabled, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled === true) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SendEnabled { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + enabled: isSet(object.enabled) ? Boolean(object.enabled) : false, + }; + }, + + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.enabled !== undefined && (obj.enabled = message.enabled); + return obj; + }, + + fromPartial, I>>(object: I): SendEnabled { + const message = createBaseSendEnabled(); + message.denom = object.denom ?? ""; + message.enabled = object.enabled ?? false; + return message; + }, +}; + +function createBaseInput(): Input { + return { address: "", coins: [] }; +} + +export const Input = { + encode(message: Input, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Input { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Input { + return { + address: isSet(object.address) ? String(object.address) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Input): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.coins = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Input { + const message = createBaseInput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseOutput(): Output { + return { address: "", coins: [] }; +} + +export const Output = { + encode(message: Output, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Output { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Output { + return { + address: isSet(object.address) ? String(object.address) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Output): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.coins = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Output { + const message = createBaseOutput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSupply(): Supply { + return { total: [] }; +} + +export const Supply = { + encode(message: Supply, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Supply { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Supply { + return { total: Array.isArray(object?.total) ? object.total.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: Supply): unknown { + const obj: any = {}; + if (message.total) { + obj.total = message.total.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.total = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Supply { + const message = createBaseSupply(); + message.total = object.total?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDenomUnit(): DenomUnit { + return { denom: "", exponent: 0, aliases: [] }; +} + +export const DenomUnit = { + encode(message: DenomUnit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DenomUnit { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + exponent: isSet(object.exponent) ? Number(object.exponent) : 0, + aliases: Array.isArray(object?.aliases) ? object.aliases.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.exponent !== undefined && (obj.exponent = Math.round(message.exponent)); + if (message.aliases) { + obj.aliases = message.aliases.map((e) => e); + } else { + obj.aliases = []; + } + return obj; + }, + + fromPartial, I>>(object: I): DenomUnit { + const message = createBaseDenomUnit(); + message.denom = object.denom ?? ""; + message.exponent = object.exponent ?? 0; + message.aliases = object.aliases?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMetadata(): Metadata { + return { description: "", denom_units: [], base: "", display: "", name: "", symbol: "", uri: "", uri_hash: "" }; +} + +export const Metadata = { + encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denom_units) { + 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.uri_hash !== "") { + writer.uint32(66).string(message.uri_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Metadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.denom_units.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.uri_hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + description: isSet(object.description) ? String(object.description) : "", + denom_units: Array.isArray(object?.denom_units) ? object.denom_units.map((e: any) => DenomUnit.fromJSON(e)) : [], + base: isSet(object.base) ? String(object.base) : "", + display: isSet(object.display) ? String(object.display) : "", + name: isSet(object.name) ? String(object.name) : "", + symbol: isSet(object.symbol) ? String(object.symbol) : "", + uri: isSet(object.uri) ? String(object.uri) : "", + uri_hash: isSet(object.uri_hash) ? String(object.uri_hash) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + message.description !== undefined && (obj.description = message.description); + if (message.denom_units) { + obj.denom_units = message.denom_units.map((e) => e ? DenomUnit.toJSON(e) : undefined); + } else { + obj.denom_units = []; + } + message.base !== undefined && (obj.base = message.base); + message.display !== undefined && (obj.display = message.display); + message.name !== undefined && (obj.name = message.name); + message.symbol !== undefined && (obj.symbol = message.symbol); + message.uri !== undefined && (obj.uri = message.uri); + message.uri_hash !== undefined && (obj.uri_hash = message.uri_hash); + return obj; + }, + + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denom_units = object.denom_units?.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.uri_hash = object.uri_hash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/bank/v1beta1/genesis.ts b/common/types/src/client/cosmos/bank/v1beta1/genesis.ts new file mode 100644 index 00000000..b0a000e9 --- /dev/null +++ b/common/types/src/client/cosmos/bank/v1beta1/genesis.ts @@ -0,0 +1,201 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisState { + /** params defines all the paramaters of the module. */ + params?: Params; + /** balances is an array containing the balances of all the accounts. */ + balances: Balance[]; + /** + * supply represents the total supply. If it is left empty, then supply will be calculated based on the provided + * balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. + */ + supply: Coin[]; + /** denom_metadata defines the metadata of the differents coins. */ + denom_metadata: Metadata[]; +} + +/** + * Balance defines an account address and balance pair used in the bank module's + * genesis state. + */ +export interface Balance { + /** address is the address of the balance holder. */ + address: string; + /** coins defines the different coins this balance holds. */ + coins: Coin[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, balances: [], supply: [], denom_metadata: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.balances) { + Balance.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.denom_metadata) { + Metadata.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.balances.push(Balance.decode(reader, reader.uint32())); + break; + case 3: + message.supply.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.denom_metadata.push(Metadata.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + balances: Array.isArray(object?.balances) ? object.balances.map((e: any) => Balance.fromJSON(e)) : [], + supply: Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + denom_metadata: Array.isArray(object?.denom_metadata) + ? object.denom_metadata.map((e: any) => Metadata.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.balances) { + obj.balances = message.balances.map((e) => e ? Balance.toJSON(e) : undefined); + } else { + obj.balances = []; + } + if (message.supply) { + obj.supply = message.supply.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.supply = []; + } + if (message.denom_metadata) { + obj.denom_metadata = message.denom_metadata.map((e) => e ? Metadata.toJSON(e) : undefined); + } else { + obj.denom_metadata = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.balances = object.balances?.map((e) => Balance.fromPartial(e)) || []; + message.supply = object.supply?.map((e) => Coin.fromPartial(e)) || []; + message.denom_metadata = object.denom_metadata?.map((e) => Metadata.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBalance(): Balance { + return { address: "", coins: [] }; +} + +export const Balance = { + encode(message: Balance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Balance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBalance(); + 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; + }, + + fromJSON(object: any): Balance { + return { + address: isSet(object.address) ? String(object.address) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Balance): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.coins = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Balance { + const message = createBaseBalance(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/bank/v1beta1/query.ts b/common/types/src/client/cosmos/bank/v1beta1/query.ts new file mode 100644 index 00000000..5f7176bd --- /dev/null +++ b/common/types/src/client/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,1356 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** 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; +} + +/** QueryBalanceResponse is the response type for the Query/Balance RPC method. */ +export interface QueryBalanceResponse { + /** balance is the balance of the coin. */ + balance?: Coin; +} + +/** 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; +} + +/** + * 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; +} + +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + */ +export interface QuerySpendableBalancesRequest { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + */ +export interface QuerySpendableBalancesResponse { + /** balances is the spendable balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * 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; +} + +/** + * 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; +} + +/** 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; +} + +/** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfResponse { + /** amount is the supply of the coin. */ + amount?: Coin; +} + +/** QueryParamsRequest defines the request type for querying x/bank parameters. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse defines the response type for querying x/bank parameters. */ +export interface QueryParamsResponse { + params?: Params; +} + +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * 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; +} + +/** 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; +} + +/** + * 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; +} + +/** + * 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; +} + +/** + * 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. + */ +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; +} + +/** QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. */ +export interface QueryDenomOwnersResponse { + denom_owners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { address: "", denom: "" }; +} + +export const QueryBalanceRequest = { + encode(message: QueryBalanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + denom: isSet(object.denom) ? String(object.denom) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + + fromPartial, I>>(object: I): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { balance: undefined }; +} + +export const QueryBalanceResponse = { + encode(message: QueryBalanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + message.balance !== undefined && (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.balance = (object.balance !== undefined && object.balance !== null) + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; + +function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { + return { address: "", pagination: undefined }; +} + +export const QueryAllBalancesRequest = { + encode(message: QueryAllBalancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllBalancesRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllBalancesRequest { + const message = createBaseQueryAllBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { + return { balances: [], pagination: undefined }; +} + +export const QueryAllBalancesResponse = { + encode(message: QueryAllBalancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryAllBalancesResponse { + return { + balances: Array.isArray(object?.balances) ? object.balances.map((e: any) => Coin.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllBalancesResponse): unknown { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.balances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesRequest { + return { address: "", pagination: undefined }; +} + +export const QuerySpendableBalancesRequest = { + encode(message: QuerySpendableBalancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QuerySpendableBalancesRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QuerySpendableBalancesRequest { + const message = createBaseQuerySpendableBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesResponse { + return { balances: [], pagination: undefined }; +} + +export const QuerySpendableBalancesResponse = { + encode(message: QuerySpendableBalancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QuerySpendableBalancesResponse { + return { + balances: Array.isArray(object?.balances) ? object.balances.map((e: any) => Coin.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesResponse): unknown { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.balances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): 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; + }, +}; + +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { pagination: undefined }; +} + +export const QueryTotalSupplyRequest = { + encode(message: QueryTotalSupplyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryTotalSupplyRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryTotalSupplyRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryTotalSupplyRequest { + const message = createBaseQueryTotalSupplyRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { + return { supply: [], pagination: undefined }; +} + +export const QueryTotalSupplyResponse = { + encode(message: QueryTotalSupplyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryTotalSupplyResponse { + return { + supply: Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryTotalSupplyResponse): unknown { + const obj: any = {}; + if (message.supply) { + obj.supply = message.supply.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.supply = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest { + return { denom: "" }; +} + +export const QuerySupplyOfRequest = { + encode(message: QuerySupplyOfRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QuerySupplyOfRequest { + return { denom: isSet(object.denom) ? String(object.denom) : "" }; + }, + + toJSON(message: QuerySupplyOfRequest): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + + fromPartial, I>>(object: I): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { + return { amount: undefined }; +} + +export const QuerySupplyOfResponse = { + encode(message: QuerySupplyOfResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QuerySupplyOfResponse { + return { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; + }, + + toJSON(message: QuerySupplyOfResponse): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QuerySupplyOfResponse { + const message = createBaseQuerySupplyOfResponse(); + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { + return { pagination: undefined }; +} + +export const QueryDenomsMetadataRequest = { + encode(message: QueryDenomsMetadataRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDenomsMetadataRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDenomsMetadataRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDenomsMetadataRequest { + const message = createBaseQueryDenomsMetadataRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse { + return { metadatas: [], pagination: undefined }; +} + +export const QueryDenomsMetadataResponse = { + encode(message: QueryDenomsMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDenomsMetadataResponse { + return { + metadatas: Array.isArray(object?.metadatas) ? object.metadatas.map((e: any) => Metadata.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomsMetadataResponse): unknown { + const obj: any = {}; + if (message.metadatas) { + obj.metadatas = message.metadatas.map((e) => e ? Metadata.toJSON(e) : undefined); + } else { + obj.metadatas = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { + return { denom: "" }; +} + +export const QueryDenomMetadataRequest = { + encode(message: QueryDenomMetadataRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDenomMetadataRequest { + return { denom: isSet(object.denom) ? String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataRequest): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + + fromPartial, I>>(object: I): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataResponse = { + encode(message: QueryDenomMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDenomMetadataResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataResponse): unknown { + const obj: any = {}; + message.metadata !== undefined && (obj.metadata = message.metadata ? Metadata.toJSON(message.metadata) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest { + return { denom: "", pagination: undefined }; +} + +export const QueryDenomOwnersRequest = { + encode(message: QueryDenomOwnersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryDenomOwnersRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDenomOwnersRequest { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersRequest): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDenomOwnersRequest { + const message = createBaseQueryDenomOwnersRequest(); + message.denom = object.denom ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseDenomOwner(): DenomOwner { + return { address: "", balance: undefined }; +} + +export const DenomOwner = { + encode(message: DenomOwner, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): DenomOwner { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DenomOwner { + return { + address: isSet(object.address) ? String(object.address) : "", + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, + }; + }, + + toJSON(message: DenomOwner): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.balance !== undefined && (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DenomOwner { + const message = createBaseDenomOwner(); + message.address = object.address ?? ""; + message.balance = (object.balance !== undefined && object.balance !== null) + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersResponse(): QueryDenomOwnersResponse { + return { denom_owners: [], pagination: undefined }; +} + +export const QueryDenomOwnersResponse = { + encode(message: QueryDenomOwnersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.denom_owners) { + 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: _m0.Reader | Uint8Array, length?: number): QueryDenomOwnersResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.denom_owners.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; + }, + + fromJSON(object: any): QueryDenomOwnersResponse { + return { + denom_owners: Array.isArray(object?.denom_owners) + ? object.denom_owners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersResponse): unknown { + const obj: any = {}; + if (message.denom_owners) { + obj.denom_owners = message.denom_owners.map((e) => e ? DenomOwner.toJSON(e) : undefined); + } else { + obj.denom_owners = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denom_owners = object.denom_owners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Balance queries the balance of a single coin for a single account. */ + Balance(request: QueryBalanceRequest): Promise; + /** AllBalances queries the balance of all coins for a single account. */ + AllBalances(request: QueryAllBalancesRequest): Promise; + /** + * SpendableBalances queries the spenable balance of all coins for a single + * account. + */ + SpendableBalances(request: QuerySpendableBalancesRequest): Promise; + /** TotalSupply queries the total supply of all coins. */ + TotalSupply(request: QueryTotalSupplyRequest): Promise; + /** SupplyOf queries the supply of a single coin. */ + SupplyOf(request: QuerySupplyOfRequest): Promise; + /** Params queries the parameters of x/bank module. */ + Params(request: QueryParamsRequest): Promise; + /** DenomsMetadata queries the client metadata of a given coin denomination. */ + DenomMetadata(request: QueryDenomMetadataRequest): Promise; + /** + * DenomsMetadata queries the client metadata for all registered coin + * denominations. + */ + DenomsMetadata(request: QueryDenomsMetadataRequest): Promise; + /** + * DenomOwners queries for all account addresses that own a particular token + * denomination. + */ + DenomOwners(request: QueryDenomOwnersRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.bank.v1beta1.Query"; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.AllBalances = this.AllBalances.bind(this); + this.SpendableBalances = this.SpendableBalances.bind(this); + this.TotalSupply = this.TotalSupply.bind(this); + this.SupplyOf = this.SupplyOf.bind(this); + this.Params = this.Params.bind(this); + this.DenomMetadata = this.DenomMetadata.bind(this); + this.DenomsMetadata = this.DenomsMetadata.bind(this); + this.DenomOwners = this.DenomOwners.bind(this); + } + Balance(request: QueryBalanceRequest): Promise { + const data = QueryBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Balance", data); + return promise.then((data) => QueryBalanceResponse.decode(new _m0.Reader(data))); + } + + AllBalances(request: QueryAllBalancesRequest): Promise { + const data = QueryAllBalancesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AllBalances", data); + return promise.then((data) => QueryAllBalancesResponse.decode(new _m0.Reader(data))); + } + + SpendableBalances(request: QuerySpendableBalancesRequest): Promise { + const data = QuerySpendableBalancesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SpendableBalances", data); + return promise.then((data) => QuerySpendableBalancesResponse.decode(new _m0.Reader(data))); + } + + TotalSupply(request: QueryTotalSupplyRequest): Promise { + const data = QueryTotalSupplyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TotalSupply", data); + return promise.then((data) => QueryTotalSupplyResponse.decode(new _m0.Reader(data))); + } + + SupplyOf(request: QuerySupplyOfRequest): Promise { + const data = QuerySupplyOfRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SupplyOf", data); + return promise.then((data) => QuerySupplyOfResponse.decode(new _m0.Reader(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + DenomMetadata(request: QueryDenomMetadataRequest): Promise { + const data = QueryDenomMetadataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomMetadata", data); + return promise.then((data) => QueryDenomMetadataResponse.decode(new _m0.Reader(data))); + } + + DenomsMetadata(request: QueryDenomsMetadataRequest): Promise { + const data = QueryDenomsMetadataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomsMetadata", data); + return promise.then((data) => QueryDenomsMetadataResponse.decode(new _m0.Reader(data))); + } + + DenomOwners(request: QueryDenomOwnersRequest): Promise { + const data = QueryDenomOwnersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomOwners", data); + return promise.then((data) => QueryDenomOwnersResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/bank/v1beta1/tx.ts b/common/types/src/client/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 00000000..034e8c6e --- /dev/null +++ b/common/types/src/client/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,291 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Input, Output } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSend { + from_address: string; + to_address: string; + amount: Coin[]; +} + +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponse { +} + +/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ +export interface MsgMultiSend { + inputs: Input[]; + outputs: Output[]; +} + +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponse { +} + +function createBaseMsgSend(): MsgSend { + return { from_address: "", to_address: "", amount: [] }; +} + +export const MsgSend = { + encode(message: MsgSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.from_address = reader.string(); + break; + case 2: + message.to_address = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + from_address: isSet(object.from_address) ? String(object.from_address) : "", + to_address: isSet(object.to_address) ? String(object.to_address) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + message.from_address !== undefined && (obj.from_address = message.from_address); + message.to_address !== undefined && (obj.to_address = message.to_address); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse = { + encode(_: MsgSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +function createBaseMsgMultiSend(): MsgMultiSend { + return { inputs: [], outputs: [] }; +} + +export const MsgMultiSend = { + encode(message: MsgMultiSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgMultiSend { + return { + inputs: Array.isArray(object?.inputs) ? object.inputs.map((e: any) => Input.fromJSON(e)) : [], + outputs: Array.isArray(object?.outputs) ? object.outputs.map((e: any) => Output.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgMultiSend): unknown { + const obj: any = {}; + if (message.inputs) { + obj.inputs = message.inputs.map((e) => e ? Input.toJSON(e) : undefined); + } else { + obj.inputs = []; + } + if (message.outputs) { + obj.outputs = message.outputs.map((e) => e ? Output.toJSON(e) : undefined); + } else { + obj.outputs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgMultiSend { + const message = createBaseMsgMultiSend(); + message.inputs = object.inputs?.map((e) => Input.fromPartial(e)) || []; + message.outputs = object.outputs?.map((e) => Output.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgMultiSendResponse(): MsgMultiSendResponse { + return {}; +} + +export const MsgMultiSendResponse = { + encode(_: MsgMultiSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgMultiSendResponse { + return {}; + }, + + toJSON(_: MsgMultiSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** Send defines a method for sending coins from one account to another account. */ + Send(request: MsgSend): Promise; + /** MultiSend defines a method for sending coins from some accounts to other accounts. */ + MultiSend(request: MsgMultiSend): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.bank.v1beta1.Msg"; + this.rpc = rpc; + this.Send = this.Send.bind(this); + this.MultiSend = this.MultiSend.bind(this); + } + Send(request: MsgSend): Promise { + const data = MsgSend.encode(request).finish(); + const promise = this.rpc.request(this.service, "Send", data); + return promise.then((data) => MsgSendResponse.decode(new _m0.Reader(data))); + } + + MultiSend(request: MsgMultiSend): Promise { + const data = MsgMultiSend.encode(request).finish(); + const promise = this.rpc.request(this.service, "MultiSend", data); + return promise.then((data) => MsgMultiSendResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/base/abci/v1beta1/abci.ts b/common/types/src/client/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 00000000..b3aaa489 --- /dev/null +++ b/common/types/src/client/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,1035 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../../google/protobuf/any"; +import { Event } from "../../../../tendermint/abci/types"; + +export const protobufPackage = "cosmos.base.abci.v1beta1"; + +/** + * 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: 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: ABCIMessageLog[]; + /** 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?: 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 handler. 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[]; +} + +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLog { + msg_index: number; + log: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events: StringEvent[]; +} + +/** + * 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[]; +} + +/** + * Attribute defines an attribute wrapper where the key and value are + * strings instead of raw bytes. + */ +export interface Attribute { + key: string; + value: string; +} + +/** GasInfo defines tx execution gas context. */ +export interface GasInfo { + /** 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; +} + +/** 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 + */ + msg_responses: Any[]; +} + +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponse { + gas_info?: GasInfo; + result?: Result; +} + +/** + * MsgData defines the data returned in a Result object during message + * execution. + * + * @deprecated + */ +export interface MsgData { + msg_type: string; + data: Uint8Array; +} + +/** + * 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 + */ + msg_responses: Any[]; +} + +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResult { + /** 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: TxResponse[]; +} + +function createBaseTxResponse(): TxResponse { + return { + height: "0", + txhash: "", + codespace: "", + code: 0, + data: "", + raw_log: "", + logs: [], + info: "", + gas_wanted: "0", + gas_used: "0", + tx: undefined, + timestamp: "", + events: [], + }; +} + +export const TxResponse = { + encode(message: TxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "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.raw_log !== "") { + writer.uint32(50).string(message.raw_log); + } + 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.gas_wanted !== "0") { + writer.uint32(72).int64(message.gas_wanted); + } + if (message.gas_used !== "0") { + writer.uint32(80).int64(message.gas_used); + } + 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: _m0.Reader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + 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.raw_log = reader.string(); + break; + case 7: + message.logs.push(ABCIMessageLog.decode(reader, reader.uint32())); + break; + case 8: + message.info = reader.string(); + break; + case 9: + message.gas_wanted = longToString(reader.int64() as Long); + break; + case 10: + message.gas_used = longToString(reader.int64() as Long); + 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; + }, + + fromJSON(object: any): TxResponse { + return { + height: isSet(object.height) ? String(object.height) : "0", + txhash: isSet(object.txhash) ? String(object.txhash) : "", + codespace: isSet(object.codespace) ? String(object.codespace) : "", + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) ? String(object.data) : "", + raw_log: isSet(object.raw_log) ? String(object.raw_log) : "", + logs: Array.isArray(object?.logs) ? object.logs.map((e: any) => ABCIMessageLog.fromJSON(e)) : [], + info: isSet(object.info) ? String(object.info) : "", + gas_wanted: isSet(object.gas_wanted) ? String(object.gas_wanted) : "0", + gas_used: isSet(object.gas_used) ? String(object.gas_used) : "0", + tx: isSet(object.tx) ? Any.fromJSON(object.tx) : undefined, + timestamp: isSet(object.timestamp) ? String(object.timestamp) : "", + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxResponse): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.txhash !== undefined && (obj.txhash = message.txhash); + message.codespace !== undefined && (obj.codespace = message.codespace); + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && (obj.data = message.data); + message.raw_log !== undefined && (obj.raw_log = message.raw_log); + if (message.logs) { + obj.logs = message.logs.map((e) => e ? ABCIMessageLog.toJSON(e) : undefined); + } else { + obj.logs = []; + } + message.info !== undefined && (obj.info = message.info); + message.gas_wanted !== undefined && (obj.gas_wanted = message.gas_wanted); + message.gas_used !== undefined && (obj.gas_used = message.gas_used); + message.tx !== undefined && (obj.tx = message.tx ? Any.toJSON(message.tx) : undefined); + message.timestamp !== undefined && (obj.timestamp = message.timestamp); + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): TxResponse { + const message = createBaseTxResponse(); + message.height = object.height ?? "0"; + message.txhash = object.txhash ?? ""; + message.codespace = object.codespace ?? ""; + message.code = object.code ?? 0; + message.data = object.data ?? ""; + message.raw_log = object.raw_log ?? ""; + message.logs = object.logs?.map((e) => ABCIMessageLog.fromPartial(e)) || []; + message.info = object.info ?? ""; + message.gas_wanted = object.gas_wanted ?? "0"; + message.gas_used = object.gas_used ?? "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; + }, +}; + +function createBaseABCIMessageLog(): ABCIMessageLog { + return { msg_index: 0, log: "", events: [] }; +} + +export const ABCIMessageLog = { + encode(message: ABCIMessageLog, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg_index !== 0) { + writer.uint32(8).uint32(message.msg_index); + } + 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: _m0.Reader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_index = 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; + }, + + fromJSON(object: any): ABCIMessageLog { + return { + msg_index: isSet(object.msg_index) ? Number(object.msg_index) : 0, + log: isSet(object.log) ? String(object.log) : "", + events: Array.isArray(object?.events) ? object.events.map((e: any) => StringEvent.fromJSON(e)) : [], + }; + }, + + toJSON(message: ABCIMessageLog): unknown { + const obj: any = {}; + message.msg_index !== undefined && (obj.msg_index = Math.round(message.msg_index)); + message.log !== undefined && (obj.log = message.log); + if (message.events) { + obj.events = message.events.map((e) => e ? StringEvent.toJSON(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + message.msg_index = object.msg_index ?? 0; + message.log = object.log ?? ""; + message.events = object.events?.map((e) => StringEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStringEvent(): StringEvent { + return { type: "", attributes: [] }; +} + +export const StringEvent = { + encode(message: StringEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): StringEvent { + return { + type: isSet(object.type) ? String(object.type) : "", + attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [], + }; + }, + + toJSON(message: StringEvent): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + if (message.attributes) { + obj.attributes = message.attributes.map((e) => e ? Attribute.toJSON(e) : undefined); + } else { + obj.attributes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): StringEvent { + const message = createBaseStringEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map((e) => Attribute.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAttribute(): Attribute { + return { key: "", value: "" }; +} + +export const Attribute = { + encode(message: Attribute, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Attribute { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Attribute { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: Attribute): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + fromPartial, I>>(object: I): Attribute { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseGasInfo(): GasInfo { + return { gas_wanted: "0", gas_used: "0" }; +} + +export const GasInfo = { + encode(message: GasInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.gas_wanted !== "0") { + writer.uint32(8).uint64(message.gas_wanted); + } + if (message.gas_used !== "0") { + writer.uint32(16).uint64(message.gas_used); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.gas_wanted = longToString(reader.uint64() as Long); + break; + case 2: + message.gas_used = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GasInfo { + return { + gas_wanted: isSet(object.gas_wanted) ? String(object.gas_wanted) : "0", + gas_used: isSet(object.gas_used) ? String(object.gas_used) : "0", + }; + }, + + toJSON(message: GasInfo): unknown { + const obj: any = {}; + message.gas_wanted !== undefined && (obj.gas_wanted = message.gas_wanted); + message.gas_used !== undefined && (obj.gas_used = message.gas_used); + return obj; + }, + + fromPartial, I>>(object: I): GasInfo { + const message = createBaseGasInfo(); + message.gas_wanted = object.gas_wanted ?? "0"; + message.gas_used = object.gas_used ?? "0"; + return message; + }, +}; + +function createBaseResult(): Result { + return { data: new Uint8Array(), log: "", events: [], msg_responses: [] }; +} + +export const Result = { + encode(message: Result, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.msg_responses) { + Any.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Result { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_responses.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Result { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + msg_responses: Array.isArray(object?.msg_responses) ? object.msg_responses.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: Result): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + if (message.msg_responses) { + obj.msg_responses = message.msg_responses.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.msg_responses = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Result { + const message = createBaseResult(); + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.msg_responses = object.msg_responses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSimulationResponse(): SimulationResponse { + return { gas_info: undefined, result: undefined }; +} + +export const SimulationResponse = { + encode(message: SimulationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.gas_info !== undefined) { + GasInfo.encode(message.gas_info, writer.uint32(10).fork()).ldelim(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.gas_info = GasInfo.decode(reader, reader.uint32()); + break; + case 2: + message.result = Result.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SimulationResponse { + return { + gas_info: isSet(object.gas_info) ? GasInfo.fromJSON(object.gas_info) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulationResponse): unknown { + const obj: any = {}; + message.gas_info !== undefined && (obj.gas_info = message.gas_info ? GasInfo.toJSON(message.gas_info) : undefined); + message.result !== undefined && (obj.result = message.result ? Result.toJSON(message.result) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): SimulationResponse { + const message = createBaseSimulationResponse(); + message.gas_info = (object.gas_info !== undefined && object.gas_info !== null) + ? GasInfo.fromPartial(object.gas_info) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseMsgData(): MsgData { + return { msg_type: "", data: new Uint8Array() }; +} + +export const MsgData = { + encode(message: MsgData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg_type !== "") { + writer.uint32(10).string(message.msg_type); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_type = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgData { + return { + msg_type: isSet(object.msg_type) ? String(object.msg_type) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + }; + }, + + toJSON(message: MsgData): unknown { + const obj: any = {}; + message.msg_type !== undefined && (obj.msg_type = message.msg_type); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): MsgData { + const message = createBaseMsgData(); + message.msg_type = object.msg_type ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; + +function createBaseTxMsgData(): TxMsgData { + return { data: [], msg_responses: [] }; +} + +export const TxMsgData = { + encode(message: TxMsgData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.data) { + MsgData.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.msg_responses) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_responses.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TxMsgData { + return { + data: Array.isArray(object?.data) ? object.data.map((e: any) => MsgData.fromJSON(e)) : [], + msg_responses: Array.isArray(object?.msg_responses) ? object.msg_responses.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxMsgData): unknown { + const obj: any = {}; + if (message.data) { + obj.data = message.data.map((e) => e ? MsgData.toJSON(e) : undefined); + } else { + obj.data = []; + } + if (message.msg_responses) { + obj.msg_responses = message.msg_responses.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.msg_responses = []; + } + return obj; + }, + + fromPartial, I>>(object: I): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map((e) => MsgData.fromPartial(e)) || []; + message.msg_responses = object.msg_responses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchTxsResult(): SearchTxsResult { + return { total_count: "0", count: "0", page_number: "0", page_total: "0", limit: "0", txs: [] }; +} + +export const SearchTxsResult = { + encode(message: SearchTxsResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.total_count !== "0") { + writer.uint32(8).uint64(message.total_count); + } + if (message.count !== "0") { + writer.uint32(16).uint64(message.count); + } + if (message.page_number !== "0") { + writer.uint32(24).uint64(message.page_number); + } + if (message.page_total !== "0") { + writer.uint32(32).uint64(message.page_total); + } + if (message.limit !== "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: _m0.Reader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.total_count = longToString(reader.uint64() as Long); + break; + case 2: + message.count = longToString(reader.uint64() as Long); + break; + case 3: + message.page_number = longToString(reader.uint64() as Long); + break; + case 4: + message.page_total = longToString(reader.uint64() as Long); + break; + case 5: + message.limit = longToString(reader.uint64() as Long); + break; + case 6: + message.txs.push(TxResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SearchTxsResult { + return { + total_count: isSet(object.total_count) ? String(object.total_count) : "0", + count: isSet(object.count) ? String(object.count) : "0", + page_number: isSet(object.page_number) ? String(object.page_number) : "0", + page_total: isSet(object.page_total) ? String(object.page_total) : "0", + limit: isSet(object.limit) ? String(object.limit) : "0", + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => TxResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchTxsResult): unknown { + const obj: any = {}; + message.total_count !== undefined && (obj.total_count = message.total_count); + message.count !== undefined && (obj.count = message.count); + message.page_number !== undefined && (obj.page_number = message.page_number); + message.page_total !== undefined && (obj.page_total = message.page_total); + message.limit !== undefined && (obj.limit = message.limit); + if (message.txs) { + obj.txs = message.txs.map((e) => e ? TxResponse.toJSON(e) : undefined); + } else { + obj.txs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SearchTxsResult { + const message = createBaseSearchTxsResult(); + message.total_count = object.total_count ?? "0"; + message.count = object.count ?? "0"; + message.page_number = object.page_number ?? "0"; + message.page_total = object.page_total ?? "0"; + message.limit = object.limit ?? "0"; + message.txs = object.txs?.map((e) => TxResponse.fromPartial(e)) || []; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/base/kv/v1beta1/kv.ts b/common/types/src/client/cosmos/base/kv/v1beta1/kv.ts new file mode 100644 index 00000000..c9269e4c --- /dev/null +++ b/common/types/src/client/cosmos/base/kv/v1beta1/kv.ts @@ -0,0 +1,185 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.kv.v1beta1"; + +/** Pairs defines a repeated slice of Pair objects. */ +export interface Pairs { + pairs: Pair[]; +} + +/** Pair defines a key/value bytes tuple. */ +export interface Pair { + key: Uint8Array; + value: Uint8Array; +} + +function createBasePairs(): Pairs { + return { pairs: [] }; +} + +export const Pairs = { + encode(message: Pairs, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pairs) { + Pair.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Pairs { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pairs.push(Pair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Pairs { + return { pairs: Array.isArray(object?.pairs) ? object.pairs.map((e: any) => Pair.fromJSON(e)) : [] }; + }, + + toJSON(message: Pairs): unknown { + const obj: any = {}; + if (message.pairs) { + obj.pairs = message.pairs.map((e) => e ? Pair.toJSON(e) : undefined); + } else { + obj.pairs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Pairs { + const message = createBasePairs(); + message.pairs = object.pairs?.map((e) => Pair.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePair(): Pair { + return { key: new Uint8Array(), value: new Uint8Array() }; +} + +export const Pair = { + encode(message: Pair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Pair { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePair(); + 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; + }, + + fromJSON(object: any): Pair { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + }; + }, + + toJSON(message: Pair): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): Pair { + const message = createBasePair(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/base/query/v1beta1/pagination.ts b/common/types/src/client/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..f35cb45d --- /dev/null +++ b/common/types/src/client/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,283 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * 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: 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; +} + +/** + * 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. + */ + next_key: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: string; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(), offset: "0", limit: "0", count_total: false, reverse: false }; +} + +export const PageRequest = { + encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== "0") { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== "0") { + writer.uint32(24).uint64(message.limit); + } + if (message.count_total === true) { + writer.uint32(32).bool(message.count_total); + } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 3: + message.limit = longToString(reader.uint64() as Long); + break; + case 4: + message.count_total = reader.bool(); + break; + case 5: + message.reverse = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + offset: isSet(object.offset) ? String(object.offset) : "0", + limit: isSet(object.limit) ? String(object.limit) : "0", + count_total: isSet(object.count_total) ? Boolean(object.count_total) : false, + reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.offset !== undefined && (obj.offset = message.offset); + message.limit !== undefined && (obj.limit = message.limit); + message.count_total !== undefined && (obj.count_total = message.count_total); + message.reverse !== undefined && (obj.reverse = message.reverse); + return obj; + }, + + fromPartial, I>>(object: I): PageRequest { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(); + message.offset = object.offset ?? "0"; + message.limit = object.limit ?? "0"; + message.count_total = object.count_total ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { next_key: new Uint8Array(), total: "0" }; +} + +export const PageResponse = { + encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.next_key.length !== 0) { + writer.uint32(10).bytes(message.next_key); + } + if (message.total !== "0") { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.next_key = reader.bytes(); + break; + case 2: + message.total = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + next_key: isSet(object.next_key) ? bytesFromBase64(object.next_key) : new Uint8Array(), + total: isSet(object.total) ? String(object.total) : "0", + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + message.next_key !== undefined && + (obj.next_key = base64FromBytes(message.next_key !== undefined ? message.next_key : new Uint8Array())); + message.total !== undefined && (obj.total = message.total); + return obj; + }, + + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.next_key = object.next_key ?? new Uint8Array(); + message.total = object.total ?? "0"; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/base/reflection/v1beta1/reflection.ts b/common/types/src/client/cosmos/base/reflection/v1beta1/reflection.ts new file mode 100644 index 00000000..b9491b68 --- /dev/null +++ b/common/types/src/client/cosmos/base/reflection/v1beta1/reflection.ts @@ -0,0 +1,280 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.reflection.v1beta1"; + +/** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ +export interface ListAllInterfacesRequest { +} + +/** ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. */ +export interface ListAllInterfacesResponse { + /** interface_names is an array of all the registered interfaces. */ + interface_names: string[]; +} + +/** + * ListImplementationsRequest is the request type of the ListImplementations + * RPC. + */ +export interface ListImplementationsRequest { + /** interface_name defines the interface to query the implementations for. */ + interface_name: string; +} + +/** + * ListImplementationsResponse is the response type of the ListImplementations + * RPC. + */ +export interface ListImplementationsResponse { + implementation_message_names: string[]; +} + +function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { + return {}; +} + +export const ListAllInterfacesRequest = { + encode(_: ListAllInterfacesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListAllInterfacesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): ListAllInterfacesRequest { + return {}; + }, + + toJSON(_: ListAllInterfacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): ListAllInterfacesRequest { + const message = createBaseListAllInterfacesRequest(); + return message; + }, +}; + +function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { + return { interface_names: [] }; +} + +export const ListAllInterfacesResponse = { + encode(message: ListAllInterfacesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.interface_names) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListAllInterfacesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.interface_names.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ListAllInterfacesResponse { + return { + interface_names: Array.isArray(object?.interface_names) ? object.interface_names.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: ListAllInterfacesResponse): unknown { + const obj: any = {}; + if (message.interface_names) { + obj.interface_names = message.interface_names.map((e) => e); + } else { + obj.interface_names = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ListAllInterfacesResponse { + const message = createBaseListAllInterfacesResponse(); + message.interface_names = object.interface_names?.map((e) => e) || []; + return message; + }, +}; + +function createBaseListImplementationsRequest(): ListImplementationsRequest { + return { interface_name: "" }; +} + +export const ListImplementationsRequest = { + encode(message: ListImplementationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.interface_name !== "") { + writer.uint32(10).string(message.interface_name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListImplementationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListImplementationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.interface_name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ListImplementationsRequest { + return { interface_name: isSet(object.interface_name) ? String(object.interface_name) : "" }; + }, + + toJSON(message: ListImplementationsRequest): unknown { + const obj: any = {}; + message.interface_name !== undefined && (obj.interface_name = message.interface_name); + return obj; + }, + + fromPartial, I>>(object: I): ListImplementationsRequest { + const message = createBaseListImplementationsRequest(); + message.interface_name = object.interface_name ?? ""; + return message; + }, +}; + +function createBaseListImplementationsResponse(): ListImplementationsResponse { + return { implementation_message_names: [] }; +} + +export const ListImplementationsResponse = { + encode(message: ListImplementationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.implementation_message_names) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListImplementationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListImplementationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.implementation_message_names.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ListImplementationsResponse { + return { + implementation_message_names: Array.isArray(object?.implementation_message_names) + ? object.implementation_message_names.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: ListImplementationsResponse): unknown { + const obj: any = {}; + if (message.implementation_message_names) { + obj.implementation_message_names = message.implementation_message_names.map((e) => e); + } else { + obj.implementation_message_names = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ListImplementationsResponse { + const message = createBaseListImplementationsResponse(); + message.implementation_message_names = object.implementation_message_names?.map((e) => e) || []; + return message; + }, +}; + +/** ReflectionService defines a service for interface reflection. */ +export interface ReflectionService { + /** + * ListAllInterfaces lists all the interfaces registered in the interface + * registry. + */ + ListAllInterfaces(request: ListAllInterfacesRequest): Promise; + /** + * ListImplementations list all the concrete types that implement a given + * interface. + */ + ListImplementations(request: ListImplementationsRequest): Promise; +} + +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.base.reflection.v1beta1.ReflectionService"; + this.rpc = rpc; + this.ListAllInterfaces = this.ListAllInterfaces.bind(this); + this.ListImplementations = this.ListImplementations.bind(this); + } + ListAllInterfaces(request: ListAllInterfacesRequest): Promise { + const data = ListAllInterfacesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListAllInterfaces", data); + return promise.then((data) => ListAllInterfacesResponse.decode(new _m0.Reader(data))); + } + + ListImplementations(request: ListImplementationsRequest): Promise { + const data = ListImplementationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListImplementations", data); + return promise.then((data) => ListImplementationsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/base/reflection/v2alpha1/reflection.ts b/common/types/src/client/cosmos/base/reflection/v2alpha1/reflection.ts new file mode 100644 index 00000000..61d766d8 --- /dev/null +++ b/common/types/src/client/cosmos/base/reflection/v2alpha1/reflection.ts @@ -0,0 +1,1750 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.reflection.v2alpha1"; + +/** Since: cosmos-sdk 0.43 */ + +/** AppDescriptor describes a cosmos-sdk based application */ +export interface AppDescriptor { + /** + * AuthnDescriptor provides information on how to authenticate transactions on the application + * NOTE: experimental and subject to change in future releases. + */ + authn?: AuthnDescriptor; + /** chain provides the chain descriptor */ + chain?: ChainDescriptor; + /** codec provides metadata information regarding codec related types */ + codec?: CodecDescriptor; + /** configuration provides metadata information regarding the sdk.Config type */ + configuration?: ConfigurationDescriptor; + /** query_services provides metadata information regarding the available queriable endpoints */ + query_services?: QueryServicesDescriptor; + /** tx provides metadata information regarding how to send transactions to the given application */ + tx?: TxDescriptor; +} + +/** TxDescriptor describes the accepted transaction type */ +export interface TxDescriptor { + /** + * fullname is the protobuf fullname of the raw transaction type (for instance the tx.Tx type) + * it is not meant to support polymorphism of transaction types, it is supposed to be used by + * reflection clients to understand if they can handle a specific transaction type in an application. + */ + fullname: string; + /** msgs lists the accepted application messages (sdk.Msg) */ + msgs: MsgDescriptor[]; +} + +/** + * AuthnDescriptor provides information on how to sign transactions without relying + * on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures + */ +export interface AuthnDescriptor { + /** sign_modes defines the supported signature algorithm */ + sign_modes: SigningModeDescriptor[]; +} + +/** + * SigningModeDescriptor provides information on a signing flow of the application + * NOTE(fdymylja): here we could go as far as providing an entire flow on how + * to sign a message given a SigningModeDescriptor, but it's better to think about + * this another time + */ +export interface SigningModeDescriptor { + /** name defines the unique name of the signing mode */ + name: string; + /** number is the unique int32 identifier for the sign_mode enum */ + number: number; + /** + * authn_info_provider_method_fullname defines the fullname of the method to call to get + * the metadata required to authenticate using the provided sign_modes + */ + authn_info_provider_method_fullname: string; +} + +/** ChainDescriptor describes chain information of the application */ +export interface ChainDescriptor { + /** id is the chain id */ + id: string; +} + +/** CodecDescriptor describes the registered interfaces and provides metadata information on the types */ +export interface CodecDescriptor { + /** interfaces is a list of the registerted interfaces descriptors */ + interfaces: InterfaceDescriptor[]; +} + +/** InterfaceDescriptor describes the implementation of an interface */ +export interface InterfaceDescriptor { + /** fullname is the name of the interface */ + fullname: string; + /** + * interface_accepting_messages contains information regarding the proto messages which contain the interface as + * google.protobuf.Any field + */ + interface_accepting_messages: InterfaceAcceptingMessageDescriptor[]; + /** interface_implementers is a list of the descriptors of the interface implementers */ + interface_implementers: InterfaceImplementerDescriptor[]; +} + +/** InterfaceImplementerDescriptor describes an interface implementer */ +export interface InterfaceImplementerDescriptor { + /** fullname is the protobuf queryable name of the interface implementer */ + fullname: string; + /** + * type_url defines the type URL used when marshalling the type as any + * this is required so we can provide type safe google.protobuf.Any marshalling and + * unmarshalling, making sure that we don't accept just 'any' type + * in our interface fields + */ + type_url: string; +} + +/** + * InterfaceAcceptingMessageDescriptor describes a protobuf message which contains + * an interface represented as a google.protobuf.Any + */ +export interface InterfaceAcceptingMessageDescriptor { + /** fullname is the protobuf fullname of the type containing the interface */ + fullname: string; + /** + * field_descriptor_names is a list of the protobuf name (not fullname) of the field + * which contains the interface as google.protobuf.Any (the interface is the same, but + * it can be in multiple fields of the same proto message) + */ + field_descriptor_names: string[]; +} + +/** ConfigurationDescriptor contains metadata information on the sdk.Config */ +export interface ConfigurationDescriptor { + /** bech32_account_address_prefix is the account address prefix */ + bech32_account_address_prefix: string; +} + +/** MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction */ +export interface MsgDescriptor { + /** msg_type_url contains the TypeURL of a sdk.Msg. */ + msg_type_url: string; +} + +/** GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC */ +export interface GetAuthnDescriptorRequest { +} + +/** GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC */ +export interface GetAuthnDescriptorResponse { + /** authn describes how to authenticate to the application when sending transactions */ + authn?: AuthnDescriptor; +} + +/** GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC */ +export interface GetChainDescriptorRequest { +} + +/** GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC */ +export interface GetChainDescriptorResponse { + /** chain describes application chain information */ + chain?: ChainDescriptor; +} + +/** GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC */ +export interface GetCodecDescriptorRequest { +} + +/** GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC */ +export interface GetCodecDescriptorResponse { + /** codec describes the application codec such as registered interfaces and implementations */ + codec?: CodecDescriptor; +} + +/** GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC */ +export interface GetConfigurationDescriptorRequest { +} + +/** GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC */ +export interface GetConfigurationDescriptorResponse { + /** config describes the application's sdk.Config */ + config?: ConfigurationDescriptor; +} + +/** GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC */ +export interface GetQueryServicesDescriptorRequest { +} + +/** GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC */ +export interface GetQueryServicesDescriptorResponse { + /** queries provides information on the available queryable services */ + queries?: QueryServicesDescriptor; +} + +/** GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC */ +export interface GetTxDescriptorRequest { +} + +/** GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC */ +export interface GetTxDescriptorResponse { + /** + * tx provides information on msgs that can be forwarded to the application + * alongside the accepted transaction protobuf type + */ + tx?: TxDescriptor; +} + +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptor { + /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + query_services: QueryServiceDescriptor[]; +} + +/** QueryServiceDescriptor describes a cosmos-sdk queryable service */ +export interface QueryServiceDescriptor { + /** fullname is the protobuf fullname of the service descriptor */ + fullname: string; + /** is_module describes if this service is actually exposed by an application's module */ + is_module: boolean; + /** methods provides a list of query service methods */ + methods: QueryMethodDescriptor[]; +} + +/** + * QueryMethodDescriptor describes a queryable method of a query service + * no other info is provided beside method name and tendermint queryable path + * because it would be redundant with the grpc reflection service + */ +export interface QueryMethodDescriptor { + /** name is the protobuf name (not fullname) of the method */ + name: string; + /** + * full_query_path is the path that can be used to query + * this method via tendermint abci.Query + */ + full_query_path: string; +} + +function createBaseAppDescriptor(): AppDescriptor { + return { + authn: undefined, + chain: undefined, + codec: undefined, + configuration: undefined, + query_services: undefined, + tx: undefined, + }; +} + +export const AppDescriptor = { + encode(message: AppDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); + } + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(18).fork()).ldelim(); + } + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(26).fork()).ldelim(); + } + if (message.configuration !== undefined) { + ConfigurationDescriptor.encode(message.configuration, writer.uint32(34).fork()).ldelim(); + } + if (message.query_services !== undefined) { + QueryServicesDescriptor.encode(message.query_services, writer.uint32(42).fork()).ldelim(); + } + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AppDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + break; + case 2: + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + break; + case 3: + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + break; + case 4: + message.configuration = ConfigurationDescriptor.decode(reader, reader.uint32()); + break; + case 5: + message.query_services = QueryServicesDescriptor.decode(reader, reader.uint32()); + break; + case 6: + message.tx = TxDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AppDescriptor { + return { + authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined, + chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined, + codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined, + configuration: isSet(object.configuration) ? ConfigurationDescriptor.fromJSON(object.configuration) : undefined, + query_services: isSet(object.query_services) + ? QueryServicesDescriptor.fromJSON(object.query_services) + : undefined, + tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined, + }; + }, + + toJSON(message: AppDescriptor): unknown { + const obj: any = {}; + message.authn !== undefined && (obj.authn = message.authn ? AuthnDescriptor.toJSON(message.authn) : undefined); + message.chain !== undefined && (obj.chain = message.chain ? ChainDescriptor.toJSON(message.chain) : undefined); + message.codec !== undefined && (obj.codec = message.codec ? CodecDescriptor.toJSON(message.codec) : undefined); + message.configuration !== undefined && + (obj.configuration = message.configuration ? ConfigurationDescriptor.toJSON(message.configuration) : undefined); + message.query_services !== undefined && + (obj.query_services = message.query_services + ? QueryServicesDescriptor.toJSON(message.query_services) + : undefined); + message.tx !== undefined && (obj.tx = message.tx ? TxDescriptor.toJSON(message.tx) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): AppDescriptor { + const message = createBaseAppDescriptor(); + message.authn = (object.authn !== undefined && object.authn !== null) + ? AuthnDescriptor.fromPartial(object.authn) + : undefined; + message.chain = (object.chain !== undefined && object.chain !== null) + ? ChainDescriptor.fromPartial(object.chain) + : undefined; + message.codec = (object.codec !== undefined && object.codec !== null) + ? CodecDescriptor.fromPartial(object.codec) + : undefined; + message.configuration = (object.configuration !== undefined && object.configuration !== null) + ? ConfigurationDescriptor.fromPartial(object.configuration) + : undefined; + message.query_services = (object.query_services !== undefined && object.query_services !== null) + ? QueryServicesDescriptor.fromPartial(object.query_services) + : undefined; + message.tx = (object.tx !== undefined && object.tx !== null) ? TxDescriptor.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxDescriptor(): TxDescriptor { + return { fullname: "", msgs: [] }; +} + +export const TxDescriptor = { + encode(message: TxDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.msgs) { + MsgDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullname = reader.string(); + break; + case 2: + message.msgs.push(MsgDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TxDescriptor { + return { + fullname: isSet(object.fullname) ? String(object.fullname) : "", + msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => MsgDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxDescriptor): unknown { + const obj: any = {}; + message.fullname !== undefined && (obj.fullname = message.fullname); + if (message.msgs) { + obj.msgs = message.msgs.map((e) => e ? MsgDescriptor.toJSON(e) : undefined); + } else { + obj.msgs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): TxDescriptor { + const message = createBaseTxDescriptor(); + message.fullname = object.fullname ?? ""; + message.msgs = object.msgs?.map((e) => MsgDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAuthnDescriptor(): AuthnDescriptor { + return { sign_modes: [] }; +} + +export const AuthnDescriptor = { + encode(message: AuthnDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.sign_modes) { + SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AuthnDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthnDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sign_modes.push(SigningModeDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AuthnDescriptor { + return { + sign_modes: Array.isArray(object?.sign_modes) + ? object.sign_modes.map((e: any) => SigningModeDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AuthnDescriptor): unknown { + const obj: any = {}; + if (message.sign_modes) { + obj.sign_modes = message.sign_modes.map((e) => e ? SigningModeDescriptor.toJSON(e) : undefined); + } else { + obj.sign_modes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.sign_modes = object.sign_modes?.map((e) => SigningModeDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningModeDescriptor(): SigningModeDescriptor { + return { name: "", number: 0, authn_info_provider_method_fullname: "" }; +} + +export const SigningModeDescriptor = { + encode(message: SigningModeDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.authn_info_provider_method_fullname !== "") { + writer.uint32(26).string(message.authn_info_provider_method_fullname); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SigningModeDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSigningModeDescriptor(); + 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.authn_info_provider_method_fullname = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SigningModeDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + authn_info_provider_method_fullname: isSet(object.authn_info_provider_method_fullname) + ? String(object.authn_info_provider_method_fullname) + : "", + }; + }, + + toJSON(message: SigningModeDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.authn_info_provider_method_fullname !== undefined && + (obj.authn_info_provider_method_fullname = message.authn_info_provider_method_fullname); + return obj; + }, + + fromPartial, I>>(object: I): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.authn_info_provider_method_fullname = object.authn_info_provider_method_fullname ?? ""; + return message; + }, +}; + +function createBaseChainDescriptor(): ChainDescriptor { + return { id: "" }; +} + +export const ChainDescriptor = { + encode(message: ChainDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ChainDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChainDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ChainDescriptor { + return { id: isSet(object.id) ? String(object.id) : "" }; + }, + + toJSON(message: ChainDescriptor): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): ChainDescriptor { + const message = createBaseChainDescriptor(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseCodecDescriptor(): CodecDescriptor { + return { interfaces: [] }; +} + +export const CodecDescriptor = { + encode(message: CodecDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.interfaces) { + InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CodecDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodecDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.interfaces.push(InterfaceDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CodecDescriptor { + return { + interfaces: Array.isArray(object?.interfaces) + ? object.interfaces.map((e: any) => InterfaceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: CodecDescriptor): unknown { + const obj: any = {}; + if (message.interfaces) { + obj.interfaces = message.interfaces.map((e) => e ? InterfaceDescriptor.toJSON(e) : undefined); + } else { + obj.interfaces = []; + } + return obj; + }, + + fromPartial, I>>(object: I): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map((e) => InterfaceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { fullname: "", interface_accepting_messages: [], interface_implementers: [] }; +} + +export const InterfaceDescriptor = { + encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.interface_accepting_messages) { + InterfaceAcceptingMessageDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.interface_implementers) { + InterfaceImplementerDescriptor.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.fullname = reader.string(); + break; + case 2: + message.interface_accepting_messages.push( + InterfaceAcceptingMessageDescriptor.decode(reader, reader.uint32()), + ); + break; + case 3: + message.interface_implementers.push(InterfaceImplementerDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + fullname: isSet(object.fullname) ? String(object.fullname) : "", + interface_accepting_messages: Array.isArray(object?.interface_accepting_messages) + ? object.interface_accepting_messages.map((e: any) => InterfaceAcceptingMessageDescriptor.fromJSON(e)) + : [], + interface_implementers: Array.isArray(object?.interface_implementers) + ? object.interface_implementers.map((e: any) => InterfaceImplementerDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + message.fullname !== undefined && (obj.fullname = message.fullname); + if (message.interface_accepting_messages) { + obj.interface_accepting_messages = message.interface_accepting_messages.map((e) => + e ? InterfaceAcceptingMessageDescriptor.toJSON(e) : undefined + ); + } else { + obj.interface_accepting_messages = []; + } + if (message.interface_implementers) { + obj.interface_implementers = message.interface_implementers.map((e) => + e ? InterfaceImplementerDescriptor.toJSON(e) : undefined + ); + } else { + obj.interface_implementers = []; + } + return obj; + }, + + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.fullname = object.fullname ?? ""; + message.interface_accepting_messages = + object.interface_accepting_messages?.map((e) => InterfaceAcceptingMessageDescriptor.fromPartial(e)) || []; + message.interface_implementers = + object.interface_implementers?.map((e) => InterfaceImplementerDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { + return { fullname: "", type_url: "" }; +} + +export const InterfaceImplementerDescriptor = { + encode(message: InterfaceImplementerDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.type_url !== "") { + writer.uint32(18).string(message.type_url); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceImplementerDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceImplementerDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullname = reader.string(); + break; + case 2: + message.type_url = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): InterfaceImplementerDescriptor { + return { + fullname: isSet(object.fullname) ? String(object.fullname) : "", + type_url: isSet(object.type_url) ? String(object.type_url) : "", + }; + }, + + toJSON(message: InterfaceImplementerDescriptor): unknown { + const obj: any = {}; + message.fullname !== undefined && (obj.fullname = message.fullname); + message.type_url !== undefined && (obj.type_url = message.type_url); + return obj; + }, + + fromPartial, I>>( + object: I, + ): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + message.fullname = object.fullname ?? ""; + message.type_url = object.type_url ?? ""; + return message; + }, +}; + +function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { + return { fullname: "", field_descriptor_names: [] }; +} + +export const InterfaceAcceptingMessageDescriptor = { + encode(message: InterfaceAcceptingMessageDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.field_descriptor_names) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceAcceptingMessageDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullname = reader.string(); + break; + case 2: + message.field_descriptor_names.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): InterfaceAcceptingMessageDescriptor { + return { + fullname: isSet(object.fullname) ? String(object.fullname) : "", + field_descriptor_names: Array.isArray(object?.field_descriptor_names) + ? object.field_descriptor_names.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: InterfaceAcceptingMessageDescriptor): unknown { + const obj: any = {}; + message.fullname !== undefined && (obj.fullname = message.fullname); + if (message.field_descriptor_names) { + obj.field_descriptor_names = message.field_descriptor_names.map((e) => e); + } else { + obj.field_descriptor_names = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + message.fullname = object.fullname ?? ""; + message.field_descriptor_names = object.field_descriptor_names?.map((e) => e) || []; + return message; + }, +}; + +function createBaseConfigurationDescriptor(): ConfigurationDescriptor { + return { bech32_account_address_prefix: "" }; +} + +export const ConfigurationDescriptor = { + encode(message: ConfigurationDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bech32_account_address_prefix !== "") { + writer.uint32(10).string(message.bech32_account_address_prefix); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConfigurationDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigurationDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bech32_account_address_prefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ConfigurationDescriptor { + return { + bech32_account_address_prefix: isSet(object.bech32_account_address_prefix) + ? String(object.bech32_account_address_prefix) + : "", + }; + }, + + toJSON(message: ConfigurationDescriptor): unknown { + const obj: any = {}; + message.bech32_account_address_prefix !== undefined && + (obj.bech32_account_address_prefix = message.bech32_account_address_prefix); + return obj; + }, + + fromPartial, I>>(object: I): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + message.bech32_account_address_prefix = object.bech32_account_address_prefix ?? ""; + return message; + }, +}; + +function createBaseMsgDescriptor(): MsgDescriptor { + return { msg_type_url: "" }; +} + +export const MsgDescriptor = { + encode(message: MsgDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg_type_url !== "") { + writer.uint32(10).string(message.msg_type_url); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msg_type_url = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDescriptor { + return { msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "" }; + }, + + toJSON(message: MsgDescriptor): unknown { + const obj: any = {}; + message.msg_type_url !== undefined && (obj.msg_type_url = message.msg_type_url); + return obj; + }, + + fromPartial, I>>(object: I): MsgDescriptor { + const message = createBaseMsgDescriptor(); + message.msg_type_url = object.msg_type_url ?? ""; + return message; + }, +}; + +function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { + return {}; +} + +export const GetAuthnDescriptorRequest = { + encode(_: GetAuthnDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthnDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetAuthnDescriptorRequest { + return {}; + }, + + toJSON(_: GetAuthnDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, +}; + +function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { + return { authn: undefined }; +} + +export const GetAuthnDescriptorResponse = { + encode(message: GetAuthnDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthnDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetAuthnDescriptorResponse { + return { authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined }; + }, + + toJSON(message: GetAuthnDescriptorResponse): unknown { + const obj: any = {}; + message.authn !== undefined && (obj.authn = message.authn ? AuthnDescriptor.toJSON(message.authn) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetAuthnDescriptorResponse { + const message = createBaseGetAuthnDescriptorResponse(); + message.authn = (object.authn !== undefined && object.authn !== null) + ? AuthnDescriptor.fromPartial(object.authn) + : undefined; + return message; + }, +}; + +function createBaseGetChainDescriptorRequest(): GetChainDescriptorRequest { + return {}; +} + +export const GetChainDescriptorRequest = { + encode(_: GetChainDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetChainDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetChainDescriptorRequest { + return {}; + }, + + toJSON(_: GetChainDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, +}; + +function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { + return { chain: undefined }; +} + +export const GetChainDescriptorResponse = { + encode(message: GetChainDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetChainDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetChainDescriptorResponse { + return { chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined }; + }, + + toJSON(message: GetChainDescriptorResponse): unknown { + const obj: any = {}; + message.chain !== undefined && (obj.chain = message.chain ? ChainDescriptor.toJSON(message.chain) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetChainDescriptorResponse { + const message = createBaseGetChainDescriptorResponse(); + message.chain = (object.chain !== undefined && object.chain !== null) + ? ChainDescriptor.fromPartial(object.chain) + : undefined; + return message; + }, +}; + +function createBaseGetCodecDescriptorRequest(): GetCodecDescriptorRequest { + return {}; +} + +export const GetCodecDescriptorRequest = { + encode(_: GetCodecDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetCodecDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetCodecDescriptorRequest { + return {}; + }, + + toJSON(_: GetCodecDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, +}; + +function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { + return { codec: undefined }; +} + +export const GetCodecDescriptorResponse = { + encode(message: GetCodecDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetCodecDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetCodecDescriptorResponse { + return { codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined }; + }, + + toJSON(message: GetCodecDescriptorResponse): unknown { + const obj: any = {}; + message.codec !== undefined && (obj.codec = message.codec ? CodecDescriptor.toJSON(message.codec) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetCodecDescriptorResponse { + const message = createBaseGetCodecDescriptorResponse(); + message.codec = (object.codec !== undefined && object.codec !== null) + ? CodecDescriptor.fromPartial(object.codec) + : undefined; + return message; + }, +}; + +function createBaseGetConfigurationDescriptorRequest(): GetConfigurationDescriptorRequest { + return {}; +} + +export const GetConfigurationDescriptorRequest = { + encode(_: GetConfigurationDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetConfigurationDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetConfigurationDescriptorRequest { + return {}; + }, + + toJSON(_: GetConfigurationDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, +}; + +function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { + return { config: undefined }; +} + +export const GetConfigurationDescriptorResponse = { + encode(message: GetConfigurationDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.config !== undefined) { + ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetConfigurationDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.config = ConfigurationDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetConfigurationDescriptorResponse { + return { config: isSet(object.config) ? ConfigurationDescriptor.fromJSON(object.config) : undefined }; + }, + + toJSON(message: GetConfigurationDescriptorResponse): unknown { + const obj: any = {}; + message.config !== undefined && + (obj.config = message.config ? ConfigurationDescriptor.toJSON(message.config) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): GetConfigurationDescriptorResponse { + const message = createBaseGetConfigurationDescriptorResponse(); + message.config = (object.config !== undefined && object.config !== null) + ? ConfigurationDescriptor.fromPartial(object.config) + : undefined; + return message; + }, +}; + +function createBaseGetQueryServicesDescriptorRequest(): GetQueryServicesDescriptorRequest { + return {}; +} + +export const GetQueryServicesDescriptorRequest = { + encode(_: GetQueryServicesDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetQueryServicesDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetQueryServicesDescriptorRequest { + return {}; + }, + + toJSON(_: GetQueryServicesDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, +}; + +function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { + return { queries: undefined }; +} + +export const GetQueryServicesDescriptorResponse = { + encode(message: GetQueryServicesDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.queries !== undefined) { + QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetQueryServicesDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.queries = QueryServicesDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetQueryServicesDescriptorResponse { + return { queries: isSet(object.queries) ? QueryServicesDescriptor.fromJSON(object.queries) : undefined }; + }, + + toJSON(message: GetQueryServicesDescriptorResponse): unknown { + const obj: any = {}; + message.queries !== undefined && + (obj.queries = message.queries ? QueryServicesDescriptor.toJSON(message.queries) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): GetQueryServicesDescriptorResponse { + const message = createBaseGetQueryServicesDescriptorResponse(); + message.queries = (object.queries !== undefined && object.queries !== null) + ? QueryServicesDescriptor.fromPartial(object.queries) + : undefined; + return message; + }, +}; + +function createBaseGetTxDescriptorRequest(): GetTxDescriptorRequest { + return {}; +} + +export const GetTxDescriptorRequest = { + encode(_: GetTxDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetTxDescriptorRequest { + return {}; + }, + + toJSON(_: GetTxDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, +}; + +function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { + return { tx: undefined }; +} + +export const GetTxDescriptorResponse = { + encode(message: GetTxDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = TxDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetTxDescriptorResponse { + return { tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: GetTxDescriptorResponse): unknown { + const obj: any = {}; + message.tx !== undefined && (obj.tx = message.tx ? TxDescriptor.toJSON(message.tx) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetTxDescriptorResponse { + const message = createBaseGetTxDescriptorResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? TxDescriptor.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseQueryServicesDescriptor(): QueryServicesDescriptor { + return { query_services: [] }; +} + +export const QueryServicesDescriptor = { + encode(message: QueryServicesDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.query_services) { + QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryServicesDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryServicesDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.query_services.push(QueryServiceDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryServicesDescriptor { + return { + query_services: Array.isArray(object?.query_services) + ? object.query_services.map((e: any) => QueryServiceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServicesDescriptor): unknown { + const obj: any = {}; + if (message.query_services) { + obj.query_services = message.query_services.map((e) => e ? QueryServiceDescriptor.toJSON(e) : undefined); + } else { + obj.query_services = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.query_services = object.query_services?.map((e) => QueryServiceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { + return { fullname: "", is_module: false, methods: [] }; +} + +export const QueryServiceDescriptor = { + encode(message: QueryServiceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.is_module === true) { + writer.uint32(16).bool(message.is_module); + } + for (const v of message.methods) { + QueryMethodDescriptor.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryServiceDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryServiceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullname = reader.string(); + break; + case 2: + message.is_module = reader.bool(); + break; + case 3: + message.methods.push(QueryMethodDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryServiceDescriptor { + return { + fullname: isSet(object.fullname) ? String(object.fullname) : "", + is_module: isSet(object.is_module) ? Boolean(object.is_module) : false, + methods: Array.isArray(object?.methods) ? object.methods.map((e: any) => QueryMethodDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryServiceDescriptor): unknown { + const obj: any = {}; + message.fullname !== undefined && (obj.fullname = message.fullname); + message.is_module !== undefined && (obj.is_module = message.is_module); + if (message.methods) { + obj.methods = message.methods.map((e) => e ? QueryMethodDescriptor.toJSON(e) : undefined); + } else { + obj.methods = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + message.fullname = object.fullname ?? ""; + message.is_module = object.is_module ?? false; + message.methods = object.methods?.map((e) => QueryMethodDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { + return { name: "", full_query_path: "" }; +} + +export const QueryMethodDescriptor = { + encode(message: QueryMethodDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.full_query_path !== "") { + writer.uint32(18).string(message.full_query_path); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryMethodDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMethodDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.full_query_path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryMethodDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + full_query_path: isSet(object.full_query_path) ? String(object.full_query_path) : "", + }; + }, + + toJSON(message: QueryMethodDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.full_query_path !== undefined && (obj.full_query_path = message.full_query_path); + return obj; + }, + + fromPartial, I>>(object: I): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + message.name = object.name ?? ""; + message.full_query_path = object.full_query_path ?? ""; + return message; + }, +}; + +/** ReflectionService defines a service for application reflection. */ +export interface ReflectionService { + /** + * GetAuthnDescriptor returns information on how to authenticate transactions in the application + * NOTE: this RPC is still experimental and might be subject to breaking changes or removal in + * future releases of the cosmos-sdk. + */ + GetAuthnDescriptor(request: GetAuthnDescriptorRequest): Promise; + /** GetChainDescriptor returns the description of the chain */ + GetChainDescriptor(request: GetChainDescriptorRequest): Promise; + /** GetCodecDescriptor returns the descriptor of the codec of the application */ + GetCodecDescriptor(request: GetCodecDescriptorRequest): Promise; + /** GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application */ + GetConfigurationDescriptor(request: GetConfigurationDescriptorRequest): Promise; + /** GetQueryServicesDescriptor returns the available gRPC queryable services of the application */ + GetQueryServicesDescriptor(request: GetQueryServicesDescriptorRequest): Promise; + /** GetTxDescriptor returns information on the used transaction object and available msgs that can be used */ + GetTxDescriptor(request: GetTxDescriptorRequest): Promise; +} + +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.base.reflection.v2alpha1.ReflectionService"; + this.rpc = rpc; + this.GetAuthnDescriptor = this.GetAuthnDescriptor.bind(this); + this.GetChainDescriptor = this.GetChainDescriptor.bind(this); + this.GetCodecDescriptor = this.GetCodecDescriptor.bind(this); + this.GetConfigurationDescriptor = this.GetConfigurationDescriptor.bind(this); + this.GetQueryServicesDescriptor = this.GetQueryServicesDescriptor.bind(this); + this.GetTxDescriptor = this.GetTxDescriptor.bind(this); + } + GetAuthnDescriptor(request: GetAuthnDescriptorRequest): Promise { + const data = GetAuthnDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetAuthnDescriptor", data); + return promise.then((data) => GetAuthnDescriptorResponse.decode(new _m0.Reader(data))); + } + + GetChainDescriptor(request: GetChainDescriptorRequest): Promise { + const data = GetChainDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetChainDescriptor", data); + return promise.then((data) => GetChainDescriptorResponse.decode(new _m0.Reader(data))); + } + + GetCodecDescriptor(request: GetCodecDescriptorRequest): Promise { + const data = GetCodecDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetCodecDescriptor", data); + return promise.then((data) => GetCodecDescriptorResponse.decode(new _m0.Reader(data))); + } + + GetConfigurationDescriptor(request: GetConfigurationDescriptorRequest): Promise { + const data = GetConfigurationDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetConfigurationDescriptor", data); + return promise.then((data) => GetConfigurationDescriptorResponse.decode(new _m0.Reader(data))); + } + + GetQueryServicesDescriptor(request: GetQueryServicesDescriptorRequest): Promise { + const data = GetQueryServicesDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetQueryServicesDescriptor", data); + return promise.then((data) => GetQueryServicesDescriptorResponse.decode(new _m0.Reader(data))); + } + + GetTxDescriptor(request: GetTxDescriptorRequest): Promise { + const data = GetTxDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetTxDescriptor", data); + return promise.then((data) => GetTxDescriptorResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/base/snapshots/v1beta1/snapshot.ts b/common/types/src/client/cosmos/base/snapshots/v1beta1/snapshot.ts new file mode 100644 index 00000000..236000e2 --- /dev/null +++ b/common/types/src/client/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -0,0 +1,734 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.snapshots.v1beta1"; + +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface Snapshot { + height: string; + format: number; + chunks: number; + hash: Uint8Array; + metadata?: Metadata; +} + +/** Metadata contains SDK-specific snapshot metadata. */ +export interface Metadata { + /** SHA-256 chunk hashes */ + chunk_hashes: Uint8Array[]; +} + +/** SnapshotItem is an item contained in a rootmulti.Store snapshot. */ +export interface SnapshotItem { + store?: SnapshotStoreItem | undefined; + iavl?: SnapshotIAVLItem | undefined; + extension?: SnapshotExtensionMeta | undefined; + extension_payload?: SnapshotExtensionPayload | undefined; + kv?: SnapshotKVItem | undefined; + schema?: SnapshotSchema | undefined; +} + +/** SnapshotStoreItem contains metadata about a snapshotted store. */ +export interface SnapshotStoreItem { + name: string; +} + +/** SnapshotIAVLItem is an exported IAVL node. */ +export interface SnapshotIAVLItem { + key: Uint8Array; + value: Uint8Array; + /** version is block height */ + version: string; + /** height is depth of the tree. */ + height: number; +} + +/** SnapshotExtensionMeta contains metadata about an external snapshotter. */ +export interface SnapshotExtensionMeta { + name: string; + format: number; +} + +/** SnapshotExtensionPayload contains payloads of an external snapshotter. */ +export interface SnapshotExtensionPayload { + payload: Uint8Array; +} + +/** SnapshotKVItem is an exported Key/Value Pair */ +export interface SnapshotKVItem { + key: Uint8Array; + value: Uint8Array; +} + +/** SnapshotSchema is an exported schema of smt store */ +export interface SnapshotSchema { + keys: Uint8Array[]; +} + +function createBaseSnapshot(): Snapshot { + return { height: "0", format: 0, chunks: 0, hash: new Uint8Array(), metadata: undefined }; +} + +export const Snapshot = { + encode(message: Snapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "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 !== undefined) { + Metadata.encode(message.metadata, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + 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 = Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? String(object.height) : "0", + format: isSet(object.format) ? Number(object.format) : 0, + chunks: isSet(object.chunks) ? Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunks !== undefined && (obj.chunks = Math.round(message.chunks)); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.metadata !== undefined && (obj.metadata = message.metadata ? Metadata.toJSON(message.metadata) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Snapshot { + const message = createBaseSnapshot(); + message.height = object.height ?? "0"; + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseMetadata(): Metadata { + return { chunk_hashes: [] }; +} + +export const Metadata = { + encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.chunk_hashes) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Metadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.chunk_hashes.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + chunk_hashes: Array.isArray(object?.chunk_hashes) ? object.chunk_hashes.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.chunk_hashes) { + obj.chunk_hashes = message.chunk_hashes.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.chunk_hashes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.chunk_hashes = object.chunk_hashes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSnapshotItem(): SnapshotItem { + return { + store: undefined, + iavl: undefined, + extension: undefined, + extension_payload: undefined, + kv: undefined, + schema: undefined, + }; +} + +export const SnapshotItem = { + encode(message: SnapshotItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.store !== undefined) { + SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).ldelim(); + } + if (message.iavl !== undefined) { + SnapshotIAVLItem.encode(message.iavl, writer.uint32(18).fork()).ldelim(); + } + if (message.extension !== undefined) { + SnapshotExtensionMeta.encode(message.extension, writer.uint32(26).fork()).ldelim(); + } + if (message.extension_payload !== undefined) { + SnapshotExtensionPayload.encode(message.extension_payload, writer.uint32(34).fork()).ldelim(); + } + if (message.kv !== undefined) { + SnapshotKVItem.encode(message.kv, writer.uint32(42).fork()).ldelim(); + } + if (message.schema !== undefined) { + SnapshotSchema.encode(message.schema, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotItem { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.store = SnapshotStoreItem.decode(reader, reader.uint32()); + break; + case 2: + message.iavl = SnapshotIAVLItem.decode(reader, reader.uint32()); + break; + case 3: + message.extension = SnapshotExtensionMeta.decode(reader, reader.uint32()); + break; + case 4: + message.extension_payload = SnapshotExtensionPayload.decode(reader, reader.uint32()); + break; + case 5: + message.kv = SnapshotKVItem.decode(reader, reader.uint32()); + break; + case 6: + message.schema = SnapshotSchema.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SnapshotItem { + return { + store: isSet(object.store) ? SnapshotStoreItem.fromJSON(object.store) : undefined, + iavl: isSet(object.iavl) ? SnapshotIAVLItem.fromJSON(object.iavl) : undefined, + extension: isSet(object.extension) ? SnapshotExtensionMeta.fromJSON(object.extension) : undefined, + extension_payload: isSet(object.extension_payload) + ? SnapshotExtensionPayload.fromJSON(object.extension_payload) + : undefined, + kv: isSet(object.kv) ? SnapshotKVItem.fromJSON(object.kv) : undefined, + schema: isSet(object.schema) ? SnapshotSchema.fromJSON(object.schema) : undefined, + }; + }, + + toJSON(message: SnapshotItem): unknown { + const obj: any = {}; + message.store !== undefined && (obj.store = message.store ? SnapshotStoreItem.toJSON(message.store) : undefined); + message.iavl !== undefined && (obj.iavl = message.iavl ? SnapshotIAVLItem.toJSON(message.iavl) : undefined); + message.extension !== undefined && + (obj.extension = message.extension ? SnapshotExtensionMeta.toJSON(message.extension) : undefined); + message.extension_payload !== undefined && (obj.extension_payload = message.extension_payload + ? SnapshotExtensionPayload.toJSON(message.extension_payload) + : undefined); + message.kv !== undefined && (obj.kv = message.kv ? SnapshotKVItem.toJSON(message.kv) : undefined); + message.schema !== undefined && (obj.schema = message.schema ? SnapshotSchema.toJSON(message.schema) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotItem { + const message = createBaseSnapshotItem(); + message.store = (object.store !== undefined && object.store !== null) + ? SnapshotStoreItem.fromPartial(object.store) + : undefined; + message.iavl = (object.iavl !== undefined && object.iavl !== null) + ? SnapshotIAVLItem.fromPartial(object.iavl) + : undefined; + message.extension = (object.extension !== undefined && object.extension !== null) + ? SnapshotExtensionMeta.fromPartial(object.extension) + : undefined; + message.extension_payload = (object.extension_payload !== undefined && object.extension_payload !== null) + ? SnapshotExtensionPayload.fromPartial(object.extension_payload) + : undefined; + message.kv = (object.kv !== undefined && object.kv !== null) ? SnapshotKVItem.fromPartial(object.kv) : undefined; + message.schema = (object.schema !== undefined && object.schema !== null) + ? SnapshotSchema.fromPartial(object.schema) + : undefined; + return message; + }, +}; + +function createBaseSnapshotStoreItem(): SnapshotStoreItem { + return { name: "" }; +} + +export const SnapshotStoreItem = { + encode(message: SnapshotStoreItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotStoreItem { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotStoreItem(); + 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; + }, + + fromJSON(object: any): SnapshotStoreItem { + return { name: isSet(object.name) ? String(object.name) : "" }; + }, + + toJSON(message: SnapshotStoreItem): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { + return { key: new Uint8Array(), value: new Uint8Array(), version: "0", height: 0 }; +} + +export const SnapshotIAVLItem = { + encode(message: SnapshotIAVLItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.version !== "0") { + writer.uint32(24).int64(message.version); + } + if (message.height !== 0) { + writer.uint32(32).int32(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotIAVLItem { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotIAVLItem(); + 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.version = longToString(reader.int64() as Long); + break; + case 4: + message.height = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SnapshotIAVLItem { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + version: isSet(object.version) ? String(object.version) : "0", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: SnapshotIAVLItem): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.version !== undefined && (obj.version = message.version); + message.height !== undefined && (obj.height = Math.round(message.height)); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.version = object.version ?? "0"; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { + return { name: "", format: 0 }; +} + +export const SnapshotExtensionMeta = { + encode(message: SnapshotExtensionMeta, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotExtensionMeta { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotExtensionMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.format = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionMeta { + return { + name: isSet(object.name) ? String(object.name) : "", + format: isSet(object.format) ? Number(object.format) : 0, + }; + }, + + toJSON(message: SnapshotExtensionMeta): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.format !== undefined && (obj.format = Math.round(message.format)); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotExtensionMeta { + const message = createBaseSnapshotExtensionMeta(); + message.name = object.name ?? ""; + message.format = object.format ?? 0; + return message; + }, +}; + +function createBaseSnapshotExtensionPayload(): SnapshotExtensionPayload { + return { payload: new Uint8Array() }; +} + +export const SnapshotExtensionPayload = { + encode(message: SnapshotExtensionPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotExtensionPayload { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotExtensionPayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.payload = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionPayload { + return { payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array() }; + }, + + toJSON(message: SnapshotExtensionPayload): unknown { + const obj: any = {}; + message.payload !== undefined && + (obj.payload = base64FromBytes(message.payload !== undefined ? message.payload : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + message.payload = object.payload ?? new Uint8Array(); + return message; + }, +}; + +function createBaseSnapshotKVItem(): SnapshotKVItem { + return { key: new Uint8Array(), value: new Uint8Array() }; +} + +export const SnapshotKVItem = { + encode(message: SnapshotKVItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SnapshotKVItem { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotKVItem(); + 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; + }, + + fromJSON(object: any): SnapshotKVItem { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + }; + }, + + toJSON(message: SnapshotKVItem): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotKVItem { + const message = createBaseSnapshotKVItem(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; + +function createBaseSnapshotSchema(): SnapshotSchema { + return { keys: [] }; +} + +export const SnapshotSchema = { + encode(message: SnapshotSchema, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.keys) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotSchema { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keys.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SnapshotSchema { + return { keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: SnapshotSchema): unknown { + const obj: any = {}; + if (message.keys) { + obj.keys = message.keys.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.keys = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SnapshotSchema { + const message = createBaseSnapshotSchema(); + message.keys = object.keys?.map((e) => e) || []; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/base/store/v1beta1/commit_info.ts b/common/types/src/client/cosmos/base/store/v1beta1/commit_info.ts new file mode 100644 index 00000000..fad7da54 --- /dev/null +++ b/common/types/src/client/cosmos/base/store/v1beta1/commit_info.ts @@ -0,0 +1,282 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.store.v1beta1"; + +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfo { + version: string; + store_infos: StoreInfo[]; +} + +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfo { + name: string; + commit_id?: CommitID; +} + +/** + * CommitID defines the committment information when a specific store is + * committed. + */ +export interface CommitID { + version: string; + hash: Uint8Array; +} + +function createBaseCommitInfo(): CommitInfo { + return { version: "0", store_infos: [] }; +} + +export const CommitInfo = { + encode(message: CommitInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "0") { + writer.uint32(8).int64(message.version); + } + for (const v of message.store_infos) { + StoreInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.version = longToString(reader.int64() as Long); + break; + case 2: + message.store_infos.push(StoreInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + version: isSet(object.version) ? String(object.version) : "0", + store_infos: Array.isArray(object?.store_infos) ? object.store_infos.map((e: any) => StoreInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + if (message.store_infos) { + obj.store_infos = message.store_infos.map((e) => e ? StoreInfo.toJSON(e) : undefined); + } else { + obj.store_infos = []; + } + return obj; + }, + + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.version = object.version ?? "0"; + message.store_infos = object.store_infos?.map((e) => StoreInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStoreInfo(): StoreInfo { + return { name: "", commit_id: undefined }; +} + +export const StoreInfo = { + encode(message: StoreInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.commit_id !== undefined) { + CommitID.encode(message.commit_id, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StoreInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.commit_id = CommitID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StoreInfo { + return { + name: isSet(object.name) ? String(object.name) : "", + commit_id: isSet(object.commit_id) ? CommitID.fromJSON(object.commit_id) : undefined, + }; + }, + + toJSON(message: StoreInfo): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.commit_id !== undefined && + (obj.commit_id = message.commit_id ? CommitID.toJSON(message.commit_id) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): StoreInfo { + const message = createBaseStoreInfo(); + message.name = object.name ?? ""; + message.commit_id = (object.commit_id !== undefined && object.commit_id !== null) + ? CommitID.fromPartial(object.commit_id) + : undefined; + return message; + }, +}; + +function createBaseCommitID(): CommitID { + return { version: "0", hash: new Uint8Array() }; +} + +export const CommitID = { + encode(message: CommitID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "0") { + writer.uint32(8).int64(message.version); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommitID { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = longToString(reader.int64() as Long); + break; + case 2: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommitID { + return { + version: isSet(object.version) ? String(object.version) : "0", + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + }; + }, + + toJSON(message: CommitID): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): CommitID { + const message = createBaseCommitID(); + message.version = object.version ?? "0"; + message.hash = object.hash ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/base/store/v1beta1/listening.ts b/common/types/src/client/cosmos/base/store/v1beta1/listening.ts new file mode 100644 index 00000000..aefc9d0f --- /dev/null +++ b/common/types/src/client/cosmos/base/store/v1beta1/listening.ts @@ -0,0 +1,157 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.store.v1beta1"; + +/** + * StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) + * It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and + * Deletes + * + * Since: cosmos-sdk 0.43 + */ +export interface StoreKVPair { + /** the store key for the KVStore this pair originates from */ + store_key: string; + /** true indicates a delete operation, false indicates a set operation */ + delete: boolean; + key: Uint8Array; + value: Uint8Array; +} + +function createBaseStoreKVPair(): StoreKVPair { + return { store_key: "", delete: false, key: new Uint8Array(), value: new Uint8Array() }; +} + +export const StoreKVPair = { + encode(message: StoreKVPair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.store_key !== "") { + writer.uint32(10).string(message.store_key); + } + if (message.delete === true) { + writer.uint32(16).bool(message.delete); + } + if (message.key.length !== 0) { + writer.uint32(26).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(34).bytes(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StoreKVPair { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.store_key = reader.string(); + break; + case 2: + message.delete = reader.bool(); + break; + case 3: + message.key = reader.bytes(); + break; + case 4: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StoreKVPair { + return { + store_key: isSet(object.store_key) ? String(object.store_key) : "", + delete: isSet(object.delete) ? Boolean(object.delete) : false, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + }; + }, + + toJSON(message: StoreKVPair): unknown { + const obj: any = {}; + message.store_key !== undefined && (obj.store_key = message.store_key); + message.delete !== undefined && (obj.delete = message.delete); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): StoreKVPair { + const message = createBaseStoreKVPair(); + message.store_key = object.store_key ?? ""; + message.delete = object.delete ?? false; + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/base/tendermint/v1beta1/query.ts b/common/types/src/client/cosmos/base/tendermint/v1beta1/query.ts new file mode 100644 index 00000000..1e02d7d7 --- /dev/null +++ b/common/types/src/client/cosmos/base/tendermint/v1beta1/query.ts @@ -0,0 +1,1137 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../../google/protobuf/any"; +import { NodeInfo } from "../../../../tendermint/p2p/types"; +import { Block } from "../../../../tendermint/types/block"; +import { BlockID } from "../../../../tendermint/types/types"; +import { PageRequest, PageResponse } from "../../query/v1beta1/pagination"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightRequest { + height: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightResponse { + block_height: string; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +/** GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetRequest { + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetResponse { + block_height: string; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +/** Validator is the type for the validator-set. */ +export interface Validator { + address: string; + pub_key?: Any; + voting_power: string; + proposer_priority: string; +} + +/** GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightRequest { + height: string; +} + +/** GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightResponse { + block_id?: BlockID; + block?: Block; +} + +/** GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method. */ +export interface GetLatestBlockRequest { +} + +/** GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method. */ +export interface GetLatestBlockResponse { + block_id?: BlockID; + block?: Block; +} + +/** GetSyncingRequest is the request type for the Query/GetSyncing RPC method. */ +export interface GetSyncingRequest { +} + +/** GetSyncingResponse is the response type for the Query/GetSyncing RPC method. */ +export interface GetSyncingResponse { + syncing: boolean; +} + +/** GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method. */ +export interface GetNodeInfoRequest { +} + +/** GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC method. */ +export interface GetNodeInfoResponse { + node_info?: NodeInfo; + application_version?: VersionInfo; +} + +/** VersionInfo is the type for the GetNodeInfoResponse message. */ +export interface VersionInfo { + name: string; + app_name: string; + version: string; + git_commit: string; + build_tags: string; + go_version: string; + build_deps: Module[]; + /** Since: cosmos-sdk 0.43 */ + cosmos_sdk_version: string; +} + +/** Module is the type for VersionInfo */ +export interface Module { + /** module path */ + path: string; + /** module version */ + version: string; + /** checksum */ + sum: string; +} + +function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequest { + return { height: "0", pagination: undefined }; +} + +export const GetValidatorSetByHeightRequest = { + encode(message: GetValidatorSetByHeightRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetValidatorSetByHeightRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetValidatorSetByHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = longToString(reader.int64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightRequest { + return { + height: isSet(object.height) ? String(object.height) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightRequest): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): GetValidatorSetByHeightRequest { + const message = createBaseGetValidatorSetByHeightRequest(); + message.height = object.height ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseGetValidatorSetByHeightResponse(): GetValidatorSetByHeightResponse { + return { block_height: "0", validators: [], pagination: undefined }; +} + +export const GetValidatorSetByHeightResponse = { + encode(message: GetValidatorSetByHeightResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_height !== "0") { + writer.uint32(8).int64(message.block_height); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetValidatorSetByHeightResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetValidatorSetByHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_height = longToString(reader.int64() as Long); + break; + case 2: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightResponse { + return { + block_height: isSet(object.block_height) ? String(object.block_height) : "0", + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightResponse): unknown { + const obj: any = {}; + message.block_height !== undefined && (obj.block_height = message.block_height); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): GetValidatorSetByHeightResponse { + const message = createBaseGetValidatorSetByHeightResponse(); + message.block_height = object.block_height ?? "0"; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseGetLatestValidatorSetRequest(): GetLatestValidatorSetRequest { + return { pagination: undefined }; +} + +export const GetLatestValidatorSetRequest = { + encode(message: GetLatestValidatorSetRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestValidatorSetRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestValidatorSetRequest(); + 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; + }, + + fromJSON(object: any): GetLatestValidatorSetRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: GetLatestValidatorSetRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetLatestValidatorSetRequest { + const message = createBaseGetLatestValidatorSetRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseGetLatestValidatorSetResponse(): GetLatestValidatorSetResponse { + return { block_height: "0", validators: [], pagination: undefined }; +} + +export const GetLatestValidatorSetResponse = { + encode(message: GetLatestValidatorSetResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_height !== "0") { + writer.uint32(8).int64(message.block_height); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestValidatorSetResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_height = longToString(reader.int64() as Long); + break; + case 2: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetResponse { + return { + block_height: isSet(object.block_height) ? String(object.block_height) : "0", + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetLatestValidatorSetResponse): unknown { + const obj: any = {}; + message.block_height !== undefined && (obj.block_height = message.block_height); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): GetLatestValidatorSetResponse { + const message = createBaseGetLatestValidatorSetResponse(); + message.block_height = object.block_height ?? "0"; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: "", pub_key: undefined, voting_power: "0", proposer_priority: "0" }; +} + +export const Validator = { + encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pub_key !== undefined) { + Any.encode(message.pub_key, writer.uint32(18).fork()).ldelim(); + } + if (message.voting_power !== "0") { + writer.uint32(24).int64(message.voting_power); + } + if (message.proposer_priority !== "0") { + writer.uint32(32).int64(message.proposer_priority); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Validator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.string(); + break; + case 2: + message.pub_key = Any.decode(reader, reader.uint32()); + break; + case 3: + message.voting_power = longToString(reader.int64() as Long); + break; + case 4: + message.proposer_priority = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? String(object.address) : "", + pub_key: isSet(object.pub_key) ? Any.fromJSON(object.pub_key) : undefined, + voting_power: isSet(object.voting_power) ? String(object.voting_power) : "0", + proposer_priority: isSet(object.proposer_priority) ? String(object.proposer_priority) : "0", + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? Any.toJSON(message.pub_key) : undefined); + message.voting_power !== undefined && (obj.voting_power = message.voting_power); + message.proposer_priority !== undefined && (obj.proposer_priority = message.proposer_priority); + return obj; + }, + + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? ""; + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? Any.fromPartial(object.pub_key) + : undefined; + message.voting_power = object.voting_power ?? "0"; + message.proposer_priority = object.proposer_priority ?? "0"; + return message; + }, +}; + +function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { + return { height: "0" }; +} + +export const GetBlockByHeightRequest = { + encode(message: GetBlockByHeightRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockByHeightRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockByHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightRequest { + return { height: isSet(object.height) ? String(object.height) : "0" }; + }, + + toJSON(message: GetBlockByHeightRequest): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>(object: I): GetBlockByHeightRequest { + const message = createBaseGetBlockByHeightRequest(); + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { + return { block_id: undefined, block: undefined }; +} + +export const GetBlockByHeightResponse = { + encode(message: GetBlockByHeightResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(10).fork()).ldelim(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockByHeightResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockByHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_id = BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.block = Block.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightResponse { + return { + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + }; + }, + + toJSON(message: GetBlockByHeightResponse): unknown { + const obj: any = {}; + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.block !== undefined && (obj.block = message.block ? Block.toJSON(message.block) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetBlockByHeightResponse { + const message = createBaseGetBlockByHeightResponse(); + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + return message; + }, +}; + +function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { + return {}; +} + +export const GetLatestBlockRequest = { + encode(_: GetLatestBlockRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestBlockRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetLatestBlockRequest { + return {}; + }, + + toJSON(_: GetLatestBlockRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetLatestBlockRequest { + const message = createBaseGetLatestBlockRequest(); + return message; + }, +}; + +function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { + return { block_id: undefined, block: undefined }; +} + +export const GetLatestBlockResponse = { + encode(message: GetLatestBlockResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(10).fork()).ldelim(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestBlockResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_id = BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.block = Block.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetLatestBlockResponse { + return { + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + }; + }, + + toJSON(message: GetLatestBlockResponse): unknown { + const obj: any = {}; + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.block !== undefined && (obj.block = message.block ? Block.toJSON(message.block) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetLatestBlockResponse { + const message = createBaseGetLatestBlockResponse(); + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + return message; + }, +}; + +function createBaseGetSyncingRequest(): GetSyncingRequest { + return {}; +} + +export const GetSyncingRequest = { + encode(_: GetSyncingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetSyncingRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetSyncingRequest { + return {}; + }, + + toJSON(_: GetSyncingRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetSyncingRequest { + const message = createBaseGetSyncingRequest(); + return message; + }, +}; + +function createBaseGetSyncingResponse(): GetSyncingResponse { + return { syncing: false }; +} + +export const GetSyncingResponse = { + encode(message: GetSyncingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.syncing === true) { + writer.uint32(8).bool(message.syncing); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetSyncingResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.syncing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetSyncingResponse { + return { syncing: isSet(object.syncing) ? Boolean(object.syncing) : false }; + }, + + toJSON(message: GetSyncingResponse): unknown { + const obj: any = {}; + message.syncing !== undefined && (obj.syncing = message.syncing); + return obj; + }, + + fromPartial, I>>(object: I): GetSyncingResponse { + const message = createBaseGetSyncingResponse(); + message.syncing = object.syncing ?? false; + return message; + }, +}; + +function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { + return {}; +} + +export const GetNodeInfoRequest = { + encode(_: GetNodeInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetNodeInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetNodeInfoRequest { + return {}; + }, + + toJSON(_: GetNodeInfoRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetNodeInfoRequest { + const message = createBaseGetNodeInfoRequest(); + return message; + }, +}; + +function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { + return { node_info: undefined, application_version: undefined }; +} + +export const GetNodeInfoResponse = { + encode(message: GetNodeInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.node_info !== undefined) { + NodeInfo.encode(message.node_info, writer.uint32(10).fork()).ldelim(); + } + if (message.application_version !== undefined) { + VersionInfo.encode(message.application_version, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetNodeInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.node_info = NodeInfo.decode(reader, reader.uint32()); + break; + case 2: + message.application_version = VersionInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetNodeInfoResponse { + return { + node_info: isSet(object.node_info) ? NodeInfo.fromJSON(object.node_info) : undefined, + application_version: isSet(object.application_version) + ? VersionInfo.fromJSON(object.application_version) + : undefined, + }; + }, + + toJSON(message: GetNodeInfoResponse): unknown { + const obj: any = {}; + message.node_info !== undefined && + (obj.node_info = message.node_info ? NodeInfo.toJSON(message.node_info) : undefined); + message.application_version !== undefined && (obj.application_version = message.application_version + ? VersionInfo.toJSON(message.application_version) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetNodeInfoResponse { + const message = createBaseGetNodeInfoResponse(); + message.node_info = (object.node_info !== undefined && object.node_info !== null) + ? NodeInfo.fromPartial(object.node_info) + : undefined; + message.application_version = (object.application_version !== undefined && object.application_version !== null) + ? VersionInfo.fromPartial(object.application_version) + : undefined; + return message; + }, +}; + +function createBaseVersionInfo(): VersionInfo { + return { + name: "", + app_name: "", + version: "", + git_commit: "", + build_tags: "", + go_version: "", + build_deps: [], + cosmos_sdk_version: "", + }; +} + +export const VersionInfo = { + encode(message: VersionInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.app_name !== "") { + writer.uint32(18).string(message.app_name); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.git_commit !== "") { + writer.uint32(34).string(message.git_commit); + } + if (message.build_tags !== "") { + writer.uint32(42).string(message.build_tags); + } + if (message.go_version !== "") { + writer.uint32(50).string(message.go_version); + } + for (const v of message.build_deps) { + Module.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.cosmos_sdk_version !== "") { + writer.uint32(66).string(message.cosmos_sdk_version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): VersionInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.app_name = reader.string(); + break; + case 3: + message.version = reader.string(); + break; + case 4: + message.git_commit = reader.string(); + break; + case 5: + message.build_tags = reader.string(); + break; + case 6: + message.go_version = reader.string(); + break; + case 7: + message.build_deps.push(Module.decode(reader, reader.uint32())); + break; + case 8: + message.cosmos_sdk_version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): VersionInfo { + return { + name: isSet(object.name) ? String(object.name) : "", + app_name: isSet(object.app_name) ? String(object.app_name) : "", + version: isSet(object.version) ? String(object.version) : "", + git_commit: isSet(object.git_commit) ? String(object.git_commit) : "", + build_tags: isSet(object.build_tags) ? String(object.build_tags) : "", + go_version: isSet(object.go_version) ? String(object.go_version) : "", + build_deps: Array.isArray(object?.build_deps) ? object.build_deps.map((e: any) => Module.fromJSON(e)) : [], + cosmos_sdk_version: isSet(object.cosmos_sdk_version) ? String(object.cosmos_sdk_version) : "", + }; + }, + + toJSON(message: VersionInfo): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.app_name !== undefined && (obj.app_name = message.app_name); + message.version !== undefined && (obj.version = message.version); + message.git_commit !== undefined && (obj.git_commit = message.git_commit); + message.build_tags !== undefined && (obj.build_tags = message.build_tags); + message.go_version !== undefined && (obj.go_version = message.go_version); + if (message.build_deps) { + obj.build_deps = message.build_deps.map((e) => e ? Module.toJSON(e) : undefined); + } else { + obj.build_deps = []; + } + message.cosmos_sdk_version !== undefined && (obj.cosmos_sdk_version = message.cosmos_sdk_version); + return obj; + }, + + fromPartial, I>>(object: I): VersionInfo { + const message = createBaseVersionInfo(); + message.name = object.name ?? ""; + message.app_name = object.app_name ?? ""; + message.version = object.version ?? ""; + message.git_commit = object.git_commit ?? ""; + message.build_tags = object.build_tags ?? ""; + message.go_version = object.go_version ?? ""; + message.build_deps = object.build_deps?.map((e) => Module.fromPartial(e)) || []; + message.cosmos_sdk_version = object.cosmos_sdk_version ?? ""; + return message; + }, +}; + +function createBaseModule(): Module { + return { path: "", version: "", sum: "" }; +} + +export const Module = { + encode(message: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.sum !== "") { + writer.uint32(26).string(message.sum); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Module { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + case 3: + message.sum = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Module { + return { + path: isSet(object.path) ? String(object.path) : "", + version: isSet(object.version) ? String(object.version) : "", + sum: isSet(object.sum) ? String(object.sum) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + message.path !== undefined && (obj.path = message.path); + message.version !== undefined && (obj.version = message.version); + message.sum !== undefined && (obj.sum = message.sum); + return obj; + }, + + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.path = object.path ?? ""; + message.version = object.version ?? ""; + message.sum = object.sum ?? ""; + return message; + }, +}; + +/** Service defines the gRPC querier service for tendermint queries. */ +export interface Service { + /** GetNodeInfo queries the current node info. */ + GetNodeInfo(request: GetNodeInfoRequest): Promise; + /** GetSyncing queries node syncing. */ + GetSyncing(request: GetSyncingRequest): Promise; + /** GetLatestBlock returns the latest block. */ + GetLatestBlock(request: GetLatestBlockRequest): Promise; + /** GetBlockByHeight queries block for given height. */ + GetBlockByHeight(request: GetBlockByHeightRequest): Promise; + /** GetLatestValidatorSet queries latest validator-set. */ + GetLatestValidatorSet(request: GetLatestValidatorSetRequest): Promise; + /** GetValidatorSetByHeight queries validator-set at a given height. */ + GetValidatorSetByHeight(request: GetValidatorSetByHeightRequest): Promise; +} + +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.base.tendermint.v1beta1.Service"; + this.rpc = rpc; + this.GetNodeInfo = this.GetNodeInfo.bind(this); + this.GetSyncing = this.GetSyncing.bind(this); + this.GetLatestBlock = this.GetLatestBlock.bind(this); + this.GetBlockByHeight = this.GetBlockByHeight.bind(this); + this.GetLatestValidatorSet = this.GetLatestValidatorSet.bind(this); + this.GetValidatorSetByHeight = this.GetValidatorSetByHeight.bind(this); + } + GetNodeInfo(request: GetNodeInfoRequest): Promise { + const data = GetNodeInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetNodeInfo", data); + return promise.then((data) => GetNodeInfoResponse.decode(new _m0.Reader(data))); + } + + GetSyncing(request: GetSyncingRequest): Promise { + const data = GetSyncingRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetSyncing", data); + return promise.then((data) => GetSyncingResponse.decode(new _m0.Reader(data))); + } + + GetLatestBlock(request: GetLatestBlockRequest): Promise { + const data = GetLatestBlockRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetLatestBlock", data); + return promise.then((data) => GetLatestBlockResponse.decode(new _m0.Reader(data))); + } + + GetBlockByHeight(request: GetBlockByHeightRequest): Promise { + const data = GetBlockByHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetBlockByHeight", data); + return promise.then((data) => GetBlockByHeightResponse.decode(new _m0.Reader(data))); + } + + GetLatestValidatorSet(request: GetLatestValidatorSetRequest): Promise { + const data = GetLatestValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetLatestValidatorSet", data); + return promise.then((data) => GetLatestValidatorSetResponse.decode(new _m0.Reader(data))); + } + + GetValidatorSetByHeight(request: GetValidatorSetByHeightRequest): Promise { + const data = GetValidatorSetByHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetValidatorSetByHeight", data); + return promise.then((data) => GetValidatorSetByHeightResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/base/v1beta1/coin.ts b/common/types/src/client/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..b28eec03 --- /dev/null +++ b/common/types/src/client/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,261 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * 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; +} + +/** + * 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; +} + +/** IntProto defines a Protobuf wrapper around an Int object. */ +export interface IntProto { + int: string; +} + +/** DecProto defines a Protobuf wrapper around a Dec object. */ +export interface DecProto { + dec: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin = { + encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Coin { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): Coin { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin = { + encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): DecCoin { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseIntProto(): IntProto { + return { int: "" }; +} + +export const IntProto = { + encode(message: IntProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): IntProto { + return { int: isSet(object.int) ? String(object.int) : "" }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + message.int !== undefined && (obj.int = message.int); + return obj; + }, + + fromPartial, I>>(object: I): IntProto { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, +}; + +function createBaseDecProto(): DecProto { + return { dec: "" }; +} + +export const DecProto = { + encode(message: DecProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DecProto { + return { dec: isSet(object.dec) ? String(object.dec) : "" }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + message.dec !== undefined && (obj.dec = message.dec); + return obj; + }, + + fromPartial, I>>(object: I): DecProto { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/capability/v1beta1/capability.ts b/common/types/src/client/cosmos/capability/v1beta1/capability.ts new file mode 100644 index 00000000..db10e372 --- /dev/null +++ b/common/types/src/client/cosmos/capability/v1beta1/capability.ts @@ -0,0 +1,210 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.capability.v1beta1"; + +/** + * Capability defines an implementation of an object capability. The index + * provided to a Capability must be globally unique. + */ +export interface Capability { + index: string; +} + +/** + * Owner defines a single capability owner. An owner is defined by the name of + * capability and the module name. + */ +export interface Owner { + module: string; + name: string; +} + +/** + * CapabilityOwners defines a set of owners of a single Capability. The set of + * owners must be unique. + */ +export interface CapabilityOwners { + owners: Owner[]; +} + +function createBaseCapability(): Capability { + return { index: "0" }; +} + +export const Capability = { + encode(message: Capability, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Capability { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCapability(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Capability { + return { index: isSet(object.index) ? String(object.index) : "0" }; + }, + + toJSON(message: Capability): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + return obj; + }, + + fromPartial, I>>(object: I): Capability { + const message = createBaseCapability(); + message.index = object.index ?? "0"; + return message; + }, +}; + +function createBaseOwner(): Owner { + return { module: "", name: "" }; +} + +export const Owner = { + encode(message: Owner, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Owner { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOwner(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.module = reader.string(); + break; + case 2: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Owner { + return { + module: isSet(object.module) ? String(object.module) : "", + name: isSet(object.name) ? String(object.name) : "", + }; + }, + + toJSON(message: Owner): unknown { + const obj: any = {}; + message.module !== undefined && (obj.module = message.module); + message.name !== undefined && (obj.name = message.name); + return obj; + }, + + fromPartial, I>>(object: I): Owner { + const message = createBaseOwner(); + message.module = object.module ?? ""; + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseCapabilityOwners(): CapabilityOwners { + return { owners: [] }; +} + +export const CapabilityOwners = { + encode(message: CapabilityOwners, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.owners) { + Owner.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CapabilityOwners { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCapabilityOwners(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owners.push(Owner.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CapabilityOwners { + return { owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => Owner.fromJSON(e)) : [] }; + }, + + toJSON(message: CapabilityOwners): unknown { + const obj: any = {}; + if (message.owners) { + obj.owners = message.owners.map((e) => e ? Owner.toJSON(e) : undefined); + } else { + obj.owners = []; + } + return obj; + }, + + fromPartial, I>>(object: I): CapabilityOwners { + const message = createBaseCapabilityOwners(); + message.owners = object.owners?.map((e) => Owner.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/capability/v1beta1/genesis.ts b/common/types/src/client/cosmos/capability/v1beta1/genesis.ts new file mode 100644 index 00000000..eab16eaa --- /dev/null +++ b/common/types/src/client/cosmos/capability/v1beta1/genesis.ts @@ -0,0 +1,172 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { CapabilityOwners } from "./capability"; + +export const protobufPackage = "cosmos.capability.v1beta1"; + +/** GenesisOwners defines the capability owners with their corresponding index. */ +export interface GenesisOwners { + /** index is the index of the capability owner. */ + index: string; + /** index_owners are the owners at the given index. */ + index_owners?: CapabilityOwners; +} + +/** GenesisState defines the capability module's genesis state. */ +export interface GenesisState { + /** index is the capability global index. */ + index: string; + /** + * owners represents a map from index to owners of the capability index + * index key is string to allow amino marshalling. + */ + owners: GenesisOwners[]; +} + +function createBaseGenesisOwners(): GenesisOwners { + return { index: "0", index_owners: undefined }; +} + +export const GenesisOwners = { + encode(message: GenesisOwners, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.index_owners !== undefined) { + CapabilityOwners.encode(message.index_owners, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisOwners { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisOwners(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.index_owners = CapabilityOwners.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisOwners { + return { + index: isSet(object.index) ? String(object.index) : "0", + index_owners: isSet(object.index_owners) ? CapabilityOwners.fromJSON(object.index_owners) : undefined, + }; + }, + + toJSON(message: GenesisOwners): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.index_owners !== undefined && + (obj.index_owners = message.index_owners ? CapabilityOwners.toJSON(message.index_owners) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisOwners { + const message = createBaseGenesisOwners(); + message.index = object.index ?? "0"; + message.index_owners = (object.index_owners !== undefined && object.index_owners !== null) + ? CapabilityOwners.fromPartial(object.index_owners) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { index: "0", owners: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + for (const v of message.owners) { + GenesisOwners.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.owners.push(GenesisOwners.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + index: isSet(object.index) ? String(object.index) : "0", + owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => GenesisOwners.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + if (message.owners) { + obj.owners = message.owners.map((e) => e ? GenesisOwners.toJSON(e) : undefined); + } else { + obj.owners = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.index = object.index ?? "0"; + message.owners = object.owners?.map((e) => GenesisOwners.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/crisis/v1beta1/genesis.ts b/common/types/src/client/cosmos/crisis/v1beta1/genesis.ts new file mode 100644 index 00000000..ea45d3e8 --- /dev/null +++ b/common/types/src/client/cosmos/crisis/v1beta1/genesis.ts @@ -0,0 +1,79 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.crisis.v1beta1"; + +/** GenesisState defines the crisis module's genesis state. */ +export interface GenesisState { + /** + * constant_fee is the fee used to verify the invariant in the crisis + * module. + */ + constant_fee?: Coin; +} + +function createBaseGenesisState(): GenesisState { + return { constant_fee: undefined }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.constant_fee !== undefined) { + Coin.encode(message.constant_fee, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.constant_fee = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { constant_fee: isSet(object.constant_fee) ? Coin.fromJSON(object.constant_fee) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.constant_fee !== undefined && + (obj.constant_fee = message.constant_fee ? Coin.toJSON(message.constant_fee) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.constant_fee = (object.constant_fee !== undefined && object.constant_fee !== null) + ? Coin.fromPartial(object.constant_fee) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/crisis/v1beta1/tx.ts b/common/types/src/client/cosmos/crisis/v1beta1/tx.ts new file mode 100644 index 00000000..34aef3b9 --- /dev/null +++ b/common/types/src/client/cosmos/crisis/v1beta1/tx.ts @@ -0,0 +1,161 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crisis.v1beta1"; + +/** MsgVerifyInvariant represents a message to verify a particular invariance. */ +export interface MsgVerifyInvariant { + sender: string; + invariant_module_name: string; + invariant_route: string; +} + +/** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */ +export interface MsgVerifyInvariantResponse { +} + +function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { + return { sender: "", invariant_module_name: "", invariant_route: "" }; +} + +export const MsgVerifyInvariant = { + encode(message: MsgVerifyInvariant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.invariant_module_name !== "") { + writer.uint32(18).string(message.invariant_module_name); + } + if (message.invariant_route !== "") { + writer.uint32(26).string(message.invariant_route); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVerifyInvariant { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.invariant_module_name = reader.string(); + break; + case 3: + message.invariant_route = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgVerifyInvariant { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + invariant_module_name: isSet(object.invariant_module_name) ? String(object.invariant_module_name) : "", + invariant_route: isSet(object.invariant_route) ? String(object.invariant_route) : "", + }; + }, + + toJSON(message: MsgVerifyInvariant): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.invariant_module_name !== undefined && (obj.invariant_module_name = message.invariant_module_name); + message.invariant_route !== undefined && (obj.invariant_route = message.invariant_route); + return obj; + }, + + fromPartial, I>>(object: I): MsgVerifyInvariant { + const message = createBaseMsgVerifyInvariant(); + message.sender = object.sender ?? ""; + message.invariant_module_name = object.invariant_module_name ?? ""; + message.invariant_route = object.invariant_route ?? ""; + return message; + }, +}; + +function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { + return {}; +} + +export const MsgVerifyInvariantResponse = { + encode(_: MsgVerifyInvariantResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVerifyInvariantResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgVerifyInvariantResponse { + return {}; + }, + + toJSON(_: MsgVerifyInvariantResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVerifyInvariantResponse { + const message = createBaseMsgVerifyInvariantResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** VerifyInvariant defines a method to verify a particular invariance. */ + VerifyInvariant(request: MsgVerifyInvariant): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.crisis.v1beta1.Msg"; + this.rpc = rpc; + this.VerifyInvariant = this.VerifyInvariant.bind(this); + } + VerifyInvariant(request: MsgVerifyInvariant): Promise { + const data = MsgVerifyInvariant.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifyInvariant", data); + return promise.then((data) => MsgVerifyInvariantResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/crypto/ed25519/keys.ts b/common/types/src/client/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 00000000..b774ec88 --- /dev/null +++ b/common/types/src/client/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,178 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crypto.ed25519"; + +/** + * 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; +} + +/** + * Deprecated: 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; +} + +function createBasePubKey(): PubKey { + return { key: new Uint8Array() }; +} + +export const PubKey = { + encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array() }; +} + +export const PrivKey = { + encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/crypto/hd/v1/hd.ts b/common/types/src/client/cosmos/crypto/hd/v1/hd.ts new file mode 100644 index 00000000..622c613c --- /dev/null +++ b/common/types/src/client/cosmos/crypto/hd/v1/hd.ts @@ -0,0 +1,121 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crypto.hd.v1"; + +/** BIP44Params is used as path field in ledger item in Record. */ +export interface BIP44Params { + /** purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation */ + purpose: number; + /** coin_type is a constant that improves privacy */ + coin_type: number; + /** account splits the key space into independent user identities */ + account: number; + /** + * change is a constant used for public derivation. Constant 0 is used for external chain and constant 1 for internal + * chain. + */ + change: boolean; + /** address_index is used as child index in BIP32 derivation */ + address_index: number; +} + +function createBaseBIP44Params(): BIP44Params { + return { purpose: 0, coin_type: 0, account: 0, change: false, address_index: 0 }; +} + +export const BIP44Params = { + encode(message: BIP44Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.purpose !== 0) { + writer.uint32(8).uint32(message.purpose); + } + if (message.coin_type !== 0) { + writer.uint32(16).uint32(message.coin_type); + } + if (message.account !== 0) { + writer.uint32(24).uint32(message.account); + } + if (message.change === true) { + writer.uint32(32).bool(message.change); + } + if (message.address_index !== 0) { + writer.uint32(40).uint32(message.address_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BIP44Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBIP44Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purpose = reader.uint32(); + break; + case 2: + message.coin_type = reader.uint32(); + break; + case 3: + message.account = reader.uint32(); + break; + case 4: + message.change = reader.bool(); + break; + case 5: + message.address_index = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BIP44Params { + return { + purpose: isSet(object.purpose) ? Number(object.purpose) : 0, + coin_type: isSet(object.coin_type) ? Number(object.coin_type) : 0, + account: isSet(object.account) ? Number(object.account) : 0, + change: isSet(object.change) ? Boolean(object.change) : false, + address_index: isSet(object.address_index) ? Number(object.address_index) : 0, + }; + }, + + toJSON(message: BIP44Params): unknown { + const obj: any = {}; + message.purpose !== undefined && (obj.purpose = Math.round(message.purpose)); + message.coin_type !== undefined && (obj.coin_type = Math.round(message.coin_type)); + message.account !== undefined && (obj.account = Math.round(message.account)); + message.change !== undefined && (obj.change = message.change); + message.address_index !== undefined && (obj.address_index = Math.round(message.address_index)); + return obj; + }, + + fromPartial, I>>(object: I): BIP44Params { + const message = createBaseBIP44Params(); + message.purpose = object.purpose ?? 0; + message.coin_type = object.coin_type ?? 0; + message.account = object.account ?? 0; + message.change = object.change ?? false; + message.address_index = object.address_index ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/crypto/keyring/v1/record.ts b/common/types/src/client/cosmos/crypto/keyring/v1/record.ts new file mode 100644 index 00000000..953bfbb9 --- /dev/null +++ b/common/types/src/client/cosmos/crypto/keyring/v1/record.ts @@ -0,0 +1,357 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../../google/protobuf/any"; +import { BIP44Params } from "../../hd/v1/hd"; + +export const protobufPackage = "cosmos.crypto.keyring.v1"; + +/** Record is used for representing a key in the keyring. */ +export interface Record { + /** name represents a name of Record */ + name: string; + /** pub_key represents a public key in any format */ + pub_key?: Any; + /** local stores the public information about a locally stored key */ + local?: + | Record_Local + | undefined; + /** ledger stores the public information about a Ledger key */ + ledger?: + | Record_Ledger + | undefined; + /** Multi does not store any information. */ + multi?: + | Record_Multi + | undefined; + /** Offline does not store any information. */ + offline?: Record_Offline | undefined; +} + +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_Local { + priv_key?: Any; + priv_key_type: string; +} + +/** Ledger item */ +export interface Record_Ledger { + path?: BIP44Params; +} + +/** Multi item */ +export interface Record_Multi { +} + +/** Offline item */ +export interface Record_Offline { +} + +function createBaseRecord(): Record { + return { name: "", pub_key: undefined, local: undefined, ledger: undefined, multi: undefined, offline: undefined }; +} + +export const Record = { + encode(message: Record, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.pub_key !== undefined) { + Any.encode(message.pub_key, writer.uint32(18).fork()).ldelim(); + } + if (message.local !== undefined) { + Record_Local.encode(message.local, writer.uint32(26).fork()).ldelim(); + } + if (message.ledger !== undefined) { + Record_Ledger.encode(message.ledger, writer.uint32(34).fork()).ldelim(); + } + if (message.multi !== undefined) { + Record_Multi.encode(message.multi, writer.uint32(42).fork()).ldelim(); + } + if (message.offline !== undefined) { + Record_Offline.encode(message.offline, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.pub_key = Any.decode(reader, reader.uint32()); + break; + case 3: + message.local = Record_Local.decode(reader, reader.uint32()); + break; + case 4: + message.ledger = Record_Ledger.decode(reader, reader.uint32()); + break; + case 5: + message.multi = Record_Multi.decode(reader, reader.uint32()); + break; + case 6: + message.offline = Record_Offline.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Record { + return { + name: isSet(object.name) ? String(object.name) : "", + pub_key: isSet(object.pub_key) ? Any.fromJSON(object.pub_key) : undefined, + local: isSet(object.local) ? Record_Local.fromJSON(object.local) : undefined, + ledger: isSet(object.ledger) ? Record_Ledger.fromJSON(object.ledger) : undefined, + multi: isSet(object.multi) ? Record_Multi.fromJSON(object.multi) : undefined, + offline: isSet(object.offline) ? Record_Offline.fromJSON(object.offline) : undefined, + }; + }, + + toJSON(message: Record): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? Any.toJSON(message.pub_key) : undefined); + message.local !== undefined && (obj.local = message.local ? Record_Local.toJSON(message.local) : undefined); + message.ledger !== undefined && (obj.ledger = message.ledger ? Record_Ledger.toJSON(message.ledger) : undefined); + message.multi !== undefined && (obj.multi = message.multi ? Record_Multi.toJSON(message.multi) : undefined); + message.offline !== undefined && + (obj.offline = message.offline ? Record_Offline.toJSON(message.offline) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Record { + const message = createBaseRecord(); + message.name = object.name ?? ""; + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? Any.fromPartial(object.pub_key) + : undefined; + message.local = (object.local !== undefined && object.local !== null) + ? Record_Local.fromPartial(object.local) + : undefined; + message.ledger = (object.ledger !== undefined && object.ledger !== null) + ? Record_Ledger.fromPartial(object.ledger) + : undefined; + message.multi = (object.multi !== undefined && object.multi !== null) + ? Record_Multi.fromPartial(object.multi) + : undefined; + message.offline = (object.offline !== undefined && object.offline !== null) + ? Record_Offline.fromPartial(object.offline) + : undefined; + return message; + }, +}; + +function createBaseRecord_Local(): Record_Local { + return { priv_key: undefined, priv_key_type: "" }; +} + +export const Record_Local = { + encode(message: Record_Local, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.priv_key !== undefined) { + Any.encode(message.priv_key, writer.uint32(10).fork()).ldelim(); + } + if (message.priv_key_type !== "") { + writer.uint32(18).string(message.priv_key_type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record_Local { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Local(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.priv_key = Any.decode(reader, reader.uint32()); + break; + case 2: + message.priv_key_type = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Record_Local { + return { + priv_key: isSet(object.priv_key) ? Any.fromJSON(object.priv_key) : undefined, + priv_key_type: isSet(object.priv_key_type) ? String(object.priv_key_type) : "", + }; + }, + + toJSON(message: Record_Local): unknown { + const obj: any = {}; + message.priv_key !== undefined && (obj.priv_key = message.priv_key ? Any.toJSON(message.priv_key) : undefined); + message.priv_key_type !== undefined && (obj.priv_key_type = message.priv_key_type); + return obj; + }, + + fromPartial, I>>(object: I): Record_Local { + const message = createBaseRecord_Local(); + message.priv_key = (object.priv_key !== undefined && object.priv_key !== null) + ? Any.fromPartial(object.priv_key) + : undefined; + message.priv_key_type = object.priv_key_type ?? ""; + return message; + }, +}; + +function createBaseRecord_Ledger(): Record_Ledger { + return { path: undefined }; +} + +export const Record_Ledger = { + encode(message: Record_Ledger, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.path !== undefined) { + BIP44Params.encode(message.path, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record_Ledger { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Ledger(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = BIP44Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Record_Ledger { + return { path: isSet(object.path) ? BIP44Params.fromJSON(object.path) : undefined }; + }, + + toJSON(message: Record_Ledger): unknown { + const obj: any = {}; + message.path !== undefined && (obj.path = message.path ? BIP44Params.toJSON(message.path) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Record_Ledger { + const message = createBaseRecord_Ledger(); + message.path = (object.path !== undefined && object.path !== null) + ? BIP44Params.fromPartial(object.path) + : undefined; + return message; + }, +}; + +function createBaseRecord_Multi(): Record_Multi { + return {}; +} + +export const Record_Multi = { + encode(_: Record_Multi, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record_Multi { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): Record_Multi { + return {}; + }, + + toJSON(_: Record_Multi): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Record_Multi { + const message = createBaseRecord_Multi(); + return message; + }, +}; + +function createBaseRecord_Offline(): Record_Offline { + return {}; +} + +export const Record_Offline = { + encode(_: Record_Offline, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record_Offline { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Offline(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): Record_Offline { + return {}; + }, + + toJSON(_: Record_Offline): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Record_Offline { + const message = createBaseRecord_Offline(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/crypto/multisig/keys.ts b/common/types/src/client/cosmos/crypto/multisig/keys.ts new file mode 100644 index 00000000..22f0af90 --- /dev/null +++ b/common/types/src/client/cosmos/crypto/multisig/keys.ts @@ -0,0 +1,92 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.crypto.multisig"; + +/** + * LegacyAminoPubKey specifies a public key type + * which nests multiple public keys and a threshold, + * it uses legacy amino address rules. + */ +export interface LegacyAminoPubKey { + threshold: number; + public_keys: Any[]; +} + +function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { + return { threshold: 0, public_keys: [] }; +} + +export const LegacyAminoPubKey = { + encode(message: LegacyAminoPubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.threshold !== 0) { + writer.uint32(8).uint32(message.threshold); + } + for (const v of message.public_keys) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LegacyAminoPubKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLegacyAminoPubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.threshold = reader.uint32(); + break; + case 2: + message.public_keys.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LegacyAminoPubKey { + return { + threshold: isSet(object.threshold) ? Number(object.threshold) : 0, + public_keys: Array.isArray(object?.public_keys) ? object.public_keys.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: LegacyAminoPubKey): unknown { + const obj: any = {}; + message.threshold !== undefined && (obj.threshold = Math.round(message.threshold)); + if (message.public_keys) { + obj.public_keys = message.public_keys.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.public_keys = []; + } + return obj; + }, + + fromPartial, I>>(object: I): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + message.threshold = object.threshold ?? 0; + message.public_keys = object.public_keys?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/crypto/multisig/v1beta1/multisig.ts b/common/types/src/client/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 00000000..5eeeef5a --- /dev/null +++ b/common/types/src/client/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,195 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crypto.multisig.v1beta1"; + +/** + * 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[]; +} + +/** + * 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 { + extra_bits_stored: number; + elems: Uint8Array; +} + +function createBaseMultiSignature(): MultiSignature { + return { signatures: [] }; +} + +export const MultiSignature = { + encode(message: MultiSignature, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.signatures) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MultiSignature { + return { + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: MultiSignature): unknown { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCompactBitArray(): CompactBitArray { + return { extra_bits_stored: 0, elems: new Uint8Array() }; +} + +export const CompactBitArray = { + encode(message: CompactBitArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.extra_bits_stored !== 0) { + writer.uint32(8).uint32(message.extra_bits_stored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.extra_bits_stored = reader.uint32(); + break; + case 2: + message.elems = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CompactBitArray { + return { + extra_bits_stored: isSet(object.extra_bits_stored) ? Number(object.extra_bits_stored) : 0, + elems: isSet(object.elems) ? bytesFromBase64(object.elems) : new Uint8Array(), + }; + }, + + toJSON(message: CompactBitArray): unknown { + const obj: any = {}; + message.extra_bits_stored !== undefined && (obj.extra_bits_stored = Math.round(message.extra_bits_stored)); + message.elems !== undefined && + (obj.elems = base64FromBytes(message.elems !== undefined ? message.elems : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): CompactBitArray { + const message = createBaseCompactBitArray(); + message.extra_bits_stored = object.extra_bits_stored ?? 0; + message.elems = object.elems ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/crypto/secp256k1/keys.ts b/common/types/src/client/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 00000000..379a8913 --- /dev/null +++ b/common/types/src/client/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,175 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crypto.secp256k1"; + +/** + * 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; +} + +/** PrivKey defines a secp256k1 private key. */ +export interface PrivKey { + key: Uint8Array; +} + +function createBasePubKey(): PubKey { + return { key: new Uint8Array() }; +} + +export const PubKey = { + encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array() }; +} + +export const PrivKey = { + encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/crypto/secp256r1/keys.ts b/common/types/src/client/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 00000000..25234f80 --- /dev/null +++ b/common/types/src/client/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,176 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crypto.secp256r1"; + +/** Since: cosmos-sdk 0.43 */ + +/** 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; +} + +/** PrivKey defines a secp256r1 ECDSA private key. */ +export interface PrivKey { + /** secret number serialized using big-endian encoding */ + secret: Uint8Array; +} + +function createBasePubKey(): PubKey { + return { key: new Uint8Array() }; +} + +export const PubKey = { + encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { secret: new Uint8Array() }; +} + +export const PrivKey = { + encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.secret.length !== 0) { + writer.uint32(10).bytes(message.secret); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PrivKey { + return { secret: isSet(object.secret) ? bytesFromBase64(object.secret) : new Uint8Array() }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + message.secret !== undefined && + (obj.secret = base64FromBytes(message.secret !== undefined ? message.secret : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.secret = object.secret ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/distribution/v1beta1/distribution.ts b/common/types/src/client/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..9bec5691 --- /dev/null +++ b/common/types/src/client/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,926 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Coin, DecCoin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** Params defines the set of params for the distribution module. */ +export interface Params { + community_tax: string; + base_proposer_reward: string; + bonus_proposer_reward: string; + withdraw_addr_enabled: boolean; +} + +/** + * 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 { + cumulative_reward_ratio: DecCoin[]; + reference_count: number; +} + +/** + * 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: string; +} + +/** + * ValidatorAccumulatedCommission represents accumulated commission + * for a validator kept as a running counter, can be withdrawn at any time. + */ +export interface ValidatorAccumulatedCommission { + commission: DecCoin[]; +} + +/** + * ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards + * for a validator inexpensive to track, allows simple sanity checks. + */ +export interface ValidatorOutstandingRewards { + rewards: DecCoin[]; +} + +/** + * 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 { + validator_period: string; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validator_slash_events: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + community_pool: DecCoin[]; +} + +/** + * CommunityPoolSpendProposal details a proposal for use of community funds, + * together with how many coins are proposed to be spent, and to which + * recipient account. + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * 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 { + previous_period: string; + stake: string; + height: string; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validator_address: string; + reward: DecCoin[]; +} + +/** + * CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal + * with a deposit + */ +export interface CommunityPoolSpendProposalWithDeposit { + title: string; + description: string; + recipient: string; + amount: string; + deposit: string; +} + +function createBaseParams(): Params { + return { community_tax: "", base_proposer_reward: "", bonus_proposer_reward: "", withdraw_addr_enabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.community_tax !== "") { + writer.uint32(10).string(message.community_tax); + } + if (message.base_proposer_reward !== "") { + writer.uint32(18).string(message.base_proposer_reward); + } + if (message.bonus_proposer_reward !== "") { + writer.uint32(26).string(message.bonus_proposer_reward); + } + if (message.withdraw_addr_enabled === true) { + writer.uint32(32).bool(message.withdraw_addr_enabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.community_tax = reader.string(); + break; + case 2: + message.base_proposer_reward = reader.string(); + break; + case 3: + message.bonus_proposer_reward = reader.string(); + break; + case 4: + message.withdraw_addr_enabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + community_tax: isSet(object.community_tax) ? String(object.community_tax) : "", + base_proposer_reward: isSet(object.base_proposer_reward) ? String(object.base_proposer_reward) : "", + bonus_proposer_reward: isSet(object.bonus_proposer_reward) ? String(object.bonus_proposer_reward) : "", + withdraw_addr_enabled: isSet(object.withdraw_addr_enabled) ? Boolean(object.withdraw_addr_enabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.community_tax !== undefined && (obj.community_tax = message.community_tax); + message.base_proposer_reward !== undefined && (obj.base_proposer_reward = message.base_proposer_reward); + message.bonus_proposer_reward !== undefined && (obj.bonus_proposer_reward = message.bonus_proposer_reward); + message.withdraw_addr_enabled !== undefined && (obj.withdraw_addr_enabled = message.withdraw_addr_enabled); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.community_tax = object.community_tax ?? ""; + message.base_proposer_reward = object.base_proposer_reward ?? ""; + message.bonus_proposer_reward = object.bonus_proposer_reward ?? ""; + message.withdraw_addr_enabled = object.withdraw_addr_enabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulative_reward_ratio: [], reference_count: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulative_reward_ratio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.reference_count !== 0) { + writer.uint32(16).uint32(message.reference_count); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.cumulative_reward_ratio.push(DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.reference_count = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulative_reward_ratio: Array.isArray(object?.cumulative_reward_ratio) + ? object.cumulative_reward_ratio.map((e: any) => DecCoin.fromJSON(e)) + : [], + reference_count: isSet(object.reference_count) ? Number(object.reference_count) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulative_reward_ratio) { + obj.cumulative_reward_ratio = message.cumulative_reward_ratio.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.cumulative_reward_ratio = []; + } + message.reference_count !== undefined && (obj.reference_count = Math.round(message.reference_count)); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulative_reward_ratio = object.cumulative_reward_ratio?.map((e) => DecCoin.fromPartial(e)) || []; + message.reference_count = object.reference_count ?? 0; + return message; + }, +}; + +function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { + return { rewards: [], period: "0" }; +} + +export const ValidatorCurrentRewards = { + encode(message: ValidatorCurrentRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.period !== "0") { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? String(object.period) : "0", + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.rewards = []; + } + message.period !== undefined && (obj.period = message.period); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorCurrentRewards { + const message = createBaseValidatorCurrentRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.period = object.period ?? "0"; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommission(): ValidatorAccumulatedCommission { + return { commission: [] }; +} + +export const ValidatorAccumulatedCommission = { + encode(message: ValidatorAccumulatedCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ValidatorAccumulatedCommission { + return { + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorAccumulatedCommission): unknown { + const obj: any = {}; + if (message.commission) { + obj.commission = message.commission.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.commission = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommission { + const message = createBaseValidatorAccumulatedCommission(); + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorOutstandingRewards(): ValidatorOutstandingRewards { + return { rewards: [] }; +} + +export const ValidatorOutstandingRewards = { + encode(message: ValidatorOutstandingRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ValidatorOutstandingRewards { + return { rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: ValidatorOutstandingRewards): unknown { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.rewards = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validator_period: "0", fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_period !== "0") { + writer.uint32(8).uint64(message.validator_period); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_period = longToString(reader.uint64() as Long); + break; + case 2: + message.fraction = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validator_period: isSet(object.validator_period) ? String(object.validator_period) : "0", + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + message.validator_period !== undefined && (obj.validator_period = message.validator_period); + message.fraction !== undefined && (obj.fraction = message.fraction); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validator_period = object.validator_period ?? "0"; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validator_slash_events: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validator_slash_events) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_slash_events.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validator_slash_events: Array.isArray(object?.validator_slash_events) + ? object.validator_slash_events.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validator_slash_events) { + obj.validator_slash_events = message.validator_slash_events.map((e) => + e ? ValidatorSlashEvent.toJSON(e) : undefined + ); + } else { + obj.validator_slash_events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validator_slash_events = object.validator_slash_events?.map((e) => ValidatorSlashEvent.fromPartial(e)) || + []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { community_pool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.community_pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FeePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.community_pool.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + community_pool: Array.isArray(object?.community_pool) + ? object.community_pool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.community_pool) { + obj.community_pool = message.community_pool.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.community_pool = []; + } + return obj; + }, + + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.community_pool = object.community_pool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { + return { title: "", description: "", recipient: "", amount: [] }; +} + +export const CommunityPoolSpendProposal = { + encode(message: CommunityPoolSpendProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): CommunityPoolSpendProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommunityPoolSpendProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseDelegatorStartingInfo(): DelegatorStartingInfo { + return { previous_period: "0", stake: "", height: "0" }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previous_period !== "0") { + writer.uint32(8).uint64(message.previous_period); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (message.height !== "0") { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.previous_period = longToString(reader.uint64() as Long); + break; + case 2: + message.stake = reader.string(); + break; + case 3: + message.height = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previous_period: isSet(object.previous_period) ? String(object.previous_period) : "0", + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? String(object.height) : "0", + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + message.previous_period !== undefined && (obj.previous_period = message.previous_period); + message.stake !== undefined && (obj.stake = message.stake); + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previous_period = object.previous_period ?? "0"; + message.stake = object.stake ?? ""; + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validator_address: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_address = reader.string(); + break; + case 2: + message.reward.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + if (message.reward) { + obj.reward = message.reward.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.reward = []; + } + return obj; + }, + + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validator_address = object.validator_address ?? ""; + message.reward = object.reward?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { + return { title: "", description: "", recipient: "", amount: "", deposit: "" }; +} + +export const CommunityPoolSpendProposalWithDeposit = { + encode(message: CommunityPoolSpendProposalWithDeposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): CommunityPoolSpendProposalWithDeposit { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + deposit: isSet(object.deposit) ? String(object.deposit) : "", + }; + }, + + toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.recipient !== undefined && (obj.recipient = message.recipient); + message.amount !== undefined && (obj.amount = message.amount); + message.deposit !== undefined && (obj.deposit = message.deposit); + return obj; + }, + + fromPartial, I>>( + object: I, + ): 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; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/distribution/v1beta1/genesis.ts b/common/types/src/client/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..c07645dd --- /dev/null +++ b/common/types/src/client/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,822 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { DecCoin } from "../../base/v1beta1/coin"; +import { + DelegatorStartingInfo, + FeePool, + Params, + ValidatorAccumulatedCommission, + ValidatorCurrentRewards, + ValidatorHistoricalRewards, + ValidatorSlashEvent, +} from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * DelegatorWithdrawInfo is the address for where distributions rewards are + * withdrawn to by default this struct is only used at genesis to feed in + * default withdraw addresses. + */ +export interface DelegatorWithdrawInfo { + /** delegator_address is the address of the delegator. */ + delegator_address: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdraw_address: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** outstanding_rewards represents the oustanding rewards of a validator. */ + outstanding_rewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated?: ValidatorAccumulatedCommission; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** period defines the period the historical rewards apply to. */ + period: string; + /** rewards defines the historical rewards of a validator. */ + rewards?: ValidatorHistoricalRewards; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** rewards defines the current rewards of a validator. */ + rewards?: ValidatorCurrentRewards; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegator_address: string; + /** validator_address is the address of the validator. */ + validator_address: string; + /** starting_info defines the starting info of a delegator. */ + starting_info?: DelegatorStartingInfo; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** height defines the block height at which the slash event occured. */ + height: string; + /** period is the period of the slash event. */ + period: string; + /** validator_slash_event describes the slash event. */ + validator_slash_event?: ValidatorSlashEvent; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the paramaters of the module. */ + params?: Params; + /** fee_pool defines the fee pool at genesis. */ + fee_pool?: FeePool; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegator_withdraw_infos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previous_proposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstanding_rewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commisions of all validators at genesis. */ + validator_accumulated_commissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validator_historical_rewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validator_current_rewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegator_starting_infos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validator_slash_events: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegator_address: "", withdraw_address: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.withdraw_address !== "") { + writer.uint32(18).string(message.withdraw_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorWithdrawInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.withdraw_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + withdraw_address: isSet(object.withdraw_address) ? String(object.withdraw_address) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.withdraw_address !== undefined && (obj.withdraw_address = message.withdraw_address); + return obj; + }, + + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegator_address = object.delegator_address ?? ""; + message.withdraw_address = object.withdraw_address ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validator_address: "", outstanding_rewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + for (const v of message.outstanding_rewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorOutstandingRewardsRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.outstanding_rewards.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + outstanding_rewards: Array.isArray(object?.outstanding_rewards) + ? object.outstanding_rewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + if (message.outstanding_rewards) { + obj.outstanding_rewards = message.outstanding_rewards.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.outstanding_rewards = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validator_address = object.validator_address ?? ""; + message.outstanding_rewards = object.outstanding_rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validator_address: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.accumulated !== undefined) { + ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorAccumulatedCommissionRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommissionRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.accumulated !== undefined && + (obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toJSON(message.accumulated) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validator_address = object.validator_address ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validator_address: "", period: "0", rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.period !== "0") { + writer.uint32(16).uint64(message.period); + } + if (message.rewards !== undefined) { + ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewardsRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.period = longToString(reader.uint64() as Long); + break; + case 3: + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + period: isSet(object.period) ? String(object.period) : "0", + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.period !== undefined && (obj.period = message.period); + message.rewards !== undefined && + (obj.rewards = message.rewards ? ValidatorHistoricalRewards.toJSON(message.rewards) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validator_address = object.validator_address ?? ""; + message.period = object.period ?? "0"; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validator_address: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.rewards !== undefined) { + ValidatorCurrentRewards.encode(message.rewards, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorCurrentRewardsRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.rewards !== undefined && + (obj.rewards = message.rewards ? ValidatorCurrentRewards.toJSON(message.rewards) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validator_address = object.validator_address ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegator_address: "", validator_address: "", starting_info: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.starting_info !== undefined) { + DelegatorStartingInfo.encode(message.starting_info, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfoRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.starting_info = DelegatorStartingInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + starting_info: isSet(object.starting_info) ? DelegatorStartingInfo.fromJSON(object.starting_info) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.starting_info !== undefined && + (obj.starting_info = message.starting_info ? DelegatorStartingInfo.toJSON(message.starting_info) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.starting_info = (object.starting_info !== undefined && object.starting_info !== null) + ? DelegatorStartingInfo.fromPartial(object.starting_info) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validator_address: "", height: "0", period: "0", validator_slash_event: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.height !== "0") { + writer.uint32(16).uint64(message.height); + } + if (message.period !== "0") { + writer.uint32(24).uint64(message.period); + } + if (message.validator_slash_event !== undefined) { + ValidatorSlashEvent.encode(message.validator_slash_event, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEventRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.height = longToString(reader.uint64() as Long); + break; + case 3: + message.period = longToString(reader.uint64() as Long); + break; + case 4: + message.validator_slash_event = ValidatorSlashEvent.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + height: isSet(object.height) ? String(object.height) : "0", + period: isSet(object.period) ? String(object.period) : "0", + validator_slash_event: isSet(object.validator_slash_event) + ? ValidatorSlashEvent.fromJSON(object.validator_slash_event) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.height !== undefined && (obj.height = message.height); + message.period !== undefined && (obj.period = message.period); + message.validator_slash_event !== undefined && (obj.validator_slash_event = message.validator_slash_event + ? ValidatorSlashEvent.toJSON(message.validator_slash_event) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validator_address = object.validator_address ?? ""; + message.height = object.height ?? "0"; + message.period = object.period ?? "0"; + message.validator_slash_event = + (object.validator_slash_event !== undefined && object.validator_slash_event !== null) + ? ValidatorSlashEvent.fromPartial(object.validator_slash_event) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + fee_pool: undefined, + delegator_withdraw_infos: [], + previous_proposer: "", + outstanding_rewards: [], + validator_accumulated_commissions: [], + validator_historical_rewards: [], + validator_current_rewards: [], + delegator_starting_infos: [], + validator_slash_events: [], + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.fee_pool !== undefined) { + FeePool.encode(message.fee_pool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegator_withdraw_infos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previous_proposer !== "") { + writer.uint32(34).string(message.previous_proposer); + } + for (const v of message.outstanding_rewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validator_accumulated_commissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validator_historical_rewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validator_current_rewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegator_starting_infos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validator_slash_events) { + ValidatorSlashEventRecord.encode(v!, writer.uint32(82).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.fee_pool = FeePool.decode(reader, reader.uint32()); + break; + case 3: + message.delegator_withdraw_infos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + break; + case 4: + message.previous_proposer = reader.string(); + break; + case 5: + message.outstanding_rewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + break; + case 6: + message.validator_accumulated_commissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + break; + case 7: + message.validator_historical_rewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + break; + case 8: + message.validator_current_rewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + break; + case 9: + message.delegator_starting_infos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + break; + case 10: + message.validator_slash_events.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + fee_pool: isSet(object.fee_pool) ? FeePool.fromJSON(object.fee_pool) : undefined, + delegator_withdraw_infos: Array.isArray(object?.delegator_withdraw_infos) + ? object.delegator_withdraw_infos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previous_proposer: isSet(object.previous_proposer) ? String(object.previous_proposer) : "", + outstanding_rewards: Array.isArray(object?.outstanding_rewards) + ? object.outstanding_rewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validator_accumulated_commissions: Array.isArray(object?.validator_accumulated_commissions) + ? object.validator_accumulated_commissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validator_historical_rewards: Array.isArray(object?.validator_historical_rewards) + ? object.validator_historical_rewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validator_current_rewards: Array.isArray(object?.validator_current_rewards) + ? object.validator_current_rewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegator_starting_infos: Array.isArray(object?.delegator_starting_infos) + ? object.delegator_starting_infos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validator_slash_events: Array.isArray(object?.validator_slash_events) + ? object.validator_slash_events.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + message.fee_pool !== undefined && (obj.fee_pool = message.fee_pool ? FeePool.toJSON(message.fee_pool) : undefined); + if (message.delegator_withdraw_infos) { + obj.delegator_withdraw_infos = message.delegator_withdraw_infos.map((e) => + e ? DelegatorWithdrawInfo.toJSON(e) : undefined + ); + } else { + obj.delegator_withdraw_infos = []; + } + message.previous_proposer !== undefined && (obj.previous_proposer = message.previous_proposer); + if (message.outstanding_rewards) { + obj.outstanding_rewards = message.outstanding_rewards.map((e) => + e ? ValidatorOutstandingRewardsRecord.toJSON(e) : undefined + ); + } else { + obj.outstanding_rewards = []; + } + if (message.validator_accumulated_commissions) { + obj.validator_accumulated_commissions = message.validator_accumulated_commissions.map((e) => + e ? ValidatorAccumulatedCommissionRecord.toJSON(e) : undefined + ); + } else { + obj.validator_accumulated_commissions = []; + } + if (message.validator_historical_rewards) { + obj.validator_historical_rewards = message.validator_historical_rewards.map((e) => + e ? ValidatorHistoricalRewardsRecord.toJSON(e) : undefined + ); + } else { + obj.validator_historical_rewards = []; + } + if (message.validator_current_rewards) { + obj.validator_current_rewards = message.validator_current_rewards.map((e) => + e ? ValidatorCurrentRewardsRecord.toJSON(e) : undefined + ); + } else { + obj.validator_current_rewards = []; + } + if (message.delegator_starting_infos) { + obj.delegator_starting_infos = message.delegator_starting_infos.map((e) => + e ? DelegatorStartingInfoRecord.toJSON(e) : undefined + ); + } else { + obj.delegator_starting_infos = []; + } + if (message.validator_slash_events) { + obj.validator_slash_events = message.validator_slash_events.map((e) => + e ? ValidatorSlashEventRecord.toJSON(e) : undefined + ); + } else { + obj.validator_slash_events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.fee_pool = (object.fee_pool !== undefined && object.fee_pool !== null) + ? FeePool.fromPartial(object.fee_pool) + : undefined; + message.delegator_withdraw_infos = + object.delegator_withdraw_infos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || []; + message.previous_proposer = object.previous_proposer ?? ""; + message.outstanding_rewards = + object.outstanding_rewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validator_accumulated_commissions = + object.validator_accumulated_commissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validator_historical_rewards = + object.validator_historical_rewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validator_current_rewards = + object.validator_current_rewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegator_starting_infos = + object.delegator_starting_infos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validator_slash_events = + object.validator_slash_events?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/distribution/v1beta1/query.ts b/common/types/src/client/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..50a90ca0 --- /dev/null +++ b/common/types/src/client/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1269 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { DecCoin } from "../../base/v1beta1/coin"; +import { + DelegationDelegatorReward, + Params, + ValidatorAccumulatedCommission, + ValidatorOutstandingRewards, + ValidatorSlashEvent, +} from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validator_address: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards?: ValidatorOutstandingRewards; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validator_address: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commision the validator received. */ + commission?: ValidatorAccumulatedCommission; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validator_address: string; + /** starting_height defines the optional starting height to query the slashes. */ + starting_height: string; + /** starting_height defines the optional ending height to query the slashes. */ + ending_height: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryValidatorSlashesResponse is the response type for the + * Query/ValidatorSlashes RPC method. + */ +export interface QueryValidatorSlashesResponse { + /** slashes defines the slashes the validator received. */ + slashes: ValidatorSlashEvent[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; + /** validator_address defines the validator address to query for. */ + validator_address: string; +} + +/** + * QueryDelegationRewardsResponse is the response type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsResponse { + /** rewards defines the rewards accrued by a delegation. */ + rewards: DecCoin[]; +} + +/** + * QueryDelegationTotalRewardsRequest is the request type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; +} + +/** + * QueryDelegationTotalRewardsResponse is the response type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsResponse { + /** rewards defines all the rewards accrued by a delegator. */ + rewards: DelegationDelegatorReward[]; + /** total defines the sum of all the rewards. */ + total: DecCoin[]; +} + +/** + * QueryDelegatorValidatorsRequest is the request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; +} + +/** + * QueryDelegatorValidatorsResponse is the response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators a delegator is delegating for. */ + validators: string[]; +} + +/** + * QueryDelegatorWithdrawAddressRequest is the request type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdraw_address: string; +} + +/** + * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC + * method. + */ +export interface QueryCommunityPoolRequest { +} + +/** + * QueryCommunityPoolResponse is the response type for the Query/CommunityPool + * RPC method. + */ +export interface QueryCommunityPoolResponse { + /** pool defines community pool's coins. */ + pool: DecCoin[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validator_address: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validator_address: isSet(object.validator_address) ? String(object.validator_address) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { + return { rewards: undefined }; +} + +export const QueryValidatorOutstandingRewardsResponse = { + encode(message: QueryValidatorOutstandingRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.rewards !== undefined) { + ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + message.rewards !== undefined && + (obj.rewards = message.rewards ? ValidatorOutstandingRewards.toJSON(message.rewards) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsResponse { + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorOutstandingRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorCommissionRequest(): QueryValidatorCommissionRequest { + return { validator_address: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorCommissionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validator_address: isSet(object.validator_address) ? String(object.validator_address) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { + return { commission: undefined }; +} + +export const QueryValidatorCommissionResponse = { + encode(message: QueryValidatorCommissionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.commission !== undefined) { + ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + message.commission !== undefined && + (obj.commission = message.commission ? ValidatorAccumulatedCommission.toJSON(message.commission) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionResponse { + const message = createBaseQueryValidatorCommissionResponse(); + message.commission = (object.commission !== undefined && object.commission !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.commission) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSlashesRequest(): QueryValidatorSlashesRequest { + return { validator_address: "", starting_height: "0", ending_height: "0", pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.starting_height !== "0") { + writer.uint32(16).uint64(message.starting_height); + } + if (message.ending_height !== "0") { + writer.uint32(24).uint64(message.ending_height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorSlashesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSlashesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.starting_height = longToString(reader.uint64() as Long); + break; + case 3: + message.ending_height = longToString(reader.uint64() as Long); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + starting_height: isSet(object.starting_height) ? String(object.starting_height) : "0", + ending_height: isSet(object.ending_height) ? String(object.ending_height) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.starting_height !== undefined && (obj.starting_height = message.starting_height); + message.ending_height !== undefined && (obj.ending_height = message.ending_height); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validator_address = object.validator_address ?? ""; + message.starting_height = object.starting_height ?? "0"; + message.ending_height = object.ending_height ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSlashesResponse(): QueryValidatorSlashesResponse { + return { slashes: [], pagination: undefined }; +} + +export const QueryValidatorSlashesResponse = { + encode(message: QueryValidatorSlashesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.slashes) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorSlashesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSlashesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesResponse { + return { + slashes: Array.isArray(object?.slashes) ? object.slashes.map((e: any) => ValidatorSlashEvent.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesResponse): unknown { + const obj: any = {}; + if (message.slashes) { + obj.slashes = message.slashes.map((e) => e ? ValidatorSlashEvent.toJSON(e) : undefined); + } else { + obj.slashes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorSlashesResponse { + const message = createBaseQueryValidatorSlashesResponse(); + message.slashes = object.slashes?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegationRewardsRequest(): QueryDelegationRewardsRequest { + return { delegator_address: "", validator_address: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { + return { rewards: [] }; +} + +export const QueryDelegationRewardsResponse = { + encode(message: QueryDelegationRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRewardsResponse(); + 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; + }, + + fromJSON(object: any): QueryDelegationRewardsResponse { + return { rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryDelegationRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.rewards = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegator_address: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationTotalRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegator_address = object.delegator_address ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { + return { rewards: [], total: [] }; +} + +export const QueryDelegationTotalRewardsResponse = { + encode(message: QueryDelegationTotalRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rewards) { + DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.total) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationTotalRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + break; + case 2: + message.total.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsResponse { + return { + rewards: Array.isArray(object?.rewards) + ? object.rewards.map((e: any) => DelegationDelegatorReward.fromJSON(e)) + : [], + total: Array.isArray(object?.total) ? object.total.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationTotalRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => e ? DelegationDelegatorReward.toJSON(e) : undefined); + } else { + obj.rewards = []; + } + if (message.total) { + obj.total = message.total.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.total = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsResponse { + const message = createBaseQueryDelegationTotalRewardsResponse(); + message.rewards = object.rewards?.map((e) => DelegationDelegatorReward.fromPartial(e)) || []; + message.total = object.total?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegator_address: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegator_address = object.delegator_address ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [] }; +} + +export const QueryDelegatorValidatorsResponse = { + encode(message: QueryDelegatorValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validators) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e); + } else { + obj.validators = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegator_address: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegator_address = object.delegator_address ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdraw_address: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdraw_address !== "") { + writer.uint32(10).string(message.withdraw_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.withdraw_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdraw_address: isSet(object.withdraw_address) ? String(object.withdraw_address) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + message.withdraw_address !== undefined && (obj.withdraw_address = message.withdraw_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdraw_address = object.withdraw_address ?? ""; + return message; + }, +}; + +function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { + return {}; +} + +export const QueryCommunityPoolRequest = { + encode(_: QueryCommunityPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommunityPoolRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, +}; + +function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { + return { pool: [] }; +} + +export const QueryCommunityPoolResponse = { + encode(message: QueryCommunityPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommunityPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCommunityPoolResponse { + return { pool: Array.isArray(object?.pool) ? object.pool.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryCommunityPoolResponse): unknown { + const obj: any = {}; + if (message.pool) { + obj.pool = message.pool.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.pool = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryCommunityPoolResponse { + const message = createBaseQueryCommunityPoolResponse(); + message.pool = object.pool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +/** Query defines the gRPC querier service for distribution module. */ +export interface Query { + /** Params queries params of the distribution module. */ + Params(request: QueryParamsRequest): Promise; + /** ValidatorOutstandingRewards queries rewards of a validator address. */ + ValidatorOutstandingRewards( + request: QueryValidatorOutstandingRewardsRequest, + ): Promise; + /** ValidatorCommission queries accumulated commission for a validator. */ + ValidatorCommission(request: QueryValidatorCommissionRequest): Promise; + /** ValidatorSlashes queries slash events of a validator. */ + ValidatorSlashes(request: QueryValidatorSlashesRequest): Promise; + /** DelegationRewards queries the total rewards accrued by a delegation. */ + DelegationRewards(request: QueryDelegationRewardsRequest): Promise; + /** + * DelegationTotalRewards queries the total rewards accrued by a each + * validator. + */ + DelegationTotalRewards(request: QueryDelegationTotalRewardsRequest): Promise; + /** DelegatorValidators queries the validators of a delegator. */ + DelegatorValidators(request: QueryDelegatorValidatorsRequest): Promise; + /** DelegatorWithdrawAddress queries withdraw address of a delegator. */ + DelegatorWithdrawAddress( + request: QueryDelegatorWithdrawAddressRequest, + ): Promise; + /** CommunityPool queries the community pool coins. */ + CommunityPool(request: QueryCommunityPoolRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.distribution.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorOutstandingRewards = this.ValidatorOutstandingRewards.bind(this); + this.ValidatorCommission = this.ValidatorCommission.bind(this); + this.ValidatorSlashes = this.ValidatorSlashes.bind(this); + this.DelegationRewards = this.DelegationRewards.bind(this); + this.DelegationTotalRewards = this.DelegationTotalRewards.bind(this); + this.DelegatorValidators = this.DelegatorValidators.bind(this); + this.DelegatorWithdrawAddress = this.DelegatorWithdrawAddress.bind(this); + this.CommunityPool = this.CommunityPool.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + ValidatorOutstandingRewards( + request: QueryValidatorOutstandingRewardsRequest, + ): Promise { + const data = QueryValidatorOutstandingRewardsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorOutstandingRewards", data); + return promise.then((data) => QueryValidatorOutstandingRewardsResponse.decode(new _m0.Reader(data))); + } + + ValidatorCommission(request: QueryValidatorCommissionRequest): Promise { + const data = QueryValidatorCommissionRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorCommission", data); + return promise.then((data) => QueryValidatorCommissionResponse.decode(new _m0.Reader(data))); + } + + ValidatorSlashes(request: QueryValidatorSlashesRequest): Promise { + const data = QueryValidatorSlashesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSlashes", data); + return promise.then((data) => QueryValidatorSlashesResponse.decode(new _m0.Reader(data))); + } + + DelegationRewards(request: QueryDelegationRewardsRequest): Promise { + const data = QueryDelegationRewardsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegationRewards", data); + return promise.then((data) => QueryDelegationRewardsResponse.decode(new _m0.Reader(data))); + } + + DelegationTotalRewards(request: QueryDelegationTotalRewardsRequest): Promise { + const data = QueryDelegationTotalRewardsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegationTotalRewards", data); + return promise.then((data) => QueryDelegationTotalRewardsResponse.decode(new _m0.Reader(data))); + } + + DelegatorValidators(request: QueryDelegatorValidatorsRequest): Promise { + const data = QueryDelegatorValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorValidators", data); + return promise.then((data) => QueryDelegatorValidatorsResponse.decode(new _m0.Reader(data))); + } + + DelegatorWithdrawAddress( + request: QueryDelegatorWithdrawAddressRequest, + ): Promise { + const data = QueryDelegatorWithdrawAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorWithdrawAddress", data); + return promise.then((data) => QueryDelegatorWithdrawAddressResponse.decode(new _m0.Reader(data))); + } + + CommunityPool(request: QueryCommunityPoolRequest): Promise { + const data = QueryCommunityPoolRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPool", data); + return promise.then((data) => QueryCommunityPoolResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/distribution/v1beta1/tx.ts b/common/types/src/client/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..5232c4d1 --- /dev/null +++ b/common/types/src/client/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,550 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegator_address: string; + withdraw_address: string; +} + +/** MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. */ +export interface MsgSetWithdrawAddressResponse { +} + +/** + * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + * from a single validator. + */ +export interface MsgWithdrawDelegatorReward { + delegator_address: string; + validator_address: string; +} + +/** MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. */ +export interface MsgWithdrawDelegatorRewardResponse { + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validator_address: string; +} + +/** MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. */ +export interface MsgWithdrawValidatorCommissionResponse { + amount: Coin[]; +} + +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPool { + amount: Coin[]; + depositor: string; +} + +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegator_address: "", withdraw_address: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.withdraw_address !== "") { + writer.uint32(18).string(message.withdraw_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.withdraw_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + withdraw_address: isSet(object.withdraw_address) ? String(object.withdraw_address) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.withdraw_address !== undefined && (obj.withdraw_address = message.withdraw_address); + return obj; + }, + + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegator_address = object.delegator_address ?? ""; + message.withdraw_address = object.withdraw_address ?? ""; + return message; + }, +}; + +function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { + return {}; +} + +export const MsgSetWithdrawAddressResponse = { + encode(_: MsgSetWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegator_address: "", validator_address: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { + return { amount: [] }; +} + +export const MsgWithdrawDelegatorRewardResponse = { + encode(message: MsgWithdrawDelegatorRewardResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgWithdrawDelegatorRewardResponse { + return { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawDelegatorRewardResponse): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validator_address: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validator_address: isSet(object.validator_address) ? String(object.validator_address) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { + return { amount: [] }; +} + +export const MsgWithdrawValidatorCommissionResponse = { + encode(message: MsgWithdrawValidatorCommissionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommissionResponse { + return { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommissionResponse { + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { + return { amount: [], depositor: "" }; +} + +export const MsgFundCommunityPool = { + encode(message: MsgFundCommunityPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgFundCommunityPool { + return { + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + depositor: isSet(object.depositor) ? String(object.depositor) : "", + }; + }, + + toJSON(message: MsgFundCommunityPool): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + + fromPartial, I>>(object: I): MsgFundCommunityPool { + const message = createBaseMsgFundCommunityPool(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse { + return {}; +} + +export const MsgFundCommunityPoolResponse = { + encode(_: MsgFundCommunityPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +/** Msg defines the distribution Msg service. */ +export interface Msg { + /** + * SetWithdrawAddress defines a method to change the withdraw address + * for a delegator (or validator self-delegation). + */ + SetWithdrawAddress(request: MsgSetWithdrawAddress): Promise; + /** + * WithdrawDelegatorReward defines a method to withdraw rewards of delegator + * from a single validator. + */ + WithdrawDelegatorReward(request: MsgWithdrawDelegatorReward): Promise; + /** + * WithdrawValidatorCommission defines a method to withdraw the + * full commission to the validator address. + */ + WithdrawValidatorCommission(request: MsgWithdrawValidatorCommission): Promise; + /** + * FundCommunityPool defines a method to allow an account to directly + * fund the community pool. + */ + FundCommunityPool(request: MsgFundCommunityPool): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.distribution.v1beta1.Msg"; + this.rpc = rpc; + this.SetWithdrawAddress = this.SetWithdrawAddress.bind(this); + this.WithdrawDelegatorReward = this.WithdrawDelegatorReward.bind(this); + this.WithdrawValidatorCommission = this.WithdrawValidatorCommission.bind(this); + this.FundCommunityPool = this.FundCommunityPool.bind(this); + } + SetWithdrawAddress(request: MsgSetWithdrawAddress): Promise { + const data = MsgSetWithdrawAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetWithdrawAddress", data); + return promise.then((data) => MsgSetWithdrawAddressResponse.decode(new _m0.Reader(data))); + } + + WithdrawDelegatorReward(request: MsgWithdrawDelegatorReward): Promise { + const data = MsgWithdrawDelegatorReward.encode(request).finish(); + const promise = this.rpc.request(this.service, "WithdrawDelegatorReward", data); + return promise.then((data) => MsgWithdrawDelegatorRewardResponse.decode(new _m0.Reader(data))); + } + + WithdrawValidatorCommission( + request: MsgWithdrawValidatorCommission, + ): Promise { + const data = MsgWithdrawValidatorCommission.encode(request).finish(); + const promise = this.rpc.request(this.service, "WithdrawValidatorCommission", data); + return promise.then((data) => MsgWithdrawValidatorCommissionResponse.decode(new _m0.Reader(data))); + } + + FundCommunityPool(request: MsgFundCommunityPool): Promise { + const data = MsgFundCommunityPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "FundCommunityPool", data); + return promise.then((data) => MsgFundCommunityPoolResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/evidence/v1beta1/evidence.ts b/common/types/src/client/cosmos/evidence/v1beta1/evidence.ts new file mode 100644 index 00000000..8ea296ed --- /dev/null +++ b/common/types/src/client/cosmos/evidence/v1beta1/evidence.ts @@ -0,0 +1,139 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.evidence.v1beta1"; + +/** + * Equivocation implements the Evidence interface and defines evidence of double + * signing misbehavior. + */ +export interface Equivocation { + height: string; + time?: Date; + power: string; + consensus_address: string; +} + +function createBaseEquivocation(): Equivocation { + return { height: "0", time: undefined, power: "0", consensus_address: "" }; +} + +export const Equivocation = { + encode(message: Equivocation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).ldelim(); + } + if (message.power !== "0") { + writer.uint32(24).int64(message.power); + } + if (message.consensus_address !== "") { + writer.uint32(34).string(message.consensus_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Equivocation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEquivocation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = longToString(reader.int64() as Long); + break; + case 2: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.power = longToString(reader.int64() as Long); + break; + case 4: + message.consensus_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Equivocation { + return { + height: isSet(object.height) ? String(object.height) : "0", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + power: isSet(object.power) ? String(object.power) : "0", + consensus_address: isSet(object.consensus_address) ? String(object.consensus_address) : "", + }; + }, + + toJSON(message: Equivocation): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.power !== undefined && (obj.power = message.power); + message.consensus_address !== undefined && (obj.consensus_address = message.consensus_address); + return obj; + }, + + fromPartial, I>>(object: I): Equivocation { + const message = createBaseEquivocation(); + message.height = object.height ?? "0"; + message.time = object.time ?? undefined; + message.power = object.power ?? "0"; + message.consensus_address = object.consensus_address ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/evidence/v1beta1/genesis.ts b/common/types/src/client/cosmos/evidence/v1beta1/genesis.ts new file mode 100644 index 00000000..1c72de38 --- /dev/null +++ b/common/types/src/client/cosmos/evidence/v1beta1/genesis.ts @@ -0,0 +1,73 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.evidence.v1beta1"; + +/** GenesisState defines the evidence module's genesis state. */ +export interface GenesisState { + /** evidence defines all the evidence at genesis. */ + evidence: Any[]; +} + +function createBaseGenesisState(): GenesisState { + return { evidence: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { evidence: Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [] }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.evidence = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.evidence = object.evidence?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/client/cosmos/evidence/v1beta1/query.ts b/common/types/src/client/cosmos/evidence/v1beta1/query.ts new file mode 100644 index 00000000..00a3f793 --- /dev/null +++ b/common/types/src/client/cosmos/evidence/v1beta1/query.ts @@ -0,0 +1,345 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +export const protobufPackage = "cosmos.evidence.v1beta1"; + +/** QueryEvidenceRequest is the request type for the Query/Evidence RPC method. */ +export interface QueryEvidenceRequest { + /** evidence_hash defines the hash of the requested evidence. */ + evidence_hash: Uint8Array; +} + +/** QueryEvidenceResponse is the response type for the Query/Evidence RPC method. */ +export interface QueryEvidenceResponse { + /** evidence returns the requested evidence. */ + evidence?: Any; +} + +/** + * QueryEvidenceRequest is the request type for the Query/AllEvidence RPC + * method. + */ +export interface QueryAllEvidenceRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryAllEvidenceResponse is the response type for the Query/AllEvidence RPC + * method. + */ +export interface QueryAllEvidenceResponse { + /** evidence returns all evidences. */ + evidence: Any[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { + return { evidence_hash: new Uint8Array() }; +} + +export const QueryEvidenceRequest = { + encode(message: QueryEvidenceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.evidence_hash.length !== 0) { + writer.uint32(10).bytes(message.evidence_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryEvidenceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEvidenceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryEvidenceRequest { + return { evidence_hash: isSet(object.evidence_hash) ? bytesFromBase64(object.evidence_hash) : new Uint8Array() }; + }, + + toJSON(message: QueryEvidenceRequest): unknown { + const obj: any = {}; + message.evidence_hash !== undefined && + (obj.evidence_hash = base64FromBytes( + message.evidence_hash !== undefined ? message.evidence_hash : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): QueryEvidenceRequest { + const message = createBaseQueryEvidenceRequest(); + message.evidence_hash = object.evidence_hash ?? new Uint8Array(); + return message; + }, +}; + +function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { + return { evidence: undefined }; +} + +export const QueryEvidenceResponse = { + encode(message: QueryEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryEvidenceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEvidenceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryEvidenceResponse { + return { evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined }; + }, + + toJSON(message: QueryEvidenceResponse): unknown { + const obj: any = {}; + message.evidence !== undefined && (obj.evidence = message.evidence ? Any.toJSON(message.evidence) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryEvidenceResponse { + const message = createBaseQueryEvidenceResponse(); + message.evidence = (object.evidence !== undefined && object.evidence !== null) + ? Any.fromPartial(object.evidence) + : undefined; + return message; + }, +}; + +function createBaseQueryAllEvidenceRequest(): QueryAllEvidenceRequest { + return { pagination: undefined }; +} + +export const QueryAllEvidenceRequest = { + encode(message: QueryAllEvidenceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEvidenceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllEvidenceRequest(); + 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; + }, + + fromJSON(object: any): QueryAllEvidenceRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAllEvidenceRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllEvidenceRequest { + const message = createBaseQueryAllEvidenceRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllEvidenceResponse(): QueryAllEvidenceResponse { + return { evidence: [], pagination: undefined }; +} + +export const QueryAllEvidenceResponse = { + encode(message: QueryAllEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEvidenceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllEvidenceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence.push(Any.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceResponse { + return { + evidence: Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllEvidenceResponse): unknown { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.evidence = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllEvidenceResponse { + const message = createBaseQueryAllEvidenceResponse(); + message.evidence = object.evidence?.map((e) => Any.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Evidence queries evidence based on evidence hash. */ + Evidence(request: QueryEvidenceRequest): Promise; + /** AllEvidence queries all evidence. */ + AllEvidence(request: QueryAllEvidenceRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.evidence.v1beta1.Query"; + this.rpc = rpc; + this.Evidence = this.Evidence.bind(this); + this.AllEvidence = this.AllEvidence.bind(this); + } + Evidence(request: QueryEvidenceRequest): Promise { + const data = QueryEvidenceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Evidence", data); + return promise.then((data) => QueryEvidenceResponse.decode(new _m0.Reader(data))); + } + + AllEvidence(request: QueryAllEvidenceRequest): Promise { + const data = QueryAllEvidenceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AllEvidence", data); + return promise.then((data) => QueryAllEvidenceResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/evidence/v1beta1/tx.ts b/common/types/src/client/cosmos/evidence/v1beta1/tx.ts new file mode 100644 index 00000000..1901a2ee --- /dev/null +++ b/common/types/src/client/cosmos/evidence/v1beta1/tx.ts @@ -0,0 +1,215 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.evidence.v1beta1"; + +/** + * MsgSubmitEvidence represents a message that supports submitting arbitrary + * Evidence of misbehavior such as equivocation or counterfactual signing. + */ +export interface MsgSubmitEvidence { + submitter: string; + evidence?: Any; +} + +/** MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. */ +export interface MsgSubmitEvidenceResponse { + /** hash defines the hash of the evidence. */ + hash: Uint8Array; +} + +function createBaseMsgSubmitEvidence(): MsgSubmitEvidence { + return { submitter: "", evidence: undefined }; +} + +export const MsgSubmitEvidence = { + encode(message: MsgSubmitEvidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.submitter !== "") { + writer.uint32(10).string(message.submitter); + } + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitEvidence { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.submitter = reader.string(); + break; + case 2: + message.evidence = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidence { + return { + submitter: isSet(object.submitter) ? String(object.submitter) : "", + evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined, + }; + }, + + toJSON(message: MsgSubmitEvidence): unknown { + const obj: any = {}; + message.submitter !== undefined && (obj.submitter = message.submitter); + message.evidence !== undefined && (obj.evidence = message.evidence ? Any.toJSON(message.evidence) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitEvidence { + const message = createBaseMsgSubmitEvidence(); + message.submitter = object.submitter ?? ""; + message.evidence = (object.evidence !== undefined && object.evidence !== null) + ? Any.fromPartial(object.evidence) + : undefined; + return message; + }, +}; + +function createBaseMsgSubmitEvidenceResponse(): MsgSubmitEvidenceResponse { + return { hash: new Uint8Array() }; +} + +export const MsgSubmitEvidenceResponse = { + encode(message: MsgSubmitEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitEvidenceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEvidenceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidenceResponse { + return { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array() }; + }, + + toJSON(message: MsgSubmitEvidenceResponse): unknown { + const obj: any = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitEvidenceResponse { + const message = createBaseMsgSubmitEvidenceResponse(); + message.hash = object.hash ?? new Uint8Array(); + return message; + }, +}; + +/** Msg defines the evidence Msg service. */ +export interface Msg { + /** + * SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + * counterfactual signing. + */ + SubmitEvidence(request: MsgSubmitEvidence): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.evidence.v1beta1.Msg"; + this.rpc = rpc; + this.SubmitEvidence = this.SubmitEvidence.bind(this); + } + SubmitEvidence(request: MsgSubmitEvidence): Promise { + const data = MsgSubmitEvidence.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEvidence", data); + return promise.then((data) => MsgSubmitEvidenceResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/feegrant/v1beta1/feegrant.ts b/common/types/src/client/cosmos/feegrant/v1beta1/feegrant.ts new file mode 100644 index 00000000..d10f8c3d --- /dev/null +++ b/common/types/src/client/cosmos/feegrant/v1beta1/feegrant.ts @@ -0,0 +1,405 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.feegrant.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** + * BasicAllowance implements Allowance with a one-time grant of tokens + * that optionally expires. The grantee can use up to SpendLimit to cover fees. + */ +export interface BasicAllowance { + /** + * spend_limit specifies the maximum amount of tokens that can be spent + * by this allowance and will be updated as tokens are spent. If it is + * empty, there is no spend limit and any amount of coins can be spent. + */ + spend_limit: Coin[]; + /** expiration specifies an optional time when this allowance expires */ + expiration?: Date; +} + +/** + * PeriodicAllowance extends Allowance to allow for both a maximum cap, + * as well as a limit per time period. + */ +export interface PeriodicAllowance { + /** basic specifies a struct of `BasicAllowance` */ + basic?: BasicAllowance; + /** + * period specifies the time duration in which period_spend_limit coins can + * be spent before that allowance is reset + */ + period?: Duration; + /** + * period_spend_limit specifies the maximum number of coins that can be spent + * in the period + */ + period_spend_limit: Coin[]; + /** period_can_spend is the number of coins left to be spent before the period_reset time */ + period_can_spend: Coin[]; + /** + * period_reset is the time at which this period resets and a new one begins, + * it is calculated from the start time of the first transaction after the + * last period ended + */ + period_reset?: Date; +} + +/** AllowedMsgAllowance creates allowance only for specified message types. */ +export interface AllowedMsgAllowance { + /** allowance can be any of basic and periodic fee allowance. */ + allowance?: Any; + /** allowed_messages are the messages for which the grantee has the access. */ + allowed_messages: string[]; +} + +/** Grant is stored in the KVStore to record a grant with full context */ +export interface Grant { + /** 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; +} + +function createBaseBasicAllowance(): BasicAllowance { + return { spend_limit: [], expiration: undefined }; +} + +export const BasicAllowance = { + encode(message: BasicAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.spend_limit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BasicAllowance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBasicAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.spend_limit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BasicAllowance { + return { + spend_limit: Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromJSON(e)) : [], + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: BasicAllowance): unknown { + const obj: any = {}; + if (message.spend_limit) { + obj.spend_limit = message.spend_limit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.spend_limit = []; + } + message.expiration !== undefined && (obj.expiration = message.expiration.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): BasicAllowance { + const message = createBaseBasicAllowance(); + message.spend_limit = object.spend_limit?.map((e) => Coin.fromPartial(e)) || []; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBasePeriodicAllowance(): PeriodicAllowance { + return { basic: undefined, period: undefined, period_spend_limit: [], period_can_spend: [], period_reset: undefined }; +} + +export const PeriodicAllowance = { + encode(message: PeriodicAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.basic !== undefined) { + BasicAllowance.encode(message.basic, writer.uint32(10).fork()).ldelim(); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.period_spend_limit) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.period_can_spend) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.period_reset !== undefined) { + Timestamp.encode(toTimestamp(message.period_reset), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PeriodicAllowance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.basic = BasicAllowance.decode(reader, reader.uint32()); + break; + case 2: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.period_spend_limit.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.period_can_spend.push(Coin.decode(reader, reader.uint32())); + break; + case 5: + message.period_reset = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PeriodicAllowance { + return { + basic: isSet(object.basic) ? BasicAllowance.fromJSON(object.basic) : undefined, + period: isSet(object.period) ? Duration.fromJSON(object.period) : undefined, + period_spend_limit: Array.isArray(object?.period_spend_limit) + ? object.period_spend_limit.map((e: any) => Coin.fromJSON(e)) + : [], + period_can_spend: Array.isArray(object?.period_can_spend) + ? object.period_can_spend.map((e: any) => Coin.fromJSON(e)) + : [], + period_reset: isSet(object.period_reset) ? fromJsonTimestamp(object.period_reset) : undefined, + }; + }, + + toJSON(message: PeriodicAllowance): unknown { + const obj: any = {}; + message.basic !== undefined && (obj.basic = message.basic ? BasicAllowance.toJSON(message.basic) : undefined); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + if (message.period_spend_limit) { + obj.period_spend_limit = message.period_spend_limit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.period_spend_limit = []; + } + if (message.period_can_spend) { + obj.period_can_spend = message.period_can_spend.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.period_can_spend = []; + } + message.period_reset !== undefined && (obj.period_reset = message.period_reset.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): PeriodicAllowance { + const message = createBasePeriodicAllowance(); + message.basic = (object.basic !== undefined && object.basic !== null) + ? BasicAllowance.fromPartial(object.basic) + : undefined; + message.period = (object.period !== undefined && object.period !== null) + ? Duration.fromPartial(object.period) + : undefined; + message.period_spend_limit = object.period_spend_limit?.map((e) => Coin.fromPartial(e)) || []; + message.period_can_spend = object.period_can_spend?.map((e) => Coin.fromPartial(e)) || []; + message.period_reset = object.period_reset ?? undefined; + return message; + }, +}; + +function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { + return { allowance: undefined, allowed_messages: [] }; +} + +export const AllowedMsgAllowance = { + encode(message: AllowedMsgAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.allowed_messages) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AllowedMsgAllowance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllowedMsgAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowance = Any.decode(reader, reader.uint32()); + break; + case 2: + message.allowed_messages.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AllowedMsgAllowance { + return { + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + allowed_messages: Array.isArray(object?.allowed_messages) + ? object.allowed_messages.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: AllowedMsgAllowance): unknown { + const obj: any = {}; + message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toJSON(message.allowance) : undefined); + if (message.allowed_messages) { + obj.allowed_messages = message.allowed_messages.map((e) => e); + } else { + obj.allowed_messages = []; + } + return obj; + }, + + fromPartial, I>>(object: I): AllowedMsgAllowance { + const message = createBaseAllowedMsgAllowance(); + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Any.fromPartial(object.allowance) + : undefined; + message.allowed_messages = object.allowed_messages?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGrant(): Grant { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const Grant = { + encode(message: Grant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Grant { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.allowance = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Grant { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: Grant): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toJSON(message.allowance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Grant { + const message = createBaseGrant(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Any.fromPartial(object.allowance) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/feegrant/v1beta1/genesis.ts b/common/types/src/client/cosmos/feegrant/v1beta1/genesis.ts new file mode 100644 index 00000000..ff8d4af5 --- /dev/null +++ b/common/types/src/client/cosmos/feegrant/v1beta1/genesis.ts @@ -0,0 +1,76 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Grant } from "./feegrant"; + +export const protobufPackage = "cosmos.feegrant.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** GenesisState contains a set of fee allowances, persisted from the store */ +export interface GenesisState { + allowances: Grant[]; +} + +function createBaseGenesisState(): GenesisState { + return { allowances: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowances.push(Grant.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + allowances: Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map((e) => e ? Grant.toJSON(e) : undefined); + } else { + obj.allowances = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.allowances = object.allowances?.map((e) => Grant.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/client/cosmos/feegrant/v1beta1/query.ts b/common/types/src/client/cosmos/feegrant/v1beta1/query.ts new file mode 100644 index 00000000..d848ef96 --- /dev/null +++ b/common/types/src/client/cosmos/feegrant/v1beta1/query.ts @@ -0,0 +1,477 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Grant } from "./feegrant"; + +export const protobufPackage = "cosmos.feegrant.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ +export interface QueryAllowanceRequest { + /** 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; +} + +/** QueryAllowanceResponse is the response type for the Query/Allowance RPC method. */ +export interface QueryAllowanceResponse { + /** allowance is a allowance granted for grantee by granter. */ + allowance?: Grant; +} + +/** QueryAllowancesRequest is the request type for the Query/Allowances RPC method. */ +export interface QueryAllowancesRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryAllowancesResponse is the response type for the Query/Allowances RPC method. */ +export interface QueryAllowancesResponse { + /** allowances are allowance's granted for grantee by granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +/** QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. */ +export interface QueryAllowancesByGranterRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. */ +export interface QueryAllowancesByGranterResponse { + /** allowances that have been issued by the granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { + return { granter: "", grantee: "" }; +} + +export const QueryAllowanceRequest = { + encode(message: QueryAllowanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowanceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowanceRequest(); + 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; + }, + + fromJSON(object: any): QueryAllowanceRequest { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + }; + }, + + toJSON(message: QueryAllowanceRequest): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllowanceRequest { + const message = createBaseQueryAllowanceRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseQueryAllowanceResponse(): QueryAllowanceResponse { + return { allowance: undefined }; +} + +export const QueryAllowanceResponse = { + encode(message: QueryAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.allowance !== undefined) { + Grant.encode(message.allowance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowance = Grant.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllowanceResponse { + return { allowance: isSet(object.allowance) ? Grant.fromJSON(object.allowance) : undefined }; + }, + + toJSON(message: QueryAllowanceResponse): unknown { + const obj: any = {}; + message.allowance !== undefined && + (obj.allowance = message.allowance ? Grant.toJSON(message.allowance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllowanceResponse { + const message = createBaseQueryAllowanceResponse(); + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Grant.fromPartial(object.allowance) + : undefined; + return message; + }, +}; + +function createBaseQueryAllowancesRequest(): QueryAllowancesRequest { + return { grantee: "", pagination: undefined }; +} + +export const QueryAllowancesRequest = { + encode(message: QueryAllowancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grantee = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllowancesRequest { + return { + grantee: isSet(object.grantee) ? String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesRequest): unknown { + const obj: any = {}; + message.grantee !== undefined && (obj.grantee = message.grantee); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllowancesRequest { + const message = createBaseQueryAllowancesRequest(); + message.grantee = object.grantee ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllowancesResponse(): QueryAllowancesResponse { + return { allowances: [], pagination: undefined }; +} + +export const QueryAllowancesResponse = { + encode(message: QueryAllowancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowances.push(Grant.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllowancesResponse { + return { + allowances: Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesResponse): unknown { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map((e) => e ? Grant.toJSON(e) : undefined); + } else { + obj.allowances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllowancesResponse { + const message = createBaseQueryAllowancesResponse(); + message.allowances = object.allowances?.map((e) => Grant.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllowancesByGranterRequest(): QueryAllowancesByGranterRequest { + return { granter: "", pagination: undefined }; +} + +export const QueryAllowancesByGranterRequest = { + encode(message: QueryAllowancesByGranterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesByGranterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterRequest { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesByGranterRequest): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAllowancesByGranterRequest { + const message = createBaseQueryAllowancesByGranterRequest(); + message.granter = object.granter ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllowancesByGranterResponse(): QueryAllowancesByGranterResponse { + return { allowances: [], pagination: undefined }; +} + +export const QueryAllowancesByGranterResponse = { + encode(message: QueryAllowancesByGranterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesByGranterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowances.push(Grant.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterResponse { + return { + allowances: Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesByGranterResponse): unknown { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map((e) => e ? Grant.toJSON(e) : undefined); + } else { + obj.allowances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAllowancesByGranterResponse { + const message = createBaseQueryAllowancesByGranterResponse(); + message.allowances = object.allowances?.map((e) => Grant.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Allowance returns fee granted to the grantee by the granter. */ + Allowance(request: QueryAllowanceRequest): Promise; + /** Allowances returns all the grants for address. */ + Allowances(request: QueryAllowancesRequest): Promise; + /** + * AllowancesByGranter returns all the grants given by an address + * Since v0.46 + */ + AllowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.feegrant.v1beta1.Query"; + this.rpc = rpc; + this.Allowance = this.Allowance.bind(this); + this.Allowances = this.Allowances.bind(this); + this.AllowancesByGranter = this.AllowancesByGranter.bind(this); + } + Allowance(request: QueryAllowanceRequest): Promise { + const data = QueryAllowanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Allowance", data); + return promise.then((data) => QueryAllowanceResponse.decode(new _m0.Reader(data))); + } + + Allowances(request: QueryAllowancesRequest): Promise { + const data = QueryAllowancesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Allowances", data); + return promise.then((data) => QueryAllowancesResponse.decode(new _m0.Reader(data))); + } + + AllowancesByGranter(request: QueryAllowancesByGranterRequest): Promise { + const data = QueryAllowancesByGranterRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AllowancesByGranter", data); + return promise.then((data) => QueryAllowancesByGranterResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/feegrant/v1beta1/tx.ts b/common/types/src/client/cosmos/feegrant/v1beta1/tx.ts new file mode 100644 index 00000000..52ae7023 --- /dev/null +++ b/common/types/src/client/cosmos/feegrant/v1beta1/tx.ts @@ -0,0 +1,296 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.feegrant.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** + * 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; +} + +/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */ +export interface MsgGrantAllowanceResponse { +} + +/** 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; +} + +/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ +export interface MsgRevokeAllowanceResponse { +} + +function createBaseMsgGrantAllowance(): MsgGrantAllowance { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const MsgGrantAllowance = { + encode(message: MsgGrantAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgGrantAllowance { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: MsgGrantAllowance): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toJSON(message.allowance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgGrantAllowance { + const message = createBaseMsgGrantAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Any.fromPartial(object.allowance) + : undefined; + return message; + }, +}; + +function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { + return {}; +} + +export const MsgGrantAllowanceResponse = { + encode(_: MsgGrantAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantAllowanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgGrantAllowanceResponse { + return {}; + }, + + toJSON(_: MsgGrantAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { + return { granter: "", grantee: "" }; +} + +export const MsgRevokeAllowance = { + encode(message: MsgRevokeAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeAllowance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgRevokeAllowance { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + }; + }, + + toJSON(message: MsgRevokeAllowance): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + return obj; + }, + + fromPartial, I>>(object: I): MsgRevokeAllowance { + const message = createBaseMsgRevokeAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { + return {}; +} + +export const MsgRevokeAllowanceResponse = { + encode(_: MsgRevokeAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgRevokeAllowanceResponse { + return {}; + }, + + toJSON(_: MsgRevokeAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, +}; + +/** Msg defines the feegrant msg service. */ +export interface Msg { + /** + * GrantAllowance grants fee allowance to the grantee on the granter's + * account with the provided expiration time. + */ + GrantAllowance(request: MsgGrantAllowance): Promise; + /** + * RevokeAllowance revokes any fee allowance of granter's account that + * has been granted to the grantee. + */ + RevokeAllowance(request: MsgRevokeAllowance): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.feegrant.v1beta1.Msg"; + this.rpc = rpc; + this.GrantAllowance = this.GrantAllowance.bind(this); + this.RevokeAllowance = this.RevokeAllowance.bind(this); + } + GrantAllowance(request: MsgGrantAllowance): Promise { + const data = MsgGrantAllowance.encode(request).finish(); + const promise = this.rpc.request(this.service, "GrantAllowance", data); + return promise.then((data) => MsgGrantAllowanceResponse.decode(new _m0.Reader(data))); + } + + RevokeAllowance(request: MsgRevokeAllowance): Promise { + const data = MsgRevokeAllowance.encode(request).finish(); + const promise = this.rpc.request(this.service, "RevokeAllowance", data); + return promise.then((data) => MsgRevokeAllowanceResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/genutil/v1beta1/genesis.ts b/common/types/src/client/cosmos/genutil/v1beta1/genesis.ts new file mode 100644 index 00000000..1c42d365 --- /dev/null +++ b/common/types/src/client/cosmos/genutil/v1beta1/genesis.ts @@ -0,0 +1,116 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.genutil.v1beta1"; + +/** GenesisState defines the raw genesis transaction in JSON. */ +export interface GenesisState { + /** gen_txs defines the genesis transactions. */ + gen_txs: Uint8Array[]; +} + +function createBaseGenesisState(): GenesisState { + return { gen_txs: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.gen_txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gen_txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { gen_txs: Array.isArray(object?.gen_txs) ? object.gen_txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.gen_txs) { + obj.gen_txs = message.gen_txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.gen_txs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.gen_txs = object.gen_txs?.map((e) => e) || []; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/client/cosmos/gov/v1/genesis.ts b/common/types/src/client/cosmos/gov/v1/genesis.ts new file mode 100644 index 00000000..196797c7 --- /dev/null +++ b/common/types/src/client/cosmos/gov/v1/genesis.ts @@ -0,0 +1,182 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Deposit, DepositParams, Proposal, TallyParams, Vote, VotingParams } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisState { + /** starting_proposal_id is the ID of the starting proposal. */ + starting_proposal_id: string; + /** deposits defines all the deposits present at genesis. */ + deposits: Deposit[]; + /** votes defines all the votes present at genesis. */ + votes: Vote[]; + /** proposals defines all the proposals present at genesis. */ + proposals: Proposal[]; + /** params defines all the paramaters of related to deposit. */ + deposit_params?: DepositParams; + /** params defines all the paramaters of related to voting. */ + voting_params?: VotingParams; + /** params defines all the paramaters of related to tally. */ + tally_params?: TallyParams; +} + +function createBaseGenesisState(): GenesisState { + return { + starting_proposal_id: "0", + deposits: [], + votes: [], + proposals: [], + deposit_params: undefined, + voting_params: undefined, + tally_params: undefined, + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.starting_proposal_id !== "0") { + writer.uint32(8).uint64(message.starting_proposal_id); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.deposit_params !== undefined) { + DepositParams.encode(message.deposit_params, writer.uint32(42).fork()).ldelim(); + } + if (message.voting_params !== undefined) { + VotingParams.encode(message.voting_params, writer.uint32(50).fork()).ldelim(); + } + if (message.tally_params !== undefined) { + TallyParams.encode(message.tally_params, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.starting_proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 3: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 4: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 5: + message.deposit_params = DepositParams.decode(reader, reader.uint32()); + break; + case 6: + message.voting_params = VotingParams.decode(reader, reader.uint32()); + break; + case 7: + message.tally_params = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + starting_proposal_id: isSet(object.starting_proposal_id) ? String(object.starting_proposal_id) : "0", + deposits: Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + deposit_params: isSet(object.deposit_params) ? DepositParams.fromJSON(object.deposit_params) : undefined, + voting_params: isSet(object.voting_params) ? VotingParams.fromJSON(object.voting_params) : undefined, + tally_params: isSet(object.tally_params) ? TallyParams.fromJSON(object.tally_params) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.starting_proposal_id !== undefined && (obj.starting_proposal_id = message.starting_proposal_id); + if (message.deposits) { + obj.deposits = message.deposits.map((e) => e ? Deposit.toJSON(e) : undefined); + } else { + obj.deposits = []; + } + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + message.deposit_params !== undefined && + (obj.deposit_params = message.deposit_params ? DepositParams.toJSON(message.deposit_params) : undefined); + message.voting_params !== undefined && + (obj.voting_params = message.voting_params ? VotingParams.toJSON(message.voting_params) : undefined); + message.tally_params !== undefined && + (obj.tally_params = message.tally_params ? TallyParams.toJSON(message.tally_params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.starting_proposal_id = object.starting_proposal_id ?? "0"; + message.deposits = object.deposits?.map((e) => Deposit.fromPartial(e)) || []; + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.proposals = object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.deposit_params = (object.deposit_params !== undefined && object.deposit_params !== null) + ? DepositParams.fromPartial(object.deposit_params) + : undefined; + message.voting_params = (object.voting_params !== undefined && object.voting_params !== null) + ? VotingParams.fromPartial(object.voting_params) + : undefined; + message.tally_params = (object.tally_params !== undefined && object.tally_params !== null) + ? TallyParams.fromPartial(object.tally_params) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/gov/v1/gov.ts b/common/types/src/client/cosmos/gov/v1/gov.ts new file mode 100644 index 00000000..8d54d031 --- /dev/null +++ b/common/types/src/client/cosmos/gov/v1/gov.ts @@ -0,0 +1,905 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 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 propopsal 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 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: VoteOption; + weight: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + proposal_id: string; + depositor: string; + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + id: string; + messages: Any[]; + 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?: TallyResult; + submit_time?: Date; + deposit_end_time?: Date; + total_deposit: Coin[]; + voting_start_time?: Date; + voting_end_time?: Date; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + yes_count: string; + abstain_count: string; + no_count: string; + no_with_veto_count: string; +} + +/** + * 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: string; + voter: string; + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata to attached to the vote. */ + metadata: string; +} + +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: Duration; +} + +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Length of the voting period. */ + voting_period?: Duration; +} + +/** 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: 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; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption = { + encode(message: WeightedVoteOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.weight !== undefined && (obj.weight = message.weight); + return obj; + }, + + fromPartial, I>>(object: I): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? 0; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposal_id: "0", depositor: "", amount: [] }; +} + +export const Deposit = { + encode(message: Deposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): Deposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): Deposit { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Deposit): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Deposit { + const message = createBaseDeposit(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: "0", + messages: [], + status: 0, + final_tally_result: undefined, + submit_time: undefined, + deposit_end_time: undefined, + total_deposit: [], + voting_start_time: undefined, + voting_end_time: undefined, + metadata: "", + }; +} + +export const Proposal = { + encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "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.final_tally_result !== undefined) { + TallyResult.encode(message.final_tally_result, writer.uint32(34).fork()).ldelim(); + } + if (message.submit_time !== undefined) { + Timestamp.encode(toTimestamp(message.submit_time), writer.uint32(42).fork()).ldelim(); + } + if (message.deposit_end_time !== undefined) { + Timestamp.encode(toTimestamp(message.deposit_end_time), writer.uint32(50).fork()).ldelim(); + } + for (const v of message.total_deposit) { + Coin.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.voting_start_time !== undefined) { + Timestamp.encode(toTimestamp(message.voting_start_time), writer.uint32(66).fork()).ldelim(); + } + if (message.voting_end_time !== undefined) { + Timestamp.encode(toTimestamp(message.voting_end_time), writer.uint32(74).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(82).string(message.metadata); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 3: + message.status = reader.int32() as any; + break; + case 4: + message.final_tally_result = TallyResult.decode(reader, reader.uint32()); + break; + case 5: + message.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.deposit_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.total_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 8: + message.voting_start_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 9: + message.voting_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 10: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? String(object.id) : "0", + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + final_tally_result: isSet(object.final_tally_result) + ? TallyResult.fromJSON(object.final_tally_result) + : undefined, + submit_time: isSet(object.submit_time) ? fromJsonTimestamp(object.submit_time) : undefined, + deposit_end_time: isSet(object.deposit_end_time) ? fromJsonTimestamp(object.deposit_end_time) : undefined, + total_deposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromJSON(e)) : [], + voting_start_time: isSet(object.voting_start_time) ? fromJsonTimestamp(object.voting_start_time) : undefined, + voting_end_time: isSet(object.voting_end_time) ? fromJsonTimestamp(object.voting_end_time) : undefined, + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + message.status !== undefined && (obj.status = proposalStatusToJSON(message.status)); + message.final_tally_result !== undefined && + (obj.final_tally_result = message.final_tally_result + ? TallyResult.toJSON(message.final_tally_result) + : undefined); + message.submit_time !== undefined && (obj.submit_time = message.submit_time.toISOString()); + message.deposit_end_time !== undefined && (obj.deposit_end_time = message.deposit_end_time.toISOString()); + if (message.total_deposit) { + obj.total_deposit = message.total_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.total_deposit = []; + } + message.voting_start_time !== undefined && (obj.voting_start_time = message.voting_start_time.toISOString()); + message.voting_end_time !== undefined && (obj.voting_end_time = message.voting_end_time.toISOString()); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.id = object.id ?? "0"; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.status = object.status ?? 0; + message.final_tally_result = (object.final_tally_result !== undefined && object.final_tally_result !== null) + ? TallyResult.fromPartial(object.final_tally_result) + : undefined; + message.submit_time = object.submit_time ?? undefined; + message.deposit_end_time = object.deposit_end_time ?? undefined; + message.total_deposit = object.total_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.voting_start_time = object.voting_start_time ?? undefined; + message.voting_end_time = object.voting_end_time ?? undefined; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes_count: "", abstain_count: "", no_count: "", no_with_veto_count: "" }; +} + +export const TallyResult = { + encode(message: TallyResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.yes_count !== "") { + writer.uint32(10).string(message.yes_count); + } + if (message.abstain_count !== "") { + writer.uint32(18).string(message.abstain_count); + } + if (message.no_count !== "") { + writer.uint32(26).string(message.no_count); + } + if (message.no_with_veto_count !== "") { + writer.uint32(34).string(message.no_with_veto_count); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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_count = reader.string(); + break; + case 2: + message.abstain_count = reader.string(); + break; + case 3: + message.no_count = reader.string(); + break; + case 4: + message.no_with_veto_count = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes_count: isSet(object.yes_count) ? String(object.yes_count) : "", + abstain_count: isSet(object.abstain_count) ? String(object.abstain_count) : "", + no_count: isSet(object.no_count) ? String(object.no_count) : "", + no_with_veto_count: isSet(object.no_with_veto_count) ? String(object.no_with_veto_count) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + message.yes_count !== undefined && (obj.yes_count = message.yes_count); + message.abstain_count !== undefined && (obj.abstain_count = message.abstain_count); + message.no_count !== undefined && (obj.no_count = message.no_count); + message.no_with_veto_count !== undefined && (obj.no_with_veto_count = message.no_with_veto_count); + return obj; + }, + + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes_count = object.yes_count ?? ""; + message.abstain_count = object.abstain_count ?? ""; + message.no_count = object.no_count ?? ""; + message.no_with_veto_count = object.no_with_veto_count ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposal_id: "0", voter: "", options: [], metadata: "" }; +} + +export const Vote = { + encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): Vote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): Vote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [], + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + if (message.options) { + obj.options = message.options.map((e) => e ? WeightedVoteOption.toJSON(e) : undefined); + } else { + obj.options = []; + } + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { min_deposit: [], max_deposit_period: undefined }; +} + +export const DepositParams = { + encode(message: DepositParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.min_deposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.max_deposit_period !== undefined) { + Duration.encode(message.max_deposit_period, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.min_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.max_deposit_period = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + min_deposit: Array.isArray(object?.min_deposit) ? object.min_deposit.map((e: any) => Coin.fromJSON(e)) : [], + max_deposit_period: isSet(object.max_deposit_period) ? Duration.fromJSON(object.max_deposit_period) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.min_deposit) { + obj.min_deposit = message.min_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.min_deposit = []; + } + message.max_deposit_period !== undefined && + (obj.max_deposit_period = message.max_deposit_period ? Duration.toJSON(message.max_deposit_period) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.min_deposit = object.min_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.max_deposit_period = (object.max_deposit_period !== undefined && object.max_deposit_period !== null) + ? Duration.fromPartial(object.max_deposit_period) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { voting_period: undefined }; +} + +export const VotingParams = { + encode(message: VotingParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voting_period !== undefined) { + Duration.encode(message.voting_period, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.voting_period = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { voting_period: isSet(object.voting_period) ? Duration.fromJSON(object.voting_period) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + message.voting_period !== undefined && + (obj.voting_period = message.voting_period ? Duration.toJSON(message.voting_period) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.voting_period = (object.voting_period !== undefined && object.voting_period !== null) + ? Duration.fromPartial(object.voting_period) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: "", threshold: "", veto_threshold: "" }; +} + +export const TallyParams = { + encode(message: TallyParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.quorum !== "") { + writer.uint32(10).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(18).string(message.threshold); + } + if (message.veto_threshold !== "") { + writer.uint32(26).string(message.veto_threshold); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.veto_threshold = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? String(object.quorum) : "", + threshold: isSet(object.threshold) ? String(object.threshold) : "", + veto_threshold: isSet(object.veto_threshold) ? String(object.veto_threshold) : "", + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + message.quorum !== undefined && (obj.quorum = message.quorum); + message.threshold !== undefined && (obj.threshold = message.threshold); + message.veto_threshold !== undefined && (obj.veto_threshold = message.veto_threshold); + return obj; + }, + + fromPartial, I>>(object: I): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.veto_threshold = object.veto_threshold ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/gov/v1/query.ts b/common/types/src/client/cosmos/gov/v1/query.ts new file mode 100644 index 00000000..a7f79aba --- /dev/null +++ b/common/types/src/client/cosmos/gov/v1/query.ts @@ -0,0 +1,1178 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + Deposit, + DepositParams, + Proposal, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyParams, + TallyResult, + Vote, + VotingParams, +} from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal?: Proposal; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** 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?: PageRequest; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter defines the oter address for the proposals. */ + voter: string; +} + +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponse { + /** vote defined the queried vote. */ + vote?: Vote; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defined the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** 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". + */ + params_type: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + voting_params?: VotingParams; + /** deposit_params defines the parameters related to deposit. */ + deposit_params?: DepositParams; + /** tally_params defines the parameters related to tally. */ + tally_params?: TallyParams; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} + +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponse { + /** deposit defines the requested deposit. */ + deposit?: Deposit; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally?: TallyResult; +} + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposal_id: "0" }; +} + +export const QueryProposalRequest = { + encode(message: QueryProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse = { + encode(message: QueryProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = (object.proposal !== undefined && object.proposal !== null) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposal_status: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest = { + encode(message: QueryProposalsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_status !== 0) { + writer.uint32(8).int32(message.proposal_status); + } + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_status = 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; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposal_status: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : 0, + voter: isSet(object.voter) ? String(object.voter) : "", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsRequest): unknown { + const obj: any = {}; + message.proposal_status !== undefined && (obj.proposal_status = proposalStatusToJSON(message.proposal_status)); + message.voter !== undefined && (obj.voter = message.voter); + message.depositor !== undefined && (obj.depositor = message.depositor); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + message.proposal_status = object.proposal_status ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse = { + encode(message: QueryProposalsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsResponse): unknown { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposal_id: "0", voter: "" }; +} + +export const QueryVoteRequest = { + encode(message: QueryVoteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + return obj; + }, + + fromPartial, I>>(object: I): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse = { + encode(message: QueryVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + message.vote = (object.vote !== undefined && object.vote !== null) ? Vote.fromPartial(object.vote) : undefined; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposal_id: "0", pagination: undefined }; +} + +export const QueryVotesRequest = { + encode(message: QueryVotesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVotesResponse(): QueryVotesResponse { + return { votes: [], pagination: undefined }; +} + +export const QueryVotesResponse = { + encode(message: QueryVotesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesResponse): unknown { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { params_type: "" }; +} + +export const QueryParamsRequest = { + encode(message: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params_type !== "") { + writer.uint32(10).string(message.params_type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.params_type = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { params_type: isSet(object.params_type) ? String(object.params_type) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + message.params_type !== undefined && (obj.params_type = message.params_type); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.params_type = object.params_type ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { voting_params: undefined, deposit_params: undefined, tally_params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voting_params !== undefined) { + VotingParams.encode(message.voting_params, writer.uint32(10).fork()).ldelim(); + } + if (message.deposit_params !== undefined) { + DepositParams.encode(message.deposit_params, writer.uint32(18).fork()).ldelim(); + } + if (message.tally_params !== undefined) { + TallyParams.encode(message.tally_params, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.voting_params = VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.deposit_params = DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tally_params = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + voting_params: isSet(object.voting_params) ? VotingParams.fromJSON(object.voting_params) : undefined, + deposit_params: isSet(object.deposit_params) ? DepositParams.fromJSON(object.deposit_params) : undefined, + tally_params: isSet(object.tally_params) ? TallyParams.fromJSON(object.tally_params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.voting_params !== undefined && + (obj.voting_params = message.voting_params ? VotingParams.toJSON(message.voting_params) : undefined); + message.deposit_params !== undefined && + (obj.deposit_params = message.deposit_params ? DepositParams.toJSON(message.deposit_params) : undefined); + message.tally_params !== undefined && + (obj.tally_params = message.tally_params ? TallyParams.toJSON(message.tally_params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.voting_params = (object.voting_params !== undefined && object.voting_params !== null) + ? VotingParams.fromPartial(object.voting_params) + : undefined; + message.deposit_params = (object.deposit_params !== undefined && object.deposit_params !== null) + ? DepositParams.fromPartial(object.deposit_params) + : undefined; + message.tally_params = (object.tally_params !== undefined && object.tally_params !== null) + ? TallyParams.fromPartial(object.tally_params) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposal_id: "0", depositor: "" }; +} + +export const QueryDepositRequest = { + encode(message: QueryDepositRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse = { + encode(message: QueryDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + message.deposit !== undefined && (obj.deposit = message.deposit ? Deposit.toJSON(message.deposit) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + message.deposit = (object.deposit !== undefined && object.deposit !== null) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposal_id: "0", pagination: undefined }; +} + +export const QueryDepositsRequest = { + encode(message: QueryDepositsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsResponse(): QueryDepositsResponse { + return { deposits: [], pagination: undefined }; +} + +export const QueryDepositsResponse = { + encode(message: QueryDepositsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + deposits: Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsResponse): unknown { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => e ? Deposit.toJSON(e) : undefined); + } else { + obj.deposits = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposal_id: "0" }; +} + +export const QueryTallyResultRequest = { + encode(message: QueryTallyResultRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse = { + encode(message: QueryTallyResultResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = (object.tally !== undefined && object.tally !== null) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Proposal queries proposal details based on ProposalID. */ + Proposal(request: QueryProposalRequest): Promise; + /** Proposals queries all proposals based on given status. */ + Proposals(request: QueryProposalsRequest): Promise; + /** Vote queries voted information based on proposalID, voterAddr. */ + Vote(request: QueryVoteRequest): Promise; + /** Votes queries votes of a given proposal. */ + Votes(request: QueryVotesRequest): Promise; + /** Params queries all parameters of the gov module. */ + Params(request: QueryParamsRequest): Promise; + /** Deposit queries single deposit information based proposalID, depositAddr. */ + Deposit(request: QueryDepositRequest): Promise; + /** Deposits queries all deposits of a single proposal. */ + Deposits(request: QueryDepositsRequest): Promise; + /** TallyResult queries the tally of a proposal vote. */ + TallyResult(request: QueryTallyResultRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.gov.v1.Query"; + this.rpc = rpc; + this.Proposal = this.Proposal.bind(this); + this.Proposals = this.Proposals.bind(this); + this.Vote = this.Vote.bind(this); + this.Votes = this.Votes.bind(this); + this.Params = this.Params.bind(this); + this.Deposit = this.Deposit.bind(this); + this.Deposits = this.Deposits.bind(this); + this.TallyResult = this.TallyResult.bind(this); + } + Proposal(request: QueryProposalRequest): Promise { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Proposal", data); + return promise.then((data) => QueryProposalResponse.decode(new _m0.Reader(data))); + } + + Proposals(request: QueryProposalsRequest): Promise { + const data = QueryProposalsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Proposals", data); + return promise.then((data) => QueryProposalsResponse.decode(new _m0.Reader(data))); + } + + Vote(request: QueryVoteRequest): Promise { + const data = QueryVoteRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Vote", data); + return promise.then((data) => QueryVoteResponse.decode(new _m0.Reader(data))); + } + + Votes(request: QueryVotesRequest): Promise { + const data = QueryVotesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Votes", data); + return promise.then((data) => QueryVotesResponse.decode(new _m0.Reader(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + Deposit(request: QueryDepositRequest): Promise { + const data = QueryDepositRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposit", data); + return promise.then((data) => QueryDepositResponse.decode(new _m0.Reader(data))); + } + + Deposits(request: QueryDepositsRequest): Promise { + const data = QueryDepositsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposits", data); + return promise.then((data) => QueryDepositsResponse.decode(new _m0.Reader(data))); + } + + TallyResult(request: QueryTallyResultRequest): Promise { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TallyResult", data); + return promise.then((data) => QueryTallyResultResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/gov/v1/tx.ts b/common/types/src/client/cosmos/gov/v1/tx.ts new file mode 100644 index 00000000..ca1144b9 --- /dev/null +++ b/common/types/src/client/cosmos/gov/v1/tx.ts @@ -0,0 +1,741 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Coin } from "../../base/v1beta1/coin"; +import { VoteOption, voteOptionFromJSON, voteOptionToJSON, WeightedVoteOption } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + messages: Any[]; + initial_deposit: Coin[]; + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + proposal_id: string; +} + +/** + * 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?: Any; + /** authority must be the gov module address. */ + authority: string; +} + +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponse { +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + proposal_id: string; + voter: string; + option: VoteOption; + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeighted { + proposal_id: string; + voter: string; + options: WeightedVoteOption[]; + metadata: string; +} + +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponse { +} + +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + proposal_id: string; + depositor: string; + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { messages: [], initial_deposit: [], proposer: "", metadata: "" }; +} + +export const MsgSubmitProposal = { + encode(message: MsgSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initial_deposit) { + 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); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.initial_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + case 4: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + initial_deposit: Array.isArray(object?.initial_deposit) + ? object.initial_deposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? String(object.proposer) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + if (message.initial_deposit) { + obj.initial_deposit = message.initial_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.initial_deposit = []; + } + message.proposer !== undefined && (obj.proposer = message.proposer); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.initial_deposit = object.initial_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposal_id: "0" }; +} + +export const MsgSubmitProposalResponse = { + encode(message: MsgSubmitProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { + return { content: undefined, authority: "" }; +} + +export const MsgExecLegacyContent = { + encode(message: MsgExecLegacyContent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).ldelim(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecLegacyContent { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgExecLegacyContent { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + authority: isSet(object.authority) ? String(object.authority) : "", + }; + }, + + toJSON(message: MsgExecLegacyContent): unknown { + const obj: any = {}; + message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); + message.authority !== undefined && (obj.authority = message.authority); + return obj; + }, + + fromPartial, I>>(object: I): MsgExecLegacyContent { + const message = createBaseMsgExecLegacyContent(); + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { + return {}; +} + +export const MsgExecLegacyContentResponse = { + encode(_: MsgExecLegacyContentResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecLegacyContentResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgExecLegacyContentResponse { + return {}; + }, + + toJSON(_: MsgExecLegacyContentResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposal_id: "0", voter: "", option: 0, metadata: "" }; +} + +export const MsgVote = { + encode(message: MsgVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgVote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse = { + encode(_: MsgVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposal_id: "0", voter: "", options: [], metadata: "" }; +} + +export const MsgVoteWeighted = { + encode(message: MsgVoteWeighted, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [], + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + if (message.options) { + obj.options = message.options.map((e) => e ? WeightedVoteOption.toJSON(e) : undefined); + } else { + obj.options = []; + } + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse = { + encode(_: MsgVoteWeightedResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposal_id: "0", depositor: "", amount: [] }; +} + +export const MsgDeposit = { + encode(message: MsgDeposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDeposit): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse = { + encode(_: MsgDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + */ + ExecLegacyContent(request: MsgExecLegacyContent): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.gov.v1.Msg"; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.ExecLegacyContent = this.ExecLegacyContent.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + } + SubmitProposal(request: MsgSubmitProposal): Promise { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitProposal", data); + return promise.then((data) => MsgSubmitProposalResponse.decode(new _m0.Reader(data))); + } + + ExecLegacyContent(request: MsgExecLegacyContent): Promise { + const data = MsgExecLegacyContent.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExecLegacyContent", data); + return promise.then((data) => MsgExecLegacyContentResponse.decode(new _m0.Reader(data))); + } + + Vote(request: MsgVote): Promise { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "Vote", data); + return promise.then((data) => MsgVoteResponse.decode(new _m0.Reader(data))); + } + + VoteWeighted(request: MsgVoteWeighted): Promise { + const data = MsgVoteWeighted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteWeighted", data); + return promise.then((data) => MsgVoteWeightedResponse.decode(new _m0.Reader(data))); + } + + Deposit(request: MsgDeposit): Promise { + const data = MsgDeposit.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposit", data); + return promise.then((data) => MsgDepositResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/gov/v1beta1/genesis.ts b/common/types/src/client/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 00000000..8ef52afc --- /dev/null +++ b/common/types/src/client/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,180 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Deposit, DepositParams, Proposal, TallyParams, Vote, VotingParams } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1beta1"; + +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisState { + /** starting_proposal_id is the ID of the starting proposal. */ + starting_proposal_id: string; + /** deposits defines all the deposits present at genesis. */ + deposits: Deposit[]; + /** votes defines all the votes present at genesis. */ + votes: Vote[]; + /** proposals defines all the proposals present at genesis. */ + proposals: Proposal[]; + /** params defines all the paramaters of related to deposit. */ + deposit_params?: DepositParams; + /** params defines all the paramaters of related to voting. */ + voting_params?: VotingParams; + /** params defines all the paramaters of related to tally. */ + tally_params?: TallyParams; +} + +function createBaseGenesisState(): GenesisState { + return { + starting_proposal_id: "0", + deposits: [], + votes: [], + proposals: [], + deposit_params: undefined, + voting_params: undefined, + tally_params: undefined, + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.starting_proposal_id !== "0") { + writer.uint32(8).uint64(message.starting_proposal_id); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.deposit_params !== undefined) { + DepositParams.encode(message.deposit_params, writer.uint32(42).fork()).ldelim(); + } + if (message.voting_params !== undefined) { + VotingParams.encode(message.voting_params, writer.uint32(50).fork()).ldelim(); + } + if (message.tally_params !== undefined) { + TallyParams.encode(message.tally_params, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.starting_proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 3: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 4: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 5: + message.deposit_params = DepositParams.decode(reader, reader.uint32()); + break; + case 6: + message.voting_params = VotingParams.decode(reader, reader.uint32()); + break; + case 7: + message.tally_params = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + starting_proposal_id: isSet(object.starting_proposal_id) ? String(object.starting_proposal_id) : "0", + deposits: Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + deposit_params: isSet(object.deposit_params) ? DepositParams.fromJSON(object.deposit_params) : undefined, + voting_params: isSet(object.voting_params) ? VotingParams.fromJSON(object.voting_params) : undefined, + tally_params: isSet(object.tally_params) ? TallyParams.fromJSON(object.tally_params) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.starting_proposal_id !== undefined && (obj.starting_proposal_id = message.starting_proposal_id); + if (message.deposits) { + obj.deposits = message.deposits.map((e) => e ? Deposit.toJSON(e) : undefined); + } else { + obj.deposits = []; + } + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + message.deposit_params !== undefined && + (obj.deposit_params = message.deposit_params ? DepositParams.toJSON(message.deposit_params) : undefined); + message.voting_params !== undefined && + (obj.voting_params = message.voting_params ? VotingParams.toJSON(message.voting_params) : undefined); + message.tally_params !== undefined && + (obj.tally_params = message.tally_params ? TallyParams.toJSON(message.tally_params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.starting_proposal_id = object.starting_proposal_id ?? "0"; + message.deposits = object.deposits?.map((e) => Deposit.fromPartial(e)) || []; + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.proposals = object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.deposit_params = (object.deposit_params !== undefined && object.deposit_params !== null) + ? DepositParams.fromPartial(object.deposit_params) + : undefined; + message.voting_params = (object.voting_params !== undefined && object.voting_params !== null) + ? VotingParams.fromPartial(object.voting_params) + : undefined; + message.tally_params = (object.tally_params !== undefined && object.tally_params !== null) + ? TallyParams.fromPartial(object.tally_params) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/gov/v1beta1/gov.ts b/common/types/src/client/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 00000000..95eb209a --- /dev/null +++ b/common/types/src/client/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1016 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.gov.v1beta1"; + +/** 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 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 propopsal 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 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: VoteOption; + weight: string; +} + +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposal { + title: string; + description: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + proposal_id: string; + depositor: string; + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + proposal_id: string; + content?: Any; + 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?: TallyResult; + submit_time?: Date; + deposit_end_time?: Date; + total_deposit: Coin[]; + voting_start_time?: Date; + voting_end_time?: Date; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + yes: string; + abstain: string; + no: string; + no_with_veto: string; +} + +/** + * 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: string; + 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; + /** Since: cosmos-sdk 0.43 */ + options: WeightedVoteOption[]; +} + +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: Duration; +} + +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Length of the voting period. */ + voting_period?: Duration; +} + +/** 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. + */ + veto_threshold: Uint8Array; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +export const WeightedVoteOption = { + encode(message: WeightedVoteOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.weight !== undefined && (obj.weight = message.weight); + return obj; + }, + + fromPartial, I>>(object: I): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? 0; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseTextProposal(): TextProposal { + return { title: "", description: "" }; +} + +export const TextProposal = { + encode(message: TextProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): TextProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + + toJSON(message: TextProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + + fromPartial, I>>(object: I): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposal_id: "0", depositor: "", amount: [] }; +} + +export const Deposit = { + encode(message: Deposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): Deposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): Deposit { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Deposit): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Deposit { + const message = createBaseDeposit(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + proposal_id: "0", + content: undefined, + status: 0, + final_tally_result: undefined, + submit_time: undefined, + deposit_end_time: undefined, + total_deposit: [], + voting_start_time: undefined, + voting_end_time: undefined, + }; +} + +export const Proposal = { + encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(18).fork()).ldelim(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.final_tally_result !== undefined) { + TallyResult.encode(message.final_tally_result, writer.uint32(34).fork()).ldelim(); + } + if (message.submit_time !== undefined) { + Timestamp.encode(toTimestamp(message.submit_time), writer.uint32(42).fork()).ldelim(); + } + if (message.deposit_end_time !== undefined) { + Timestamp.encode(toTimestamp(message.deposit_end_time), writer.uint32(50).fork()).ldelim(); + } + for (const v of message.total_deposit) { + Coin.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.voting_start_time !== undefined) { + Timestamp.encode(toTimestamp(message.voting_start_time), writer.uint32(66).fork()).ldelim(); + } + if (message.voting_end_time !== undefined) { + Timestamp.encode(toTimestamp(message.voting_end_time), writer.uint32(74).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.content = Any.decode(reader, reader.uint32()); + break; + case 3: + message.status = reader.int32() as any; + break; + case 4: + message.final_tally_result = TallyResult.decode(reader, reader.uint32()); + break; + case 5: + message.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.deposit_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.total_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 8: + message.voting_start_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 9: + message.voting_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + final_tally_result: isSet(object.final_tally_result) + ? TallyResult.fromJSON(object.final_tally_result) + : undefined, + submit_time: isSet(object.submit_time) ? fromJsonTimestamp(object.submit_time) : undefined, + deposit_end_time: isSet(object.deposit_end_time) ? fromJsonTimestamp(object.deposit_end_time) : undefined, + total_deposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromJSON(e)) : [], + voting_start_time: isSet(object.voting_start_time) ? fromJsonTimestamp(object.voting_start_time) : undefined, + voting_end_time: isSet(object.voting_end_time) ? fromJsonTimestamp(object.voting_end_time) : undefined, + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); + message.status !== undefined && (obj.status = proposalStatusToJSON(message.status)); + message.final_tally_result !== undefined && + (obj.final_tally_result = message.final_tally_result + ? TallyResult.toJSON(message.final_tally_result) + : undefined); + message.submit_time !== undefined && (obj.submit_time = message.submit_time.toISOString()); + message.deposit_end_time !== undefined && (obj.deposit_end_time = message.deposit_end_time.toISOString()); + if (message.total_deposit) { + obj.total_deposit = message.total_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.total_deposit = []; + } + message.voting_start_time !== undefined && (obj.voting_start_time = message.voting_start_time.toISOString()); + message.voting_end_time !== undefined && (obj.voting_end_time = message.voting_end_time.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.proposal_id = object.proposal_id ?? "0"; + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.status = object.status ?? 0; + message.final_tally_result = (object.final_tally_result !== undefined && object.final_tally_result !== null) + ? TallyResult.fromPartial(object.final_tally_result) + : undefined; + message.submit_time = object.submit_time ?? undefined; + message.deposit_end_time = object.deposit_end_time ?? undefined; + message.total_deposit = object.total_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.voting_start_time = object.voting_start_time ?? undefined; + message.voting_end_time = object.voting_end_time ?? undefined; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes: "", abstain: "", no: "", no_with_veto: "" }; +} + +export const TallyResult = { + encode(message: TallyResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.no_with_veto !== "") { + writer.uint32(34).string(message.no_with_veto); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.no_with_veto = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes: isSet(object.yes) ? String(object.yes) : "", + abstain: isSet(object.abstain) ? String(object.abstain) : "", + no: isSet(object.no) ? String(object.no) : "", + no_with_veto: isSet(object.no_with_veto) ? String(object.no_with_veto) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + message.yes !== undefined && (obj.yes = message.yes); + message.abstain !== undefined && (obj.abstain = message.abstain); + message.no !== undefined && (obj.no = message.no); + message.no_with_veto !== undefined && (obj.no_with_veto = message.no_with_veto); + return obj; + }, + + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.no_with_veto = object.no_with_veto ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposal_id: "0", voter: "", option: 0, options: [] }; +} + +export const Vote = { + encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): Vote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): Vote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [], + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + if (message.options) { + obj.options = message.options.map((e) => e ? WeightedVoteOption.toJSON(e) : undefined); + } else { + obj.options = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { min_deposit: [], max_deposit_period: undefined }; +} + +export const DepositParams = { + encode(message: DepositParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.min_deposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.max_deposit_period !== undefined) { + Duration.encode(message.max_deposit_period, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.min_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.max_deposit_period = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + min_deposit: Array.isArray(object?.min_deposit) ? object.min_deposit.map((e: any) => Coin.fromJSON(e)) : [], + max_deposit_period: isSet(object.max_deposit_period) ? Duration.fromJSON(object.max_deposit_period) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.min_deposit) { + obj.min_deposit = message.min_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.min_deposit = []; + } + message.max_deposit_period !== undefined && + (obj.max_deposit_period = message.max_deposit_period ? Duration.toJSON(message.max_deposit_period) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.min_deposit = object.min_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.max_deposit_period = (object.max_deposit_period !== undefined && object.max_deposit_period !== null) + ? Duration.fromPartial(object.max_deposit_period) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { voting_period: undefined }; +} + +export const VotingParams = { + encode(message: VotingParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voting_period !== undefined) { + Duration.encode(message.voting_period, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.voting_period = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { voting_period: isSet(object.voting_period) ? Duration.fromJSON(object.voting_period) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + message.voting_period !== undefined && + (obj.voting_period = message.voting_period ? Duration.toJSON(message.voting_period) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.voting_period = (object.voting_period !== undefined && object.voting_period !== null) + ? Duration.fromPartial(object.voting_period) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: new Uint8Array(), threshold: new Uint8Array(), veto_threshold: new Uint8Array() }; +} + +export const TallyParams = { + encode(message: TallyParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.veto_threshold.length !== 0) { + writer.uint32(26).bytes(message.veto_threshold); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.veto_threshold = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? bytesFromBase64(object.quorum) : new Uint8Array(), + threshold: isSet(object.threshold) ? bytesFromBase64(object.threshold) : new Uint8Array(), + veto_threshold: isSet(object.veto_threshold) ? bytesFromBase64(object.veto_threshold) : new Uint8Array(), + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + message.quorum !== undefined && + (obj.quorum = base64FromBytes(message.quorum !== undefined ? message.quorum : new Uint8Array())); + message.threshold !== undefined && + (obj.threshold = base64FromBytes(message.threshold !== undefined ? message.threshold : new Uint8Array())); + message.veto_threshold !== undefined && + (obj.veto_threshold = base64FromBytes( + message.veto_threshold !== undefined ? message.veto_threshold : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? new Uint8Array(); + message.threshold = object.threshold ?? new Uint8Array(); + message.veto_threshold = object.veto_threshold ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/gov/v1beta1/query.ts b/common/types/src/client/cosmos/gov/v1beta1/query.ts new file mode 100644 index 00000000..15583967 --- /dev/null +++ b/common/types/src/client/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,1176 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + Deposit, + DepositParams, + Proposal, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + TallyParams, + TallyResult, + Vote, + VotingParams, +} from "./gov"; + +export const protobufPackage = "cosmos.gov.v1beta1"; + +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal?: Proposal; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** 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?: PageRequest; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter defines the oter address for the proposals. */ + voter: string; +} + +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponse { + /** vote defined the queried vote. */ + vote?: Vote; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defined the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** 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". + */ + params_type: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + voting_params?: VotingParams; + /** deposit_params defines the parameters related to deposit. */ + deposit_params?: DepositParams; + /** tally_params defines the parameters related to tally. */ + tally_params?: TallyParams; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} + +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponse { + /** deposit defines the requested deposit. */ + deposit?: Deposit; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally?: TallyResult; +} + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposal_id: "0" }; +} + +export const QueryProposalRequest = { + encode(message: QueryProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse = { + encode(message: QueryProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = (object.proposal !== undefined && object.proposal !== null) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposal_status: 0, voter: "", depositor: "", pagination: undefined }; +} + +export const QueryProposalsRequest = { + encode(message: QueryProposalsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_status !== 0) { + writer.uint32(8).int32(message.proposal_status); + } + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_status = 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; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposal_status: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : 0, + voter: isSet(object.voter) ? String(object.voter) : "", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsRequest): unknown { + const obj: any = {}; + message.proposal_status !== undefined && (obj.proposal_status = proposalStatusToJSON(message.proposal_status)); + message.voter !== undefined && (obj.voter = message.voter); + message.depositor !== undefined && (obj.depositor = message.depositor); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + message.proposal_status = object.proposal_status ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse = { + encode(message: QueryProposalsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsResponse): unknown { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposal_id: "0", voter: "" }; +} + +export const QueryVoteRequest = { + encode(message: QueryVoteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + return obj; + }, + + fromPartial, I>>(object: I): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse = { + encode(message: QueryVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + message.vote = (object.vote !== undefined && object.vote !== null) ? Vote.fromPartial(object.vote) : undefined; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposal_id: "0", pagination: undefined }; +} + +export const QueryVotesRequest = { + encode(message: QueryVotesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVotesResponse(): QueryVotesResponse { + return { votes: [], pagination: undefined }; +} + +export const QueryVotesResponse = { + encode(message: QueryVotesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesResponse): unknown { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { params_type: "" }; +} + +export const QueryParamsRequest = { + encode(message: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params_type !== "") { + writer.uint32(10).string(message.params_type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.params_type = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { params_type: isSet(object.params_type) ? String(object.params_type) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + message.params_type !== undefined && (obj.params_type = message.params_type); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.params_type = object.params_type ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { voting_params: undefined, deposit_params: undefined, tally_params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voting_params !== undefined) { + VotingParams.encode(message.voting_params, writer.uint32(10).fork()).ldelim(); + } + if (message.deposit_params !== undefined) { + DepositParams.encode(message.deposit_params, writer.uint32(18).fork()).ldelim(); + } + if (message.tally_params !== undefined) { + TallyParams.encode(message.tally_params, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.voting_params = VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.deposit_params = DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tally_params = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + voting_params: isSet(object.voting_params) ? VotingParams.fromJSON(object.voting_params) : undefined, + deposit_params: isSet(object.deposit_params) ? DepositParams.fromJSON(object.deposit_params) : undefined, + tally_params: isSet(object.tally_params) ? TallyParams.fromJSON(object.tally_params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.voting_params !== undefined && + (obj.voting_params = message.voting_params ? VotingParams.toJSON(message.voting_params) : undefined); + message.deposit_params !== undefined && + (obj.deposit_params = message.deposit_params ? DepositParams.toJSON(message.deposit_params) : undefined); + message.tally_params !== undefined && + (obj.tally_params = message.tally_params ? TallyParams.toJSON(message.tally_params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.voting_params = (object.voting_params !== undefined && object.voting_params !== null) + ? VotingParams.fromPartial(object.voting_params) + : undefined; + message.deposit_params = (object.deposit_params !== undefined && object.deposit_params !== null) + ? DepositParams.fromPartial(object.deposit_params) + : undefined; + message.tally_params = (object.tally_params !== undefined && object.tally_params !== null) + ? TallyParams.fromPartial(object.tally_params) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposal_id: "0", depositor: "" }; +} + +export const QueryDepositRequest = { + encode(message: QueryDepositRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse = { + encode(message: QueryDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + message.deposit !== undefined && (obj.deposit = message.deposit ? Deposit.toJSON(message.deposit) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + message.deposit = (object.deposit !== undefined && object.deposit !== null) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposal_id: "0", pagination: undefined }; +} + +export const QueryDepositsRequest = { + encode(message: QueryDepositsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsResponse(): QueryDepositsResponse { + return { deposits: [], pagination: undefined }; +} + +export const QueryDepositsResponse = { + encode(message: QueryDepositsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + deposits: Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsResponse): unknown { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => e ? Deposit.toJSON(e) : undefined); + } else { + obj.deposits = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposal_id: "0" }; +} + +export const QueryTallyResultRequest = { + encode(message: QueryTallyResultRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse = { + encode(message: QueryTallyResultResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = (object.tally !== undefined && object.tally !== null) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Proposal queries proposal details based on ProposalID. */ + Proposal(request: QueryProposalRequest): Promise; + /** Proposals queries all proposals based on given status. */ + Proposals(request: QueryProposalsRequest): Promise; + /** Vote queries voted information based on proposalID, voterAddr. */ + Vote(request: QueryVoteRequest): Promise; + /** Votes queries votes of a given proposal. */ + Votes(request: QueryVotesRequest): Promise; + /** Params queries all parameters of the gov module. */ + Params(request: QueryParamsRequest): Promise; + /** Deposit queries single deposit information based proposalID, depositAddr. */ + Deposit(request: QueryDepositRequest): Promise; + /** Deposits queries all deposits of a single proposal. */ + Deposits(request: QueryDepositsRequest): Promise; + /** TallyResult queries the tally of a proposal vote. */ + TallyResult(request: QueryTallyResultRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.gov.v1beta1.Query"; + this.rpc = rpc; + this.Proposal = this.Proposal.bind(this); + this.Proposals = this.Proposals.bind(this); + this.Vote = this.Vote.bind(this); + this.Votes = this.Votes.bind(this); + this.Params = this.Params.bind(this); + this.Deposit = this.Deposit.bind(this); + this.Deposits = this.Deposits.bind(this); + this.TallyResult = this.TallyResult.bind(this); + } + Proposal(request: QueryProposalRequest): Promise { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Proposal", data); + return promise.then((data) => QueryProposalResponse.decode(new _m0.Reader(data))); + } + + Proposals(request: QueryProposalsRequest): Promise { + const data = QueryProposalsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Proposals", data); + return promise.then((data) => QueryProposalsResponse.decode(new _m0.Reader(data))); + } + + Vote(request: QueryVoteRequest): Promise { + const data = QueryVoteRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Vote", data); + return promise.then((data) => QueryVoteResponse.decode(new _m0.Reader(data))); + } + + Votes(request: QueryVotesRequest): Promise { + const data = QueryVotesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Votes", data); + return promise.then((data) => QueryVotesResponse.decode(new _m0.Reader(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + Deposit(request: QueryDepositRequest): Promise { + const data = QueryDepositRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposit", data); + return promise.then((data) => QueryDepositResponse.decode(new _m0.Reader(data))); + } + + Deposits(request: QueryDepositsRequest): Promise { + const data = QueryDepositsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposits", data); + return promise.then((data) => QueryDepositsResponse.decode(new _m0.Reader(data))); + } + + TallyResult(request: QueryTallyResultRequest): Promise { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TallyResult", data); + return promise.then((data) => QueryTallyResultResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/gov/v1beta1/tx.ts b/common/types/src/client/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 00000000..5d3956af --- /dev/null +++ b/common/types/src/client/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,592 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Coin } from "../../base/v1beta1/coin"; +import { VoteOption, voteOptionFromJSON, voteOptionToJSON, WeightedVoteOption } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1beta1"; + +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + content?: Any; + initial_deposit: Coin[]; + proposer: string; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + proposal_id: string; +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + proposal_id: string; + voter: string; + option: VoteOption; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeighted { + proposal_id: string; + voter: string; + options: WeightedVoteOption[]; +} + +/** + * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedResponse { +} + +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + proposal_id: string; + depositor: string; + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { content: undefined, initial_deposit: [], proposer: "" }; +} + +export const MsgSubmitProposal = { + encode(message: MsgSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initial_deposit) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + case 2: + message.initial_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + initial_deposit: Array.isArray(object?.initial_deposit) + ? object.initial_deposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? String(object.proposer) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); + if (message.initial_deposit) { + obj.initial_deposit = message.initial_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.initial_deposit = []; + } + message.proposer !== undefined && (obj.proposer = message.proposer); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.initial_deposit = object.initial_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposal_id: "0" }; +} + +export const MsgSubmitProposalResponse = { + encode(message: MsgSubmitProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposal_id: "0", voter: "", option: 0 }; +} + +export const MsgVote = { + encode(message: MsgVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgVote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + return obj; + }, + + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse = { + encode(_: MsgVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposal_id: "0", voter: "", options: [] }; +} + +export const MsgVoteWeighted = { + encode(message: MsgVoteWeighted, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + if (message.options) { + obj.options = message.options.map((e) => e ? WeightedVoteOption.toJSON(e) : undefined); + } else { + obj.options = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse = { + encode(_: MsgVoteWeightedResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposal_id: "0", depositor: "", amount: [] }; +} + +export const MsgDeposit = { + encode(message: MsgDeposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDeposit): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse = { + encode(_: MsgDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * + * Since: cosmos-sdk 0.43 + */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.gov.v1beta1.Msg"; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + } + SubmitProposal(request: MsgSubmitProposal): Promise { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitProposal", data); + return promise.then((data) => MsgSubmitProposalResponse.decode(new _m0.Reader(data))); + } + + Vote(request: MsgVote): Promise { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "Vote", data); + return promise.then((data) => MsgVoteResponse.decode(new _m0.Reader(data))); + } + + VoteWeighted(request: MsgVoteWeighted): Promise { + const data = MsgVoteWeighted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteWeighted", data); + return promise.then((data) => MsgVoteWeightedResponse.decode(new _m0.Reader(data))); + } + + Deposit(request: MsgDeposit): Promise { + const data = MsgDeposit.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposit", data); + return promise.then((data) => MsgDepositResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/group/v1/events.ts b/common/types/src/client/cosmos/group/v1/events.ts new file mode 100644 index 00000000..9bfd5f8b --- /dev/null +++ b/common/types/src/client/cosmos/group/v1/events.ts @@ -0,0 +1,533 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { ProposalExecutorResult, proposalExecutorResultFromJSON, proposalExecutorResultToJSON } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroup { + /** group_id is the unique ID of the group. */ + group_id: string; +} + +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroup { + /** group_id is the unique ID of the group. */ + group_id: string; +} + +/** EventCreateGroupPolicy is an event emitted when a group policy is created. */ +export interface EventCreateGroupPolicy { + /** address is the account address of the group policy. */ + address: string; +} + +/** EventUpdateGroupPolicy is an event emitted when a group policy is updated. */ +export interface EventUpdateGroupPolicy { + /** address is the account address of the group policy. */ + address: string; +} + +/** EventSubmitProposal is an event emitted when a proposal is created. */ +export interface EventSubmitProposal { + /** proposal_id is the unique ID of the proposal. */ + proposal_id: string; +} + +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposal { + /** proposal_id is the unique ID of the proposal. */ + proposal_id: string; +} + +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVote { + /** proposal_id is the unique ID of the proposal. */ + proposal_id: string; +} + +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExec { + /** proposal_id is the unique ID of the proposal. */ + proposal_id: string; + /** result is the proposal execution result. */ + result: ProposalExecutorResult; +} + +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroup { + /** group_id is the unique ID of the group. */ + group_id: string; + /** address is the account address of the group member. */ + address: string; +} + +function createBaseEventCreateGroup(): EventCreateGroup { + return { group_id: "0" }; +} + +export const EventCreateGroup = { + encode(message: EventCreateGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateGroup { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventCreateGroup { + return { group_id: isSet(object.group_id) ? String(object.group_id) : "0" }; + }, + + toJSON(message: EventCreateGroup): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + return obj; + }, + + fromPartial, I>>(object: I): EventCreateGroup { + const message = createBaseEventCreateGroup(); + message.group_id = object.group_id ?? "0"; + return message; + }, +}; + +function createBaseEventUpdateGroup(): EventUpdateGroup { + return { group_id: "0" }; +} + +export const EventUpdateGroup = { + encode(message: EventUpdateGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateGroup { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventUpdateGroup { + return { group_id: isSet(object.group_id) ? String(object.group_id) : "0" }; + }, + + toJSON(message: EventUpdateGroup): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + return obj; + }, + + fromPartial, I>>(object: I): EventUpdateGroup { + const message = createBaseEventUpdateGroup(); + message.group_id = object.group_id ?? "0"; + return message; + }, +}; + +function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { + return { address: "" }; +} + +export const EventCreateGroupPolicy = { + encode(message: EventCreateGroupPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateGroupPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreateGroupPolicy(); + 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; + }, + + fromJSON(object: any): EventCreateGroupPolicy { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: EventCreateGroupPolicy): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): EventCreateGroupPolicy { + const message = createBaseEventCreateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { + return { address: "" }; +} + +export const EventUpdateGroupPolicy = { + encode(message: EventUpdateGroupPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateGroupPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateGroupPolicy(); + 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; + }, + + fromJSON(object: any): EventUpdateGroupPolicy { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: EventUpdateGroupPolicy): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): EventUpdateGroupPolicy { + const message = createBaseEventUpdateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventSubmitProposal(): EventSubmitProposal { + return { proposal_id: "0" }; +} + +export const EventSubmitProposal = { + encode(message: EventSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventSubmitProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventSubmitProposal { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: EventSubmitProposal): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): EventSubmitProposal { + const message = createBaseEventSubmitProposal(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseEventWithdrawProposal(): EventWithdrawProposal { + return { proposal_id: "0" }; +} + +export const EventWithdrawProposal = { + encode(message: EventWithdrawProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventWithdrawProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventWithdrawProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventWithdrawProposal { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: EventWithdrawProposal): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): EventWithdrawProposal { + const message = createBaseEventWithdrawProposal(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseEventVote(): EventVote { + return { proposal_id: "0" }; +} + +export const EventVote = { + encode(message: EventVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventVote { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: EventVote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): EventVote { + const message = createBaseEventVote(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseEventExec(): EventExec { + return { proposal_id: "0", result: 0 }; +} + +export const EventExec = { + encode(message: EventExec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventExec { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.result = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventExec { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0, + }; + }, + + toJSON(message: EventExec): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.result !== undefined && (obj.result = proposalExecutorResultToJSON(message.result)); + return obj; + }, + + fromPartial, I>>(object: I): EventExec { + const message = createBaseEventExec(); + message.proposal_id = object.proposal_id ?? "0"; + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseEventLeaveGroup(): EventLeaveGroup { + return { group_id: "0", address: "" }; +} + +export const EventLeaveGroup = { + encode(message: EventLeaveGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventLeaveGroup { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventLeaveGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventLeaveGroup { + return { + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + address: isSet(object.address) ? String(object.address) : "", + }; + }, + + toJSON(message: EventLeaveGroup): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): EventLeaveGroup { + const message = createBaseEventLeaveGroup(); + message.group_id = object.group_id ?? "0"; + message.address = object.address ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/group/v1/genesis.ts b/common/types/src/client/cosmos/group/v1/genesis.ts new file mode 100644 index 00000000..d9da567e --- /dev/null +++ b/common/types/src/client/cosmos/group/v1/genesis.ts @@ -0,0 +1,204 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** GenesisState defines the group module's genesis state. */ +export interface GenesisState { + /** + * group_seq is the group table orm.Sequence, + * it is used to get the next group ID. + */ + group_seq: string; + /** groups is the list of groups info. */ + groups: GroupInfo[]; + /** group_members is the list of groups members. */ + group_members: GroupMember[]; + /** + * group_policy_seq is the group policy table orm.Sequence, + * it is used to generate the next group policy account address. + */ + group_policy_seq: string; + /** group_policies is the list of group policies info. */ + group_policies: GroupPolicyInfo[]; + /** + * proposal_seq is the proposal table orm.Sequence, + * it is used to get the next proposal ID. + */ + proposal_seq: string; + /** proposals is the list of proposals. */ + proposals: Proposal[]; + /** votes is the list of votes. */ + votes: Vote[]; +} + +function createBaseGenesisState(): GenesisState { + return { + group_seq: "0", + groups: [], + group_members: [], + group_policy_seq: "0", + group_policies: [], + proposal_seq: "0", + proposals: [], + votes: [], + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_seq !== "0") { + writer.uint32(8).uint64(message.group_seq); + } + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.group_members) { + GroupMember.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.group_policy_seq !== "0") { + writer.uint32(32).uint64(message.group_policy_seq); + } + for (const v of message.group_policies) { + GroupPolicyInfo.encode(v!, writer.uint32(42).fork()).ldelim(); + } + if (message.proposal_seq !== "0") { + writer.uint32(48).uint64(message.proposal_seq); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_seq = longToString(reader.uint64() as Long); + break; + case 2: + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + break; + case 3: + message.group_members.push(GroupMember.decode(reader, reader.uint32())); + break; + case 4: + message.group_policy_seq = longToString(reader.uint64() as Long); + break; + case 5: + message.group_policies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + break; + case 6: + message.proposal_seq = longToString(reader.uint64() as Long); + break; + case 7: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 8: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + group_seq: isSet(object.group_seq) ? String(object.group_seq) : "0", + groups: Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + group_members: Array.isArray(object?.group_members) + ? object.group_members.map((e: any) => GroupMember.fromJSON(e)) + : [], + group_policy_seq: isSet(object.group_policy_seq) ? String(object.group_policy_seq) : "0", + group_policies: Array.isArray(object?.group_policies) + ? object.group_policies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + proposal_seq: isSet(object.proposal_seq) ? String(object.proposal_seq) : "0", + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.group_seq !== undefined && (obj.group_seq = message.group_seq); + if (message.groups) { + obj.groups = message.groups.map((e) => e ? GroupInfo.toJSON(e) : undefined); + } else { + obj.groups = []; + } + if (message.group_members) { + obj.group_members = message.group_members.map((e) => e ? GroupMember.toJSON(e) : undefined); + } else { + obj.group_members = []; + } + message.group_policy_seq !== undefined && (obj.group_policy_seq = message.group_policy_seq); + if (message.group_policies) { + obj.group_policies = message.group_policies.map((e) => e ? GroupPolicyInfo.toJSON(e) : undefined); + } else { + obj.group_policies = []; + } + message.proposal_seq !== undefined && (obj.proposal_seq = message.proposal_seq); + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.group_seq = object.group_seq ?? "0"; + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.group_members = object.group_members?.map((e) => GroupMember.fromPartial(e)) || []; + message.group_policy_seq = object.group_policy_seq ?? "0"; + message.group_policies = object.group_policies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.proposal_seq = object.proposal_seq ?? "0"; + message.proposals = object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/group/v1/query.ts b/common/types/src/client/cosmos/group/v1/query.ts new file mode 100644 index 00000000..a8c76c01 --- /dev/null +++ b/common/types/src/client/cosmos/group/v1/query.ts @@ -0,0 +1,1869 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, TallyResult, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequest { + /** group_id is the unique ID of the group. */ + group_id: string; +} + +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponse { + /** info is the GroupInfo for the group. */ + info?: GroupInfo; +} + +/** QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type. */ +export interface QueryGroupPolicyInfoRequest { + /** address is the account address of the group policy. */ + address: string; +} + +/** QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. */ +export interface QueryGroupPolicyInfoResponse { + /** info is the GroupPolicyInfo for the group policy. */ + info?: GroupPolicyInfo; +} + +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequest { + /** group_id is the unique ID of the group. */ + group_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGroupMembersResponse is the Query/GroupMembersResponse response type. */ +export interface QueryGroupMembersResponse { + /** members are the members of the group with given group_id. */ + members: GroupMember[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type. */ +export interface QueryGroupsByAdminRequest { + /** admin is the account address of a group's admin. */ + admin: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type. */ +export interface QueryGroupsByAdminResponse { + /** groups are the groups info with the provided admin. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequest { + /** group_id is the unique ID of the group policy's group. */ + group_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponse { + /** group_policies are the group policies info associated with the provided group. */ + group_policies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type. */ +export interface QueryGroupPoliciesByAdminRequest { + /** admin is the admin address of the group policy. */ + admin: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponse { + /** group_policies are the group policies info with provided admin. */ + group_policies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposal_id: string; +} + +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponse { + /** proposal is the proposal info. */ + proposal?: Proposal; +} + +/** QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type. */ +export interface QueryProposalsByGroupPolicyRequest { + /** address is the account address of the group policy related to proposals. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type. */ +export interface QueryProposalsByGroupPolicyResponse { + /** proposals are the proposals with given group policy. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequest { + /** proposal_id is the unique ID of a proposal. */ + proposal_id: string; + /** voter is a proposal voter account address. */ + voter: string; +} + +/** QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. */ +export interface QueryVoteByProposalVoterResponse { + /** vote is the vote with given proposal_id and voter. */ + vote?: Vote; +} + +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryVotesByProposalResponse is the Query/VotesByProposal response type. */ +export interface QueryVotesByProposalResponse { + /** votes are the list of votes for given proposal_id. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryVotesByVoterRequest is the Query/VotesByVoter request type. */ +export interface QueryVotesByVoterRequest { + /** voter is a proposal voter account address. */ + voter: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryVotesByVoterResponse is the Query/VotesByVoter response type. */ +export interface QueryVotesByVoterResponse { + /** votes are the list of votes by given voter. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGroupsByMemberRequest is the Query/GroupsByMember request type. */ +export interface QueryGroupsByMemberRequest { + /** address is the group member address. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGroupsByMemberResponse is the Query/GroupsByMember response type. */ +export interface QueryGroupsByMemberResponse { + /** groups are the groups info with the provided group member. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequest { + /** proposal_id is the unique id of a proposal. */ + proposal_id: string; +} + +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally?: TallyResult; +} + +function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { + return { group_id: "0" }; +} + +export const QueryGroupInfoRequest = { + encode(message: QueryGroupInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoRequest { + return { group_id: isSet(object.group_id) ? String(object.group_id) : "0" }; + }, + + toJSON(message: QueryGroupInfoRequest): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupInfoRequest { + const message = createBaseQueryGroupInfoRequest(); + message.group_id = object.group_id ?? "0"; + return message; + }, +}; + +function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { + return { info: undefined }; +} + +export const QueryGroupInfoResponse = { + encode(message: QueryGroupInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.info !== undefined) { + GroupInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info = GroupInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoResponse { + return { info: isSet(object.info) ? GroupInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupInfoResponse): unknown { + const obj: any = {}; + message.info !== undefined && (obj.info = message.info ? GroupInfo.toJSON(message.info) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupInfoResponse { + const message = createBaseQueryGroupInfoResponse(); + message.info = (object.info !== undefined && object.info !== null) ? GroupInfo.fromPartial(object.info) : undefined; + return message; + }, +}; + +function createBaseQueryGroupPolicyInfoRequest(): QueryGroupPolicyInfoRequest { + return { address: "" }; +} + +export const QueryGroupPolicyInfoRequest = { + encode(message: QueryGroupPolicyInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPolicyInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPolicyInfoRequest(); + 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; + }, + + fromJSON(object: any): QueryGroupPolicyInfoRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryGroupPolicyInfoRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupPolicyInfoRequest { + const message = createBaseQueryGroupPolicyInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { + return { info: undefined }; +} + +export const QueryGroupPolicyInfoResponse = { + encode(message: QueryGroupPolicyInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.info !== undefined) { + GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPolicyInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPolicyInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info = GroupPolicyInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoResponse { + return { info: isSet(object.info) ? GroupPolicyInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupPolicyInfoResponse): unknown { + const obj: any = {}; + message.info !== undefined && (obj.info = message.info ? GroupPolicyInfo.toJSON(message.info) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupPolicyInfoResponse { + const message = createBaseQueryGroupPolicyInfoResponse(); + message.info = (object.info !== undefined && object.info !== null) + ? GroupPolicyInfo.fromPartial(object.info) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupMembersRequest(): QueryGroupMembersRequest { + return { group_id: "0", pagination: undefined }; +} + +export const QueryGroupMembersRequest = { + encode(message: QueryGroupMembersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupMembersRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupMembersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersRequest { + return { + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupMembersRequest): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupMembersRequest { + const message = createBaseQueryGroupMembersRequest(); + message.group_id = object.group_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupMembersResponse(): QueryGroupMembersResponse { + return { members: [], pagination: undefined }; +} + +export const QueryGroupMembersResponse = { + encode(message: QueryGroupMembersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.members) { + GroupMember.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupMembersResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.members.push(GroupMember.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersResponse { + return { + members: Array.isArray(object?.members) ? object.members.map((e: any) => GroupMember.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupMembersResponse): unknown { + const obj: any = {}; + if (message.members) { + obj.members = message.members.map((e) => e ? GroupMember.toJSON(e) : undefined); + } else { + obj.members = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupMembersResponse { + const message = createBaseQueryGroupMembersResponse(); + message.members = object.members?.map((e) => GroupMember.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsByAdminRequest(): QueryGroupsByAdminRequest { + return { admin: "", pagination: undefined }; +} + +export const QueryGroupsByAdminRequest = { + encode(message: QueryGroupsByAdminRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupsByAdminRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByAdminRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminRequest { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByAdminRequest): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupsByAdminRequest { + const message = createBaseQueryGroupsByAdminRequest(); + message.admin = object.admin ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsByAdminResponse(): QueryGroupsByAdminResponse { + return { groups: [], pagination: undefined }; +} + +export const QueryGroupsByAdminResponse = { + encode(message: QueryGroupsByAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupsByAdminResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminResponse { + return { + groups: Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByAdminResponse): unknown { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map((e) => e ? GroupInfo.toJSON(e) : undefined); + } else { + obj.groups = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupsByAdminResponse { + const message = createBaseQueryGroupsByAdminResponse(); + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByGroupRequest(): QueryGroupPoliciesByGroupRequest { + return { group_id: "0", pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupRequest = { + encode(message: QueryGroupPoliciesByGroupRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByGroupRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByGroupRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupRequest { + return { + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupRequest): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupRequest { + const message = createBaseQueryGroupPoliciesByGroupRequest(); + message.group_id = object.group_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { + return { group_policies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupResponse = { + encode(message: QueryGroupPoliciesByGroupResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.group_policies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByGroupResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_policies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupResponse { + return { + group_policies: Array.isArray(object?.group_policies) + ? object.group_policies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupResponse): unknown { + const obj: any = {}; + if (message.group_policies) { + obj.group_policies = message.group_policies.map((e) => e ? GroupPolicyInfo.toJSON(e) : undefined); + } else { + obj.group_policies = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupResponse { + const message = createBaseQueryGroupPoliciesByGroupResponse(); + message.group_policies = object.group_policies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByAdminRequest(): QueryGroupPoliciesByAdminRequest { + return { admin: "", pagination: undefined }; +} + +export const QueryGroupPoliciesByAdminRequest = { + encode(message: QueryGroupPoliciesByAdminRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByAdminRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByAdminRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminRequest { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminRequest): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByAdminRequest { + const message = createBaseQueryGroupPoliciesByAdminRequest(); + message.admin = object.admin ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByAdminResponse(): QueryGroupPoliciesByAdminResponse { + return { group_policies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByAdminResponse = { + encode(message: QueryGroupPoliciesByAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.group_policies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByAdminResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_policies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminResponse { + return { + group_policies: Array.isArray(object?.group_policies) + ? object.group_policies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminResponse): unknown { + const obj: any = {}; + if (message.group_policies) { + obj.group_policies = message.group_policies.map((e) => e ? GroupPolicyInfo.toJSON(e) : undefined); + } else { + obj.group_policies = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByAdminResponse { + const message = createBaseQueryGroupPoliciesByAdminResponse(); + message.group_policies = object.group_policies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposal_id: "0" }; +} + +export const QueryProposalRequest = { + encode(message: QueryProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse = { + encode(message: QueryProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = (object.proposal !== undefined && object.proposal !== null) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { + return { address: "", pagination: undefined }; +} + +export const QueryProposalsByGroupPolicyRequest = { + encode(message: QueryProposalsByGroupPolicyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsByGroupPolicyRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsByGroupPolicyRequest(); + 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; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsByGroupPolicyRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryProposalsByGroupPolicyRequest { + const message = createBaseQueryProposalsByGroupPolicyRequest(); + message.address = object.address ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsByGroupPolicyResponse(): QueryProposalsByGroupPolicyResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsByGroupPolicyResponse = { + encode(message: QueryProposalsByGroupPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsByGroupPolicyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsByGroupPolicyResponse(); + 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; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyResponse { + return { + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsByGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryProposalsByGroupPolicyResponse { + const message = createBaseQueryProposalsByGroupPolicyResponse(); + message.proposals = object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteByProposalVoterRequest(): QueryVoteByProposalVoterRequest { + return { proposal_id: "0", voter: "" }; +} + +export const QueryVoteByProposalVoterRequest = { + encode(message: QueryVoteByProposalVoterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteByProposalVoterRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteByProposalVoterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteByProposalVoterRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryVoteByProposalVoterRequest { + const message = createBaseQueryVoteByProposalVoterRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { + return { vote: undefined }; +} + +export const QueryVoteByProposalVoterResponse = { + encode(message: QueryVoteByProposalVoterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteByProposalVoterResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteByProposalVoterResponse(); + 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; + }, + + fromJSON(object: any): QueryVoteByProposalVoterResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteByProposalVoterResponse): unknown { + const obj: any = {}; + message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryVoteByProposalVoterResponse { + const message = createBaseQueryVoteByProposalVoterResponse(); + message.vote = (object.vote !== undefined && object.vote !== null) ? Vote.fromPartial(object.vote) : undefined; + return message; + }, +}; + +function createBaseQueryVotesByProposalRequest(): QueryVotesByProposalRequest { + return { proposal_id: "0", pagination: undefined }; +} + +export const QueryVotesByProposalRequest = { + encode(message: QueryVotesByProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesByProposalRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByProposalRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesByProposalRequest { + const message = createBaseQueryVotesByProposalRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVotesByProposalResponse(): QueryVotesByProposalResponse { + return { votes: [], pagination: undefined }; +} + +export const QueryVotesByProposalResponse = { + encode(message: QueryVotesByProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryVotesByProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByProposalResponse(); + 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; + }, + + fromJSON(object: any): QueryVotesByProposalResponse { + return { + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByProposalResponse): unknown { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesByProposalResponse { + const message = createBaseQueryVotesByProposalResponse(); + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVotesByVoterRequest(): QueryVotesByVoterRequest { + return { voter: "", pagination: undefined }; +} + +export const QueryVotesByVoterRequest = { + encode(message: QueryVotesByVoterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voter !== "") { + writer.uint32(10).string(message.voter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesByVoterRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByVoterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voter = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterRequest { + return { + voter: isSet(object.voter) ? String(object.voter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByVoterRequest): unknown { + const obj: any = {}; + message.voter !== undefined && (obj.voter = message.voter); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesByVoterRequest { + const message = createBaseQueryVotesByVoterRequest(); + message.voter = object.voter ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVotesByVoterResponse(): QueryVotesByVoterResponse { + return { votes: [], pagination: undefined }; +} + +export const QueryVotesByVoterResponse = { + encode(message: QueryVotesByVoterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryVotesByVoterResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByVoterResponse(); + 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; + }, + + fromJSON(object: any): QueryVotesByVoterResponse { + return { + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByVoterResponse): unknown { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesByVoterResponse { + const message = createBaseQueryVotesByVoterResponse(); + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsByMemberRequest(): QueryGroupsByMemberRequest { + return { address: "", pagination: undefined }; +} + +export const QueryGroupsByMemberRequest = { + encode(message: QueryGroupsByMemberRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryGroupsByMemberRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByMemberRequest(); + 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; + }, + + fromJSON(object: any): QueryGroupsByMemberRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByMemberRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupsByMemberRequest { + const message = createBaseQueryGroupsByMemberRequest(); + message.address = object.address ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsByMemberResponse(): QueryGroupsByMemberResponse { + return { groups: [], pagination: undefined }; +} + +export const QueryGroupsByMemberResponse = { + encode(message: QueryGroupsByMemberResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupsByMemberResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByMemberResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberResponse { + return { + groups: Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByMemberResponse): unknown { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map((e) => e ? GroupInfo.toJSON(e) : undefined); + } else { + obj.groups = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupsByMemberResponse { + const message = createBaseQueryGroupsByMemberResponse(); + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposal_id: "0" }; +} + +export const QueryTallyResultRequest = { + encode(message: QueryTallyResultRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse = { + encode(message: QueryTallyResultResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = (object.tally !== undefined && object.tally !== null) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query is the cosmos.group.v1 Query service. */ +export interface Query { + /** GroupInfo queries group info based on group id. */ + GroupInfo(request: QueryGroupInfoRequest): Promise; + /** GroupPolicyInfo queries group policy info based on account address of group policy. */ + GroupPolicyInfo(request: QueryGroupPolicyInfoRequest): Promise; + /** GroupMembers queries members of a group */ + GroupMembers(request: QueryGroupMembersRequest): Promise; + /** GroupsByAdmin queries groups by admin address. */ + GroupsByAdmin(request: QueryGroupsByAdminRequest): Promise; + /** GroupPoliciesByGroup queries group policies by group id. */ + GroupPoliciesByGroup(request: QueryGroupPoliciesByGroupRequest): Promise; + /** GroupsByAdmin queries group policies by admin address. */ + GroupPoliciesByAdmin(request: QueryGroupPoliciesByAdminRequest): Promise; + /** Proposal queries a proposal based on proposal id. */ + Proposal(request: QueryProposalRequest): Promise; + /** ProposalsByGroupPolicy queries proposals based on account address of group policy. */ + ProposalsByGroupPolicy(request: QueryProposalsByGroupPolicyRequest): Promise; + /** VoteByProposalVoter queries a vote by proposal id and voter. */ + VoteByProposalVoter(request: QueryVoteByProposalVoterRequest): Promise; + /** VotesByProposal queries a vote by proposal. */ + VotesByProposal(request: QueryVotesByProposalRequest): Promise; + /** VotesByVoter queries a vote by voter. */ + VotesByVoter(request: QueryVotesByVoterRequest): Promise; + /** GroupsByMember queries groups by member address. */ + GroupsByMember(request: QueryGroupsByMemberRequest): Promise; + /** TallyResult queries the tally of a proposal votes. */ + TallyResult(request: QueryTallyResultRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.group.v1.Query"; + this.rpc = rpc; + this.GroupInfo = this.GroupInfo.bind(this); + this.GroupPolicyInfo = this.GroupPolicyInfo.bind(this); + this.GroupMembers = this.GroupMembers.bind(this); + this.GroupsByAdmin = this.GroupsByAdmin.bind(this); + this.GroupPoliciesByGroup = this.GroupPoliciesByGroup.bind(this); + this.GroupPoliciesByAdmin = this.GroupPoliciesByAdmin.bind(this); + this.Proposal = this.Proposal.bind(this); + this.ProposalsByGroupPolicy = this.ProposalsByGroupPolicy.bind(this); + this.VoteByProposalVoter = this.VoteByProposalVoter.bind(this); + this.VotesByProposal = this.VotesByProposal.bind(this); + this.VotesByVoter = this.VotesByVoter.bind(this); + this.GroupsByMember = this.GroupsByMember.bind(this); + this.TallyResult = this.TallyResult.bind(this); + } + GroupInfo(request: QueryGroupInfoRequest): Promise { + const data = QueryGroupInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupInfo", data); + return promise.then((data) => QueryGroupInfoResponse.decode(new _m0.Reader(data))); + } + + GroupPolicyInfo(request: QueryGroupPolicyInfoRequest): Promise { + const data = QueryGroupPolicyInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupPolicyInfo", data); + return promise.then((data) => QueryGroupPolicyInfoResponse.decode(new _m0.Reader(data))); + } + + GroupMembers(request: QueryGroupMembersRequest): Promise { + const data = QueryGroupMembersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupMembers", data); + return promise.then((data) => QueryGroupMembersResponse.decode(new _m0.Reader(data))); + } + + GroupsByAdmin(request: QueryGroupsByAdminRequest): Promise { + const data = QueryGroupsByAdminRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupsByAdmin", data); + return promise.then((data) => QueryGroupsByAdminResponse.decode(new _m0.Reader(data))); + } + + GroupPoliciesByGroup(request: QueryGroupPoliciesByGroupRequest): Promise { + const data = QueryGroupPoliciesByGroupRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupPoliciesByGroup", data); + return promise.then((data) => QueryGroupPoliciesByGroupResponse.decode(new _m0.Reader(data))); + } + + GroupPoliciesByAdmin(request: QueryGroupPoliciesByAdminRequest): Promise { + const data = QueryGroupPoliciesByAdminRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupPoliciesByAdmin", data); + return promise.then((data) => QueryGroupPoliciesByAdminResponse.decode(new _m0.Reader(data))); + } + + Proposal(request: QueryProposalRequest): Promise { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Proposal", data); + return promise.then((data) => QueryProposalResponse.decode(new _m0.Reader(data))); + } + + ProposalsByGroupPolicy(request: QueryProposalsByGroupPolicyRequest): Promise { + const data = QueryProposalsByGroupPolicyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ProposalsByGroupPolicy", data); + return promise.then((data) => QueryProposalsByGroupPolicyResponse.decode(new _m0.Reader(data))); + } + + VoteByProposalVoter(request: QueryVoteByProposalVoterRequest): Promise { + const data = QueryVoteByProposalVoterRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteByProposalVoter", data); + return promise.then((data) => QueryVoteByProposalVoterResponse.decode(new _m0.Reader(data))); + } + + VotesByProposal(request: QueryVotesByProposalRequest): Promise { + const data = QueryVotesByProposalRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VotesByProposal", data); + return promise.then((data) => QueryVotesByProposalResponse.decode(new _m0.Reader(data))); + } + + VotesByVoter(request: QueryVotesByVoterRequest): Promise { + const data = QueryVotesByVoterRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VotesByVoter", data); + return promise.then((data) => QueryVotesByVoterResponse.decode(new _m0.Reader(data))); + } + + GroupsByMember(request: QueryGroupsByMemberRequest): Promise { + const data = QueryGroupsByMemberRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupsByMember", data); + return promise.then((data) => QueryGroupsByMemberResponse.decode(new _m0.Reader(data))); + } + + TallyResult(request: QueryTallyResultRequest): Promise { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TallyResult", data); + return promise.then((data) => QueryTallyResultResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/group/v1/tx.ts b/common/types/src/client/cosmos/group/v1/tx.ts new file mode 100644 index 00000000..88c083b1 --- /dev/null +++ b/common/types/src/client/cosmos/group/v1/tx.ts @@ -0,0 +1,2070 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Member, VoteOption, voteOptionFromJSON, voteOptionToJSON } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** 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 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: Member[]; + /** metadata is any arbitrary metadata to attached to the group. */ + metadata: string; +} + +/** MsgCreateGroupResponse is the Msg/CreateGroup response type. */ +export interface MsgCreateGroupResponse { + /** group_id is the unique ID of the newly created group. */ + group_id: string; +} + +/** 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. */ + group_id: string; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + member_updates: Member[]; +} + +/** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ +export interface MsgUpdateGroupMembersResponse { +} + +/** 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. */ + group_id: string; + /** new_admin is the group new admin account address. */ + new_admin: string; +} + +/** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ +export interface MsgUpdateGroupAdminResponse { +} + +/** 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. */ + group_id: string; + /** metadata is the updated group's metadata. */ + metadata: string; +} + +/** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ +export interface MsgUpdateGroupMetadataResponse { +} + +/** 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. */ + 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?: Any; +} + +/** MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. */ +export interface MsgCreateGroupPolicyResponse { + /** address is the account address of the newly created group policy. */ + address: string; +} + +/** MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. */ +export interface MsgUpdateGroupPolicyAdmin { + /** admin is the account address of the group admin. */ + admin: string; + /** address is the account address of the group policy. */ + address: string; + /** new_admin is the new group policy admin. */ + new_admin: string; +} + +/** 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: Member[]; + /** 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?: Any; +} + +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponse { + /** 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; +} + +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponse { +} + +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** address is the account address of group policy. */ + address: string; + /** decision_policy is the updated group policy's decision policy. */ + decision_policy?: Any; +} + +/** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ +export interface MsgUpdateGroupPolicyDecisionPolicyResponse { +} + +/** MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. */ +export interface MsgUpdateGroupPolicyMetadata { + /** admin is the account address of the group admin. */ + admin: string; + /** address is the account address of group policy. */ + address: string; + /** metadata is the updated group policy metadata. */ + metadata: string; +} + +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponse { +} + +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposal { + /** address is the account address of 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 to 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; +} + +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal is the unique ID of the proposal. */ + proposal_id: string; +} + +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposal { + /** 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; +} + +/** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ +export interface MsgWithdrawProposalResponse { +} + +/** MsgVote is the Msg/Vote request type. */ +export interface MsgVote { + /** 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 to attached to the vote. */ + metadata: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec: Exec; +} + +/** MsgVoteResponse is the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgExec is the Msg/Exec request type. */ +export interface MsgExec { + /** proposal is the unique ID of the proposal. */ + proposal_id: string; + /** signer is the account address used to execute the proposal. */ + signer: string; +} + +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponse { +} + +/** 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. */ + group_id: string; +} + +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponse { +} + +function createBaseMsgCreateGroup(): MsgCreateGroup { + return { admin: "", members: [], metadata: "" }; +} + +export const MsgCreateGroup = { + encode(message: MsgCreateGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + Member.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroup { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(Member.decode(reader, reader.uint32())); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateGroup { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [], + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgCreateGroup): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + if (message.members) { + obj.members = message.members.map((e) => e ? Member.toJSON(e) : undefined); + } else { + obj.members = []; + } + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => Member.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { + return { group_id: "0" }; +} + +export const MsgCreateGroupResponse = { + encode(message: MsgCreateGroupResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupResponse { + return { group_id: isSet(object.group_id) ? String(object.group_id) : "0" }; + }, + + toJSON(message: MsgCreateGroupResponse): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + message.group_id = object.group_id ?? "0"; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { + return { admin: "", group_id: "0", member_updates: [] }; +} + +export const MsgUpdateGroupMembers = { + encode(message: MsgUpdateGroupMembers, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + for (const v of message.member_updates) { + Member.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMembers { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 3: + message.member_updates.push(Member.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMembers { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + member_updates: Array.isArray(object?.member_updates) + ? object.member_updates.map((e: any) => Member.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgUpdateGroupMembers): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.group_id !== undefined && (obj.group_id = message.group_id); + if (message.member_updates) { + obj.member_updates = message.member_updates.map((e) => e ? Member.toJSON(e) : undefined); + } else { + obj.member_updates = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + message.admin = object.admin ?? ""; + message.group_id = object.group_id ?? "0"; + message.member_updates = object.member_updates?.map((e) => Member.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { + return {}; +} + +export const MsgUpdateGroupMembersResponse = { + encode(_: MsgUpdateGroupMembersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupMembersResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMembersResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { + return { admin: "", group_id: "0", new_admin: "" }; +} + +export const MsgUpdateGroupAdmin = { + encode(message: MsgUpdateGroupAdmin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + if (message.new_admin !== "") { + writer.uint32(26).string(message.new_admin); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupAdmin { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 3: + message.new_admin = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupAdmin { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + new_admin: isSet(object.new_admin) ? String(object.new_admin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupAdmin): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.group_id !== undefined && (obj.group_id = message.group_id); + message.new_admin !== undefined && (obj.new_admin = message.new_admin); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + message.admin = object.admin ?? ""; + message.group_id = object.group_id ?? "0"; + message.new_admin = object.new_admin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { + return {}; +} + +export const MsgUpdateGroupAdminResponse = { + encode(_: MsgUpdateGroupAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { + return { admin: "", group_id: "0", metadata: "" }; +} + +export const MsgUpdateGroupMetadata = { + encode(message: MsgUpdateGroupMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMetadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMetadata { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupMetadata): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.group_id !== undefined && (obj.group_id = message.group_id); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + message.admin = object.admin ?? ""; + message.group_id = object.group_id ?? "0"; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { + return {}; +} + +export const MsgUpdateGroupMetadataResponse = { + encode(_: MsgUpdateGroupMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { + return { admin: "", group_id: "0", metadata: "", decision_policy: undefined }; +} + +export const MsgCreateGroupPolicy = { + encode(message: MsgCreateGroupPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.decision_policy !== undefined) { + Any.encode(message.decision_policy, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.decision_policy = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicy { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + decision_policy: isSet(object.decision_policy) ? Any.fromJSON(object.decision_policy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupPolicy): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.group_id !== undefined && (obj.group_id = message.group_id); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.decision_policy !== undefined && + (obj.decision_policy = message.decision_policy ? Any.toJSON(message.decision_policy) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + message.admin = object.admin ?? ""; + message.group_id = object.group_id ?? "0"; + message.metadata = object.metadata ?? ""; + message.decision_policy = (object.decision_policy !== undefined && object.decision_policy !== null) + ? Any.fromPartial(object.decision_policy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { + return { address: "" }; +} + +export const MsgCreateGroupPolicyResponse = { + encode(message: MsgCreateGroupPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgCreateGroupPolicyResponse { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: MsgCreateGroupPolicyResponse): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { + return { admin: "", address: "", new_admin: "" }; +} + +export const MsgUpdateGroupPolicyAdmin = { + encode(message: MsgUpdateGroupPolicyAdmin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.new_admin !== "") { + writer.uint32(26).string(message.new_admin); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address = reader.string(); + break; + case 3: + message.new_admin = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyAdmin { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + address: isSet(object.address) ? String(object.address) : "", + new_admin: isSet(object.new_admin) ? String(object.new_admin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyAdmin): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.address !== undefined && (obj.address = message.address); + message.new_admin !== undefined && (obj.new_admin = message.new_admin); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + message.admin = object.admin ?? ""; + message.address = object.address ?? ""; + message.new_admin = object.new_admin ?? ""; + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { + return { + admin: "", + members: [], + group_metadata: "", + group_policy_metadata: "", + group_policy_as_admin: false, + decision_policy: undefined, + }; +} + +export const MsgCreateGroupWithPolicy = { + encode(message: MsgCreateGroupWithPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + Member.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.group_metadata !== "") { + writer.uint32(26).string(message.group_metadata); + } + if (message.group_policy_metadata !== "") { + writer.uint32(34).string(message.group_policy_metadata); + } + if (message.group_policy_as_admin === true) { + writer.uint32(40).bool(message.group_policy_as_admin); + } + if (message.decision_policy !== undefined) { + Any.encode(message.decision_policy, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(Member.decode(reader, reader.uint32())); + break; + case 3: + message.group_metadata = reader.string(); + break; + case 4: + message.group_policy_metadata = reader.string(); + break; + case 5: + message.group_policy_as_admin = reader.bool(); + break; + case 6: + message.decision_policy = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicy { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [], + group_metadata: isSet(object.group_metadata) ? String(object.group_metadata) : "", + group_policy_metadata: isSet(object.group_policy_metadata) ? String(object.group_policy_metadata) : "", + group_policy_as_admin: isSet(object.group_policy_as_admin) ? Boolean(object.group_policy_as_admin) : false, + decision_policy: isSet(object.decision_policy) ? Any.fromJSON(object.decision_policy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupWithPolicy): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + if (message.members) { + obj.members = message.members.map((e) => e ? Member.toJSON(e) : undefined); + } else { + obj.members = []; + } + message.group_metadata !== undefined && (obj.group_metadata = message.group_metadata); + message.group_policy_metadata !== undefined && (obj.group_policy_metadata = message.group_policy_metadata); + message.group_policy_as_admin !== undefined && (obj.group_policy_as_admin = message.group_policy_as_admin); + message.decision_policy !== undefined && + (obj.decision_policy = message.decision_policy ? Any.toJSON(message.decision_policy) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => Member.fromPartial(e)) || []; + message.group_metadata = object.group_metadata ?? ""; + message.group_policy_metadata = object.group_policy_metadata ?? ""; + message.group_policy_as_admin = object.group_policy_as_admin ?? false; + message.decision_policy = (object.decision_policy !== undefined && object.decision_policy !== null) + ? Any.fromPartial(object.decision_policy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { + return { group_id: "0", group_policy_address: "" }; +} + +export const MsgCreateGroupWithPolicyResponse = { + encode(message: MsgCreateGroupWithPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + if (message.group_policy_address !== "") { + writer.uint32(18).string(message.group_policy_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 2: + message.group_policy_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicyResponse { + return { + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + group_policy_address: isSet(object.group_policy_address) ? String(object.group_policy_address) : "", + }; + }, + + toJSON(message: MsgCreateGroupWithPolicyResponse): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + message.group_policy_address !== undefined && (obj.group_policy_address = message.group_policy_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + message.group_id = object.group_id ?? "0"; + message.group_policy_address = object.group_policy_address ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { + return {}; +} + +export const MsgUpdateGroupPolicyAdminResponse = { + encode(_: MsgUpdateGroupPolicyAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { + return { admin: "", address: "", decision_policy: undefined }; +} + +export const MsgUpdateGroupPolicyDecisionPolicy = { + encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.decision_policy !== undefined) { + Any.encode(message.decision_policy, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address = reader.string(); + break; + case 3: + message.decision_policy = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyDecisionPolicy { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + address: isSet(object.address) ? String(object.address) : "", + decision_policy: isSet(object.decision_policy) ? Any.fromJSON(object.decision_policy) : undefined, + }; + }, + + toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.address !== undefined && (obj.address = message.address); + message.decision_policy !== undefined && + (obj.decision_policy = message.decision_policy ? Any.toJSON(message.decision_policy) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + message.admin = object.admin ?? ""; + message.address = object.address ?? ""; + message.decision_policy = (object.decision_policy !== undefined && object.decision_policy !== null) + ? Any.fromPartial(object.decision_policy) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; +} + +export const MsgUpdateGroupPolicyDecisionPolicyResponse = { + encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { + return { admin: "", address: "", metadata: "" }; +} + +export const MsgUpdateGroupPolicyMetadata = { + encode(message: MsgUpdateGroupPolicyMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyMetadata { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + address: isSet(object.address) ? String(object.address) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyMetadata): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.address !== undefined && (obj.address = message.address); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + message.admin = object.admin ?? ""; + message.address = object.address ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { + return {}; +} + +export const MsgUpdateGroupPolicyMetadataResponse = { + encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, +}; + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { address: "", proposers: [], metadata: "", messages: [], exec: 0 }; +} + +export const MsgSubmitProposal = { + encode(message: MsgSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + 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); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address = 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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + address: isSet(object.address) ? String(object.address) : "", + proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => String(e)) : [], + metadata: isSet(object.metadata) ? String(object.metadata) : "", + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.proposers) { + obj.proposers = message.proposers.map((e) => e); + } else { + obj.proposers = []; + } + message.metadata !== undefined && (obj.metadata = message.metadata); + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + message.exec !== undefined && (obj.exec = execToJSON(message.exec)); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.address = object.address ?? ""; + 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; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposal_id: "0" }; +} + +export const MsgSubmitProposalResponse = { + encode(message: MsgSubmitProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { + return { proposal_id: "0", address: "" }; +} + +export const MsgWithdrawProposal = { + encode(message: MsgWithdrawProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgWithdrawProposal { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + address: isSet(object.address) ? String(object.address) : "", + }; + }, + + toJSON(message: MsgWithdrawProposal): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + message.proposal_id = object.proposal_id ?? "0"; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { + return {}; +} + +export const MsgWithdrawProposalResponse = { + encode(_: MsgWithdrawProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgWithdrawProposalResponse { + return {}; + }, + + toJSON(_: MsgWithdrawProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposal_id: "0", voter: "", option: 0, metadata: "", exec: 0 }; +} + +export const MsgVote = { + encode(message: MsgVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgVote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? String(object.metadata) : "", + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.exec !== undefined && (obj.exec = execToJSON(message.exec)); + return obj; + }, + + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.exec = object.exec ?? 0; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse = { + encode(_: MsgVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { proposal_id: "0", signer: "" }; +} + +export const MsgExec = { + encode(message: MsgExec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.proposal_id = object.proposal_id ?? "0"; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return {}; +} + +export const MsgExecResponse = { + encode(_: MsgExecResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgExecResponse { + return {}; + }, + + toJSON(_: MsgExecResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + return message; + }, +}; + +function createBaseMsgLeaveGroup(): MsgLeaveGroup { + return { address: "", group_id: "0" }; +} + +export const MsgLeaveGroup = { + encode(message: MsgLeaveGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeaveGroup { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgLeaveGroup { + return { + address: isSet(object.address) ? String(object.address) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + }; + }, + + toJSON(message: MsgLeaveGroup): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.group_id !== undefined && (obj.group_id = message.group_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + message.address = object.address ?? ""; + message.group_id = object.group_id ?? "0"; + return message; + }, +}; + +function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { + return {}; +} + +export const MsgLeaveGroupResponse = { + encode(_: MsgLeaveGroupResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeaveGroupResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgLeaveGroupResponse { + return {}; + }, + + toJSON(_: MsgLeaveGroupResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgLeaveGroupResponse { + const message = createBaseMsgLeaveGroupResponse(); + return message; + }, +}; + +/** Msg is the cosmos.group.v1 Msg service. */ +export interface Msg { + /** CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. */ + CreateGroup(request: MsgCreateGroup): Promise; + /** UpdateGroupMembers updates the group members with given group id and admin address. */ + UpdateGroupMembers(request: MsgUpdateGroupMembers): Promise; + /** UpdateGroupAdmin updates the group admin with given group id and previous admin address. */ + UpdateGroupAdmin(request: MsgUpdateGroupAdmin): Promise; + /** UpdateGroupMetadata updates the group metadata with given group id and admin address. */ + UpdateGroupMetadata(request: MsgUpdateGroupMetadata): Promise; + /** CreateGroupPolicy creates a new group policy using given DecisionPolicy. */ + CreateGroupPolicy(request: MsgCreateGroupPolicy): Promise; + /** CreateGroupWithPolicy creates a new group with policy. */ + CreateGroupWithPolicy(request: MsgCreateGroupWithPolicy): Promise; + /** UpdateGroupPolicyAdmin updates a group policy admin. */ + UpdateGroupPolicyAdmin(request: MsgUpdateGroupPolicyAdmin): Promise; + /** UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. */ + UpdateGroupPolicyDecisionPolicy( + request: MsgUpdateGroupPolicyDecisionPolicy, + ): Promise; + /** UpdateGroupPolicyMetadata updates a group policy metadata. */ + UpdateGroupPolicyMetadata(request: MsgUpdateGroupPolicyMetadata): Promise; + /** SubmitProposal submits a new proposal. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** WithdrawProposal aborts a proposal. */ + WithdrawProposal(request: MsgWithdrawProposal): Promise; + /** Vote allows a voter to vote on a proposal. */ + Vote(request: MsgVote): Promise; + /** Exec executes a proposal. */ + Exec(request: MsgExec): Promise; + /** LeaveGroup allows a group member to leave the group. */ + LeaveGroup(request: MsgLeaveGroup): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.group.v1.Msg"; + this.rpc = rpc; + this.CreateGroup = this.CreateGroup.bind(this); + this.UpdateGroupMembers = this.UpdateGroupMembers.bind(this); + this.UpdateGroupAdmin = this.UpdateGroupAdmin.bind(this); + this.UpdateGroupMetadata = this.UpdateGroupMetadata.bind(this); + this.CreateGroupPolicy = this.CreateGroupPolicy.bind(this); + this.CreateGroupWithPolicy = this.CreateGroupWithPolicy.bind(this); + this.UpdateGroupPolicyAdmin = this.UpdateGroupPolicyAdmin.bind(this); + this.UpdateGroupPolicyDecisionPolicy = this.UpdateGroupPolicyDecisionPolicy.bind(this); + this.UpdateGroupPolicyMetadata = this.UpdateGroupPolicyMetadata.bind(this); + this.SubmitProposal = this.SubmitProposal.bind(this); + this.WithdrawProposal = this.WithdrawProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.Exec = this.Exec.bind(this); + this.LeaveGroup = this.LeaveGroup.bind(this); + } + CreateGroup(request: MsgCreateGroup): Promise { + const data = MsgCreateGroup.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateGroup", data); + return promise.then((data) => MsgCreateGroupResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupMembers(request: MsgUpdateGroupMembers): Promise { + const data = MsgUpdateGroupMembers.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupMembers", data); + return promise.then((data) => MsgUpdateGroupMembersResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupAdmin(request: MsgUpdateGroupAdmin): Promise { + const data = MsgUpdateGroupAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupAdmin", data); + return promise.then((data) => MsgUpdateGroupAdminResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupMetadata(request: MsgUpdateGroupMetadata): Promise { + const data = MsgUpdateGroupMetadata.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupMetadata", data); + return promise.then((data) => MsgUpdateGroupMetadataResponse.decode(new _m0.Reader(data))); + } + + CreateGroupPolicy(request: MsgCreateGroupPolicy): Promise { + const data = MsgCreateGroupPolicy.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateGroupPolicy", data); + return promise.then((data) => MsgCreateGroupPolicyResponse.decode(new _m0.Reader(data))); + } + + CreateGroupWithPolicy(request: MsgCreateGroupWithPolicy): Promise { + const data = MsgCreateGroupWithPolicy.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateGroupWithPolicy", data); + return promise.then((data) => MsgCreateGroupWithPolicyResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupPolicyAdmin(request: MsgUpdateGroupPolicyAdmin): Promise { + const data = MsgUpdateGroupPolicyAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupPolicyAdmin", data); + return promise.then((data) => MsgUpdateGroupPolicyAdminResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupPolicyDecisionPolicy( + request: MsgUpdateGroupPolicyDecisionPolicy, + ): Promise { + const data = MsgUpdateGroupPolicyDecisionPolicy.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupPolicyDecisionPolicy", data); + return promise.then((data) => MsgUpdateGroupPolicyDecisionPolicyResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupPolicyMetadata(request: MsgUpdateGroupPolicyMetadata): Promise { + const data = MsgUpdateGroupPolicyMetadata.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupPolicyMetadata", data); + return promise.then((data) => MsgUpdateGroupPolicyMetadataResponse.decode(new _m0.Reader(data))); + } + + SubmitProposal(request: MsgSubmitProposal): Promise { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitProposal", data); + return promise.then((data) => MsgSubmitProposalResponse.decode(new _m0.Reader(data))); + } + + WithdrawProposal(request: MsgWithdrawProposal): Promise { + const data = MsgWithdrawProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "WithdrawProposal", data); + return promise.then((data) => MsgWithdrawProposalResponse.decode(new _m0.Reader(data))); + } + + Vote(request: MsgVote): Promise { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "Vote", data); + return promise.then((data) => MsgVoteResponse.decode(new _m0.Reader(data))); + } + + Exec(request: MsgExec): Promise { + const data = MsgExec.encode(request).finish(); + const promise = this.rpc.request(this.service, "Exec", data); + return promise.then((data) => MsgExecResponse.decode(new _m0.Reader(data))); + } + + LeaveGroup(request: MsgLeaveGroup): Promise { + const data = MsgLeaveGroup.encode(request).finish(); + const promise = this.rpc.request(this.service, "LeaveGroup", data); + return promise.then((data) => MsgLeaveGroupResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/group/v1/types.ts b/common/types/src/client/cosmos/group/v1/types.ts new file mode 100644 index 00000000..b21cad7c --- /dev/null +++ b/common/types/src/client/cosmos/group/v1/types.ts @@ -0,0 +1,1394 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.group.v1"; + +/** VoteOption enumerates the valid vote options for a given 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 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 persisted. */ + PROPOSAL_STATUS_SUBMITTED = 1, + /** PROPOSAL_STATUS_CLOSED - Final status of a proposal when the final tally was executed. */ + PROPOSAL_STATUS_CLOSED = 2, + /** PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group was modified before the final tally. */ + PROPOSAL_STATUS_ABORTED = 3, + /** + * PROPOSAL_STATUS_WITHDRAWN - A proposal can be deleted before the voting start time by the owner. When this happens the final status + * is Withdrawn. + */ + PROPOSAL_STATUS_WITHDRAWN = 4, + UNRECOGNIZED = -1, +} + +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_CLOSED": + return ProposalStatus.PROPOSAL_STATUS_CLOSED; + case 3: + case "PROPOSAL_STATUS_ABORTED": + return ProposalStatus.PROPOSAL_STATUS_ABORTED; + case 4: + 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_CLOSED: + return "PROPOSAL_STATUS_CLOSED"; + case ProposalStatus.PROPOSAL_STATUS_ABORTED: + return "PROPOSAL_STATUS_ABORTED"; + case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: + return "PROPOSAL_STATUS_WITHDRAWN"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ProposalResult defines types of proposal results. */ +export enum ProposalResult { + /** PROPOSAL_RESULT_UNSPECIFIED - An empty value is invalid and not allowed */ + PROPOSAL_RESULT_UNSPECIFIED = 0, + /** PROPOSAL_RESULT_UNFINALIZED - Until a final tally has happened the status is unfinalized */ + PROPOSAL_RESULT_UNFINALIZED = 1, + /** PROPOSAL_RESULT_ACCEPTED - Final result of the tally */ + PROPOSAL_RESULT_ACCEPTED = 2, + /** PROPOSAL_RESULT_REJECTED - Final result of the tally */ + PROPOSAL_RESULT_REJECTED = 3, + UNRECOGNIZED = -1, +} + +export function proposalResultFromJSON(object: any): ProposalResult { + switch (object) { + case 0: + case "PROPOSAL_RESULT_UNSPECIFIED": + return ProposalResult.PROPOSAL_RESULT_UNSPECIFIED; + case 1: + case "PROPOSAL_RESULT_UNFINALIZED": + return ProposalResult.PROPOSAL_RESULT_UNFINALIZED; + case 2: + case "PROPOSAL_RESULT_ACCEPTED": + return ProposalResult.PROPOSAL_RESULT_ACCEPTED; + case 3: + case "PROPOSAL_RESULT_REJECTED": + return ProposalResult.PROPOSAL_RESULT_REJECTED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalResult.UNRECOGNIZED; + } +} + +export function proposalResultToJSON(object: ProposalResult): string { + switch (object) { + case ProposalResult.PROPOSAL_RESULT_UNSPECIFIED: + return "PROPOSAL_RESULT_UNSPECIFIED"; + case ProposalResult.PROPOSAL_RESULT_UNFINALIZED: + return "PROPOSAL_RESULT_UNFINALIZED"; + case ProposalResult.PROPOSAL_RESULT_ACCEPTED: + return "PROPOSAL_RESULT_ACCEPTED"; + case ProposalResult.PROPOSAL_RESULT_REJECTED: + return "PROPOSAL_RESULT_REJECTED"; + case ProposalResult.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 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 and metadata. + */ +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 to attached to the member. */ + metadata: string; + /** added_at is a timestamp specifying when a member was added. */ + added_at?: Date; +} + +/** Members defines a repeated slice of Member objects. */ +export interface Members { + /** members is the list of members. */ + members: Member[]; +} + +/** ThresholdDecisionPolicy implements the DecisionPolicy interface */ +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; +} + +/** PercentageDecisionPolicy implements the DecisionPolicy interface */ +export interface PercentageDecisionPolicy { + /** percentage is the minimum percentage 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; +} + +/** 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. + */ + voting_period?: 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. + */ + min_execution_period?: Duration; +} + +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfo { + /** 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. */ + 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?: Date; +} + +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMember { + /** group_id is the unique ID of the group. */ + group_id: string; + /** member is the member data. */ + member?: Member; +} + +/** 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. */ + group_id: string; + /** admin is the account address of the group admin. */ + admin: string; + /** metadata is any arbitrary metadata to attached to the group policy. */ + 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?: Any; + /** created_at is a timestamp specifying when a group policy was created. */ + created_at?: Date; +} + +/** + * 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: string; + /** address is the account address of group policy. */ + address: string; + /** metadata is any arbitrary metadata to attached to the proposal. */ + 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?: Date; + /** + * group_version tracks the version of the group that this proposal corresponds to. + * When group membership is changed, existing proposals from previous group versions will become invalid. + */ + group_version: string; + /** + * group_policy_version tracks the version of the group policy that this proposal corresponds to. + * When a decision policy is changed, existing proposals from previous policy versions will become invalid. + */ + group_policy_version: string; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status: ProposalStatus; + /** + * result is the final result based on the votes and election rule. Initial value is unfinalized. + * The result is persisted so that clients can always rely on this state and not have to replicate the logic. + */ + result: ProposalResult; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option, after tallying. When querying a proposal + * via gRPC, this field is not populated until the proposal's voting period + * has ended. + */ + final_tally_result?: TallyResult; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successfull 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`, as well + * as `status` and `result` fields will be accordingly updated. + */ + voting_period_end?: Date; + /** executor_result is the final result based on the votes and election rule. Initial value is NotRun. */ + executor_result: ProposalExecutorResult; + /** messages is a list of Msgs that will be executed if the proposal passes. */ + messages: Any[]; +} + +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResult { + /** yes_count is the weighted sum of yes votes. */ + yes_count: string; + /** abstain_count is the weighted sum of abstainers. */ + abstain_count: string; + /** no 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; +} + +/** Vote represents a vote for a proposal. */ +export interface Vote { + /** 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 to attached to the vote. */ + metadata: string; + /** submit_time is the timestamp when the vote was submitted. */ + submit_time?: Date; +} + +function createBaseMember(): Member { + return { address: "", weight: "", metadata: "", added_at: undefined }; +} + +export const Member = { + encode(message: Member, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.added_at !== undefined) { + Timestamp.encode(toTimestamp(message.added_at), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Member { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.added_at = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Member { + return { + address: isSet(object.address) ? String(object.address) : "", + weight: isSet(object.weight) ? String(object.weight) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + added_at: isSet(object.added_at) ? fromJsonTimestamp(object.added_at) : undefined, + }; + }, + + toJSON(message: Member): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.weight !== undefined && (obj.weight = message.weight); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.added_at !== undefined && (obj.added_at = message.added_at.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): Member { + const message = createBaseMember(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + message.added_at = object.added_at ?? undefined; + return message; + }, +}; + +function createBaseMembers(): Members { + return { members: [] }; +} + +export const Members = { + encode(message: Members, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.members) { + Member.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Members { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMembers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.members.push(Member.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Members { + return { members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [] }; + }, + + toJSON(message: Members): unknown { + const obj: any = {}; + if (message.members) { + obj.members = message.members.map((e) => e ? Member.toJSON(e) : undefined); + } else { + obj.members = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Members { + const message = createBaseMembers(); + message.members = object.members?.map((e) => Member.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { + return { threshold: "", windows: undefined }; +} + +export const ThresholdDecisionPolicy = { + encode(message: ThresholdDecisionPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): ThresholdDecisionPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ThresholdDecisionPolicy { + return { + threshold: isSet(object.threshold) ? String(object.threshold) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: ThresholdDecisionPolicy): unknown { + const obj: any = {}; + message.threshold !== undefined && (obj.threshold = message.threshold); + message.windows !== undefined && + (obj.windows = message.windows ? DecisionPolicyWindows.toJSON(message.windows) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): ThresholdDecisionPolicy { + const message = createBaseThresholdDecisionPolicy(); + message.threshold = object.threshold ?? ""; + message.windows = (object.windows !== undefined && object.windows !== null) + ? DecisionPolicyWindows.fromPartial(object.windows) + : undefined; + return message; + }, +}; + +function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { + return { percentage: "", windows: undefined }; +} + +export const PercentageDecisionPolicy = { + encode(message: PercentageDecisionPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): PercentageDecisionPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PercentageDecisionPolicy { + return { + percentage: isSet(object.percentage) ? String(object.percentage) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: PercentageDecisionPolicy): unknown { + const obj: any = {}; + message.percentage !== undefined && (obj.percentage = message.percentage); + message.windows !== undefined && + (obj.windows = message.windows ? DecisionPolicyWindows.toJSON(message.windows) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): PercentageDecisionPolicy { + const message = createBasePercentageDecisionPolicy(); + message.percentage = object.percentage ?? ""; + message.windows = (object.windows !== undefined && object.windows !== null) + ? DecisionPolicyWindows.fromPartial(object.windows) + : undefined; + return message; + }, +}; + +function createBaseDecisionPolicyWindows(): DecisionPolicyWindows { + return { voting_period: undefined, min_execution_period: undefined }; +} + +export const DecisionPolicyWindows = { + encode(message: DecisionPolicyWindows, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voting_period !== undefined) { + Duration.encode(message.voting_period, writer.uint32(10).fork()).ldelim(); + } + if (message.min_execution_period !== undefined) { + Duration.encode(message.min_execution_period, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecisionPolicyWindows { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.voting_period = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.min_execution_period = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DecisionPolicyWindows { + return { + voting_period: isSet(object.voting_period) ? Duration.fromJSON(object.voting_period) : undefined, + min_execution_period: isSet(object.min_execution_period) + ? Duration.fromJSON(object.min_execution_period) + : undefined, + }; + }, + + toJSON(message: DecisionPolicyWindows): unknown { + const obj: any = {}; + message.voting_period !== undefined && + (obj.voting_period = message.voting_period ? Duration.toJSON(message.voting_period) : undefined); + message.min_execution_period !== undefined && (obj.min_execution_period = message.min_execution_period + ? Duration.toJSON(message.min_execution_period) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + message.voting_period = (object.voting_period !== undefined && object.voting_period !== null) + ? Duration.fromPartial(object.voting_period) + : undefined; + message.min_execution_period = (object.min_execution_period !== undefined && object.min_execution_period !== null) + ? Duration.fromPartial(object.min_execution_period) + : undefined; + return message; + }, +}; + +function createBaseGroupInfo(): GroupInfo { + return { id: "0", admin: "", metadata: "", version: "0", total_weight: "", created_at: undefined }; +} + +export const GroupInfo = { + encode(message: GroupInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "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 !== "0") { + writer.uint32(32).uint64(message.version); + } + if (message.total_weight !== "") { + writer.uint32(42).string(message.total_weight); + } + if (message.created_at !== undefined) { + Timestamp.encode(toTimestamp(message.created_at), writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GroupInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.admin = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.version = longToString(reader.uint64() as Long); + break; + case 5: + message.total_weight = reader.string(); + break; + case 6: + message.created_at = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GroupInfo { + return { + id: isSet(object.id) ? String(object.id) : "0", + admin: isSet(object.admin) ? String(object.admin) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + version: isSet(object.version) ? String(object.version) : "0", + total_weight: isSet(object.total_weight) ? String(object.total_weight) : "", + created_at: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined, + }; + }, + + toJSON(message: GroupInfo): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.admin !== undefined && (obj.admin = message.admin); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.version !== undefined && (obj.version = message.version); + message.total_weight !== undefined && (obj.total_weight = message.total_weight); + message.created_at !== undefined && (obj.created_at = message.created_at.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): GroupInfo { + const message = createBaseGroupInfo(); + message.id = object.id ?? "0"; + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version ?? "0"; + message.total_weight = object.total_weight ?? ""; + message.created_at = object.created_at ?? undefined; + return message; + }, +}; + +function createBaseGroupMember(): GroupMember { + return { group_id: "0", member: undefined }; +} + +export const GroupMember = { + encode(message: GroupMember, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + if (message.member !== undefined) { + Member.encode(message.member, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GroupMember { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 2: + message.member = Member.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GroupMember { + return { + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + member: isSet(object.member) ? Member.fromJSON(object.member) : undefined, + }; + }, + + toJSON(message: GroupMember): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + message.member !== undefined && (obj.member = message.member ? Member.toJSON(message.member) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GroupMember { + const message = createBaseGroupMember(); + message.group_id = object.group_id ?? "0"; + message.member = (object.member !== undefined && object.member !== null) + ? Member.fromPartial(object.member) + : undefined; + return message; + }, +}; + +function createBaseGroupPolicyInfo(): GroupPolicyInfo { + return { + address: "", + group_id: "0", + admin: "", + metadata: "", + version: "0", + decision_policy: undefined, + created_at: undefined, + }; +} + +export const GroupPolicyInfo = { + encode(message: GroupPolicyInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.version !== "0") { + writer.uint32(40).uint64(message.version); + } + if (message.decision_policy !== undefined) { + Any.encode(message.decision_policy, writer.uint32(50).fork()).ldelim(); + } + if (message.created_at !== undefined) { + Timestamp.encode(toTimestamp(message.created_at), writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GroupPolicyInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 3: + message.admin = reader.string(); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.version = longToString(reader.uint64() as Long); + break; + case 6: + message.decision_policy = Any.decode(reader, reader.uint32()); + break; + case 7: + message.created_at = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GroupPolicyInfo { + return { + address: isSet(object.address) ? String(object.address) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + admin: isSet(object.admin) ? String(object.admin) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + version: isSet(object.version) ? String(object.version) : "0", + decision_policy: isSet(object.decision_policy) ? Any.fromJSON(object.decision_policy) : undefined, + created_at: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined, + }; + }, + + toJSON(message: GroupPolicyInfo): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.group_id !== undefined && (obj.group_id = message.group_id); + message.admin !== undefined && (obj.admin = message.admin); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.version !== undefined && (obj.version = message.version); + message.decision_policy !== undefined && + (obj.decision_policy = message.decision_policy ? Any.toJSON(message.decision_policy) : undefined); + message.created_at !== undefined && (obj.created_at = message.created_at.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + message.address = object.address ?? ""; + message.group_id = object.group_id ?? "0"; + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version ?? "0"; + message.decision_policy = (object.decision_policy !== undefined && object.decision_policy !== null) + ? Any.fromPartial(object.decision_policy) + : undefined; + message.created_at = object.created_at ?? undefined; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: "0", + address: "", + metadata: "", + proposers: [], + submit_time: undefined, + group_version: "0", + group_policy_version: "0", + status: 0, + result: 0, + final_tally_result: undefined, + voting_period_end: undefined, + executor_result: 0, + messages: [], + }; +} + +export const Proposal = { + encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.proposers) { + writer.uint32(34).string(v!); + } + if (message.submit_time !== undefined) { + Timestamp.encode(toTimestamp(message.submit_time), writer.uint32(42).fork()).ldelim(); + } + if (message.group_version !== "0") { + writer.uint32(48).uint64(message.group_version); + } + if (message.group_policy_version !== "0") { + writer.uint32(56).uint64(message.group_policy_version); + } + if (message.status !== 0) { + writer.uint32(64).int32(message.status); + } + if (message.result !== 0) { + writer.uint32(72).int32(message.result); + } + if (message.final_tally_result !== undefined) { + TallyResult.encode(message.final_tally_result, writer.uint32(82).fork()).ldelim(); + } + if (message.voting_period_end !== undefined) { + Timestamp.encode(toTimestamp(message.voting_period_end), writer.uint32(90).fork()).ldelim(); + } + if (message.executor_result !== 0) { + writer.uint32(96).int32(message.executor_result); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(106).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.proposers.push(reader.string()); + break; + case 5: + message.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.group_version = longToString(reader.uint64() as Long); + break; + case 7: + message.group_policy_version = longToString(reader.uint64() as Long); + break; + case 8: + message.status = reader.int32() as any; + break; + case 9: + message.result = reader.int32() as any; + break; + case 10: + message.final_tally_result = TallyResult.decode(reader, reader.uint32()); + break; + case 11: + message.voting_period_end = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 12: + message.executor_result = reader.int32() as any; + break; + case 13: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? String(object.id) : "0", + address: isSet(object.address) ? String(object.address) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => String(e)) : [], + submit_time: isSet(object.submit_time) ? fromJsonTimestamp(object.submit_time) : undefined, + group_version: isSet(object.group_version) ? String(object.group_version) : "0", + group_policy_version: isSet(object.group_policy_version) ? String(object.group_policy_version) : "0", + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + result: isSet(object.result) ? proposalResultFromJSON(object.result) : 0, + final_tally_result: isSet(object.final_tally_result) + ? TallyResult.fromJSON(object.final_tally_result) + : undefined, + voting_period_end: isSet(object.voting_period_end) ? fromJsonTimestamp(object.voting_period_end) : undefined, + executor_result: isSet(object.executor_result) ? proposalExecutorResultFromJSON(object.executor_result) : 0, + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.address !== undefined && (obj.address = message.address); + message.metadata !== undefined && (obj.metadata = message.metadata); + if (message.proposers) { + obj.proposers = message.proposers.map((e) => e); + } else { + obj.proposers = []; + } + message.submit_time !== undefined && (obj.submit_time = message.submit_time.toISOString()); + message.group_version !== undefined && (obj.group_version = message.group_version); + message.group_policy_version !== undefined && (obj.group_policy_version = message.group_policy_version); + message.status !== undefined && (obj.status = proposalStatusToJSON(message.status)); + message.result !== undefined && (obj.result = proposalResultToJSON(message.result)); + message.final_tally_result !== undefined && + (obj.final_tally_result = message.final_tally_result + ? TallyResult.toJSON(message.final_tally_result) + : undefined); + message.voting_period_end !== undefined && (obj.voting_period_end = message.voting_period_end.toISOString()); + message.executor_result !== undefined && + (obj.executor_result = proposalExecutorResultToJSON(message.executor_result)); + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.id = object.id ?? "0"; + message.address = object.address ?? ""; + message.metadata = object.metadata ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.submit_time = object.submit_time ?? undefined; + message.group_version = object.group_version ?? "0"; + message.group_policy_version = object.group_policy_version ?? "0"; + message.status = object.status ?? 0; + message.result = object.result ?? 0; + message.final_tally_result = (object.final_tally_result !== undefined && object.final_tally_result !== null) + ? TallyResult.fromPartial(object.final_tally_result) + : undefined; + message.voting_period_end = object.voting_period_end ?? undefined; + message.executor_result = object.executor_result ?? 0; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes_count: "", abstain_count: "", no_count: "", no_with_veto_count: "" }; +} + +export const TallyResult = { + encode(message: TallyResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.yes_count !== "") { + writer.uint32(10).string(message.yes_count); + } + if (message.abstain_count !== "") { + writer.uint32(18).string(message.abstain_count); + } + if (message.no_count !== "") { + writer.uint32(26).string(message.no_count); + } + if (message.no_with_veto_count !== "") { + writer.uint32(34).string(message.no_with_veto_count); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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_count = reader.string(); + break; + case 2: + message.abstain_count = reader.string(); + break; + case 3: + message.no_count = reader.string(); + break; + case 4: + message.no_with_veto_count = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes_count: isSet(object.yes_count) ? String(object.yes_count) : "", + abstain_count: isSet(object.abstain_count) ? String(object.abstain_count) : "", + no_count: isSet(object.no_count) ? String(object.no_count) : "", + no_with_veto_count: isSet(object.no_with_veto_count) ? String(object.no_with_veto_count) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + message.yes_count !== undefined && (obj.yes_count = message.yes_count); + message.abstain_count !== undefined && (obj.abstain_count = message.abstain_count); + message.no_count !== undefined && (obj.no_count = message.no_count); + message.no_with_veto_count !== undefined && (obj.no_with_veto_count = message.no_with_veto_count); + return obj; + }, + + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes_count = object.yes_count ?? ""; + message.abstain_count = object.abstain_count ?? ""; + message.no_count = object.no_count ?? ""; + message.no_with_veto_count = object.no_with_veto_count ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposal_id: "0", voter: "", option: 0, metadata: "", submit_time: undefined }; +} + +export const Vote = { + encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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.submit_time !== undefined) { + Timestamp.encode(toTimestamp(message.submit_time), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Vote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? String(object.metadata) : "", + submit_time: isSet(object.submit_time) ? fromJsonTimestamp(object.submit_time) : undefined, + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.submit_time !== undefined && (obj.submit_time = message.submit_time.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.submit_time = object.submit_time ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/mint/v1beta1/genesis.ts b/common/types/src/client/cosmos/mint/v1beta1/genesis.ts new file mode 100644 index 00000000..b1725bfe --- /dev/null +++ b/common/types/src/client/cosmos/mint/v1beta1/genesis.ts @@ -0,0 +1,90 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Minter, Params } from "./mint"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** GenesisState defines the mint module's genesis state. */ +export interface GenesisState { + /** minter is a space for holding current inflation information. */ + minter?: Minter; + /** params defines all the paramaters of the module. */ + params?: Params; +} + +function createBaseGenesisState(): GenesisState { + return { minter: undefined, params: undefined }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(10).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minter = Minter.decode(reader, reader.uint32()); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + minter: isSet(object.minter) ? Minter.fromJSON(object.minter) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.minter !== undefined && (obj.minter = message.minter ? Minter.toJSON(message.minter) : undefined); + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.minter = (object.minter !== undefined && object.minter !== null) + ? Minter.fromPartial(object.minter) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/mint/v1beta1/mint.ts b/common/types/src/client/cosmos/mint/v1beta1/mint.ts new file mode 100644 index 00000000..2606feac --- /dev/null +++ b/common/types/src/client/cosmos/mint/v1beta1/mint.ts @@ -0,0 +1,212 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** Minter represents the minting state. */ +export interface Minter { + /** current annual inflation rate */ + inflation: string; + /** current annual expected provisions */ + annual_provisions: string; +} + +/** Params holds parameters for the mint module. */ +export interface Params { + /** type of coin to mint */ + mint_denom: string; + /** maximum annual change in inflation rate */ + inflation_rate_change: string; + /** maximum inflation rate */ + inflation_max: string; + /** minimum inflation rate */ + inflation_min: string; + /** goal of percent bonded atoms */ + goal_bonded: string; + /** expected blocks per year */ + blocks_per_year: string; +} + +function createBaseMinter(): Minter { + return { inflation: "", annual_provisions: "" }; +} + +export const Minter = { + encode(message: Minter, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.inflation !== "") { + writer.uint32(10).string(message.inflation); + } + if (message.annual_provisions !== "") { + writer.uint32(18).string(message.annual_provisions); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Minter { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMinter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inflation = reader.string(); + break; + case 2: + message.annual_provisions = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Minter { + return { + inflation: isSet(object.inflation) ? String(object.inflation) : "", + annual_provisions: isSet(object.annual_provisions) ? String(object.annual_provisions) : "", + }; + }, + + toJSON(message: Minter): unknown { + const obj: any = {}; + message.inflation !== undefined && (obj.inflation = message.inflation); + message.annual_provisions !== undefined && (obj.annual_provisions = message.annual_provisions); + return obj; + }, + + fromPartial, I>>(object: I): Minter { + const message = createBaseMinter(); + message.inflation = object.inflation ?? ""; + message.annual_provisions = object.annual_provisions ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + mint_denom: "", + inflation_rate_change: "", + inflation_max: "", + inflation_min: "", + goal_bonded: "", + blocks_per_year: "0", + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.mint_denom !== "") { + writer.uint32(10).string(message.mint_denom); + } + if (message.inflation_rate_change !== "") { + writer.uint32(18).string(message.inflation_rate_change); + } + if (message.inflation_max !== "") { + writer.uint32(26).string(message.inflation_max); + } + if (message.inflation_min !== "") { + writer.uint32(34).string(message.inflation_min); + } + if (message.goal_bonded !== "") { + writer.uint32(42).string(message.goal_bonded); + } + if (message.blocks_per_year !== "0") { + writer.uint32(48).uint64(message.blocks_per_year); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.mint_denom = reader.string(); + break; + case 2: + message.inflation_rate_change = reader.string(); + break; + case 3: + message.inflation_max = reader.string(); + break; + case 4: + message.inflation_min = reader.string(); + break; + case 5: + message.goal_bonded = reader.string(); + break; + case 6: + message.blocks_per_year = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + mint_denom: isSet(object.mint_denom) ? String(object.mint_denom) : "", + inflation_rate_change: isSet(object.inflation_rate_change) ? String(object.inflation_rate_change) : "", + inflation_max: isSet(object.inflation_max) ? String(object.inflation_max) : "", + inflation_min: isSet(object.inflation_min) ? String(object.inflation_min) : "", + goal_bonded: isSet(object.goal_bonded) ? String(object.goal_bonded) : "", + blocks_per_year: isSet(object.blocks_per_year) ? String(object.blocks_per_year) : "0", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.mint_denom !== undefined && (obj.mint_denom = message.mint_denom); + message.inflation_rate_change !== undefined && (obj.inflation_rate_change = message.inflation_rate_change); + message.inflation_max !== undefined && (obj.inflation_max = message.inflation_max); + message.inflation_min !== undefined && (obj.inflation_min = message.inflation_min); + message.goal_bonded !== undefined && (obj.goal_bonded = message.goal_bonded); + message.blocks_per_year !== undefined && (obj.blocks_per_year = message.blocks_per_year); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.mint_denom = object.mint_denom ?? ""; + message.inflation_rate_change = object.inflation_rate_change ?? ""; + message.inflation_max = object.inflation_max ?? ""; + message.inflation_min = object.inflation_min ?? ""; + message.goal_bonded = object.goal_bonded ?? ""; + message.blocks_per_year = object.blocks_per_year ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/mint/v1beta1/query.ts b/common/types/src/client/cosmos/mint/v1beta1/query.ts new file mode 100644 index 00000000..20642bf4 --- /dev/null +++ b/common/types/src/client/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,414 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./mint"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +/** QueryInflationRequest is the request type for the Query/Inflation RPC method. */ +export interface QueryInflationRequest { +} + +/** + * QueryInflationResponse is the response type for the Query/Inflation RPC + * method. + */ +export interface QueryInflationResponse { + /** inflation is the current minting inflation value. */ + inflation: Uint8Array; +} + +/** + * QueryAnnualProvisionsRequest is the request type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsRequest { +} + +/** + * QueryAnnualProvisionsResponse is the response type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsResponse { + /** annual_provisions is the current minting annual provisions value. */ + annual_provisions: Uint8Array; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryInflationRequest(): QueryInflationRequest { + return {}; +} + +export const QueryInflationRequest = { + encode(_: QueryInflationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryInflationRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryInflationRequest { + return {}; + }, + + toJSON(_: QueryInflationRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, +}; + +function createBaseQueryInflationResponse(): QueryInflationResponse { + return { inflation: new Uint8Array() }; +} + +export const QueryInflationResponse = { + encode(message: QueryInflationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.inflation.length !== 0) { + writer.uint32(10).bytes(message.inflation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryInflationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inflation = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryInflationResponse { + return { inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array() }; + }, + + toJSON(message: QueryInflationResponse): unknown { + const obj: any = {}; + message.inflation !== undefined && + (obj.inflation = base64FromBytes(message.inflation !== undefined ? message.inflation : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + message.inflation = object.inflation ?? new Uint8Array(); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { + return {}; +} + +export const QueryAnnualProvisionsRequest = { + encode(_: QueryAnnualProvisionsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAnnualProvisionsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryAnnualProvisionsRequest { + return {}; + }, + + toJSON(_: QueryAnnualProvisionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { + return { annual_provisions: new Uint8Array() }; +} + +export const QueryAnnualProvisionsResponse = { + encode(message: QueryAnnualProvisionsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.annual_provisions.length !== 0) { + writer.uint32(10).bytes(message.annual_provisions); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAnnualProvisionsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.annual_provisions = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAnnualProvisionsResponse { + return { + annual_provisions: isSet(object.annual_provisions) ? bytesFromBase64(object.annual_provisions) : new Uint8Array(), + }; + }, + + toJSON(message: QueryAnnualProvisionsResponse): unknown { + const obj: any = {}; + message.annual_provisions !== undefined && + (obj.annual_provisions = base64FromBytes( + message.annual_provisions !== undefined ? message.annual_provisions : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + message.annual_provisions = object.annual_provisions ?? new Uint8Array(); + return message; + }, +}; + +/** Query provides defines the gRPC querier service. */ +export interface Query { + /** Params returns the total set of minting parameters. */ + Params(request: QueryParamsRequest): Promise; + /** Inflation returns the current minting inflation value. */ + Inflation(request: QueryInflationRequest): Promise; + /** AnnualProvisions current minting annual provisions value. */ + AnnualProvisions(request: QueryAnnualProvisionsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.mint.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Inflation = this.Inflation.bind(this); + this.AnnualProvisions = this.AnnualProvisions.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + Inflation(request: QueryInflationRequest): Promise { + const data = QueryInflationRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Inflation", data); + return promise.then((data) => QueryInflationResponse.decode(new _m0.Reader(data))); + } + + AnnualProvisions(request: QueryAnnualProvisionsRequest): Promise { + const data = QueryAnnualProvisionsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AnnualProvisions", data); + return promise.then((data) => QueryAnnualProvisionsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/msg/v1/msg.ts b/common/types/src/client/cosmos/msg/v1/msg.ts new file mode 100644 index 00000000..093dfbba --- /dev/null +++ b/common/types/src/client/cosmos/msg/v1/msg.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.v1"; diff --git a/common/types/src/client/cosmos/nft/v1beta1/event.ts b/common/types/src/client/cosmos/nft/v1beta1/event.ts new file mode 100644 index 00000000..ce6086aa --- /dev/null +++ b/common/types/src/client/cosmos/nft/v1beta1/event.ts @@ -0,0 +1,251 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** EventSend is emitted on Msg/Send */ +export interface EventSend { + class_id: string; + id: string; + sender: string; + receiver: string; +} + +/** EventMint is emitted on Mint */ +export interface EventMint { + class_id: string; + id: string; + owner: string; +} + +/** EventBurn is emitted on Burn */ +export interface EventBurn { + class_id: string; + id: string; + owner: string; +} + +function createBaseEventSend(): EventSend { + return { class_id: "", id: "", sender: "", receiver: "" }; +} + +export const EventSend = { + encode(message: EventSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(34).string(message.receiver); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventSend { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.sender = reader.string(); + break; + case 4: + message.receiver = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventSend { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + sender: isSet(object.sender) ? String(object.sender) : "", + receiver: isSet(object.receiver) ? String(object.receiver) : "", + }; + }, + + toJSON(message: EventSend): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + message.sender !== undefined && (obj.sender = message.sender); + message.receiver !== undefined && (obj.receiver = message.receiver); + return obj; + }, + + fromPartial, I>>(object: I): EventSend { + const message = createBaseEventSend(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseEventMint(): EventMint { + return { class_id: "", id: "", owner: "" }; +} + +export const EventMint = { + encode(message: EventMint, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventMint { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.owner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventMint { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + }; + }, + + toJSON(message: EventMint): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + message.owner !== undefined && (obj.owner = message.owner); + return obj; + }, + + fromPartial, I>>(object: I): EventMint { + const message = createBaseEventMint(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseEventBurn(): EventBurn { + return { class_id: "", id: "", owner: "" }; +} + +export const EventBurn = { + encode(message: EventBurn, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventBurn { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.owner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventBurn { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + }; + }, + + toJSON(message: EventBurn): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + message.owner !== undefined && (obj.owner = message.owner); + return obj; + }, + + fromPartial, I>>(object: I): EventBurn { + const message = createBaseEventBurn(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/nft/v1beta1/genesis.ts b/common/types/src/client/cosmos/nft/v1beta1/genesis.ts new file mode 100644 index 00000000..6257458c --- /dev/null +++ b/common/types/src/client/cosmos/nft/v1beta1/genesis.ts @@ -0,0 +1,163 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Class, NFT } from "./nft"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** GenesisState defines the nft module's genesis state. */ +export interface GenesisState { + /** class defines the class of the nft type. */ + classes: Class[]; + entries: Entry[]; +} + +/** Entry Defines all nft owned by a person */ +export interface Entry { + /** owner is the owner address of the following nft */ + owner: string; + /** nfts is a group of nfts of the same owner */ + nfts: NFT[]; +} + +function createBaseGenesisState(): GenesisState { + return { classes: [], entries: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.entries) { + Entry.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.classes.push(Class.decode(reader, reader.uint32())); + break; + case 2: + message.entries.push(Entry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + classes: Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => Entry.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.classes) { + obj.classes = message.classes.map((e) => e ? Class.toJSON(e) : undefined); + } else { + obj.classes = []; + } + if (message.entries) { + obj.entries = message.entries.map((e) => e ? Entry.toJSON(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.classes = object.classes?.map((e) => Class.fromPartial(e)) || []; + message.entries = object.entries?.map((e) => Entry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEntry(): Entry { + return { owner: "", nfts: [] }; +} + +export const Entry = { + encode(message: Entry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Entry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.nfts.push(NFT.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Entry { + return { + owner: isSet(object.owner) ? String(object.owner) : "", + nfts: Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], + }; + }, + + toJSON(message: Entry): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + if (message.nfts) { + obj.nfts = message.nfts.map((e) => e ? NFT.toJSON(e) : undefined); + } else { + obj.nfts = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Entry { + const message = createBaseEntry(); + message.owner = object.owner ?? ""; + message.nfts = object.nfts?.map((e) => NFT.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/nft/v1beta1/nft.ts b/common/types/src/client/cosmos/nft/v1beta1/nft.ts new file mode 100644 index 00000000..d98d6e78 --- /dev/null +++ b/common/types/src/client/cosmos/nft/v1beta1/nft.ts @@ -0,0 +1,240 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** Class defines the class of the nft type. */ +export interface Class { + /** id defines the unique identifier of the NFT classification, similar to the contract address of ERC721 */ + id: string; + /** name defines the human-readable name of the NFT classification. Optional */ + name: string; + /** symbol is an abbreviated name for nft classification. Optional */ + symbol: string; + /** description is a brief description of nft classification. Optional */ + description: string; + /** uri for the class metadata stored off chain. It can define schema for Class and NFT `Data` attributes. Optional */ + uri: string; + /** uri_hash is a hash of the document pointed by uri. Optional */ + uri_hash: string; + /** data is the app specific metadata of the NFT class. Optional */ + data?: Any; +} + +/** NFT defines the NFT. */ +export interface NFT { + /** class_id associated with the NFT, similar to the contract address of ERC721 */ + class_id: string; + /** id is a unique identifier of the NFT */ + id: string; + /** uri for the NFT metadata stored off chain */ + uri: string; + /** uri_hash is a hash of the document pointed by uri */ + uri_hash: string; + /** data is an app specific data of the NFT. Optional */ + data?: Any; +} + +function createBaseClass(): Class { + return { id: "", name: "", symbol: "", description: "", uri: "", uri_hash: "", data: undefined }; +} + +export const Class = { + encode(message: Class, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(26).string(message.symbol); + } + if (message.description !== "") { + writer.uint32(34).string(message.description); + } + if (message.uri !== "") { + writer.uint32(42).string(message.uri); + } + if (message.uri_hash !== "") { + writer.uint32(50).string(message.uri_hash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Class { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClass(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.symbol = reader.string(); + break; + case 4: + message.description = reader.string(); + break; + case 5: + message.uri = reader.string(); + break; + case 6: + message.uri_hash = reader.string(); + break; + case 7: + message.data = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Class { + return { + id: isSet(object.id) ? String(object.id) : "", + name: isSet(object.name) ? String(object.name) : "", + symbol: isSet(object.symbol) ? String(object.symbol) : "", + description: isSet(object.description) ? String(object.description) : "", + uri: isSet(object.uri) ? String(object.uri) : "", + uri_hash: isSet(object.uri_hash) ? String(object.uri_hash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: Class): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.name !== undefined && (obj.name = message.name); + message.symbol !== undefined && (obj.symbol = message.symbol); + message.description !== undefined && (obj.description = message.description); + message.uri !== undefined && (obj.uri = message.uri); + message.uri_hash !== undefined && (obj.uri_hash = message.uri_hash); + message.data !== undefined && (obj.data = message.data ? Any.toJSON(message.data) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Class { + const message = createBaseClass(); + message.id = object.id ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.description = object.description ?? ""; + message.uri = object.uri ?? ""; + message.uri_hash = object.uri_hash ?? ""; + message.data = (object.data !== undefined && object.data !== null) ? Any.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseNFT(): NFT { + return { class_id: "", id: "", uri: "", uri_hash: "", data: undefined }; +} + +export const NFT = { + encode(message: NFT, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.uri !== "") { + writer.uint32(26).string(message.uri); + } + if (message.uri_hash !== "") { + writer.uint32(34).string(message.uri_hash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(82).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NFT { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNFT(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.uri = reader.string(); + break; + case 4: + message.uri_hash = reader.string(); + break; + case 10: + message.data = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NFT { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + uri: isSet(object.uri) ? String(object.uri) : "", + uri_hash: isSet(object.uri_hash) ? String(object.uri_hash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: NFT): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + message.uri !== undefined && (obj.uri = message.uri); + message.uri_hash !== undefined && (obj.uri_hash = message.uri_hash); + message.data !== undefined && (obj.data = message.data ? Any.toJSON(message.data) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): NFT { + const message = createBaseNFT(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + message.uri = object.uri ?? ""; + message.uri_hash = object.uri_hash ?? ""; + message.data = (object.data !== undefined && object.data !== null) ? Any.fromPartial(object.data) : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/nft/v1beta1/query.ts b/common/types/src/client/cosmos/nft/v1beta1/query.ts new file mode 100644 index 00000000..53e32d15 --- /dev/null +++ b/common/types/src/client/cosmos/nft/v1beta1/query.ts @@ -0,0 +1,944 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Class, NFT } from "./nft"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** QueryBalanceRequest is the request type for the Query/Balance RPC method */ +export interface QueryBalanceRequest { + class_id: string; + owner: string; +} + +/** QueryBalanceResponse is the response type for the Query/Balance RPC method */ +export interface QueryBalanceResponse { + amount: string; +} + +/** QueryOwnerRequest is the request type for the Query/Owner RPC method */ +export interface QueryOwnerRequest { + class_id: string; + id: string; +} + +/** QueryOwnerResponse is the response type for the Query/Owner RPC method */ +export interface QueryOwnerResponse { + owner: string; +} + +/** QuerySupplyRequest is the request type for the Query/Supply RPC method */ +export interface QuerySupplyRequest { + class_id: string; +} + +/** QuerySupplyResponse is the response type for the Query/Supply RPC method */ +export interface QuerySupplyResponse { + amount: string; +} + +/** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ +export interface QueryNFTsRequest { + class_id: string; + owner: string; + pagination?: PageRequest; +} + +/** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ +export interface QueryNFTsResponse { + nfts: NFT[]; + pagination?: PageResponse; +} + +/** QueryNFTRequest is the request type for the Query/NFT RPC method */ +export interface QueryNFTRequest { + class_id: string; + id: string; +} + +/** QueryNFTResponse is the response type for the Query/NFT RPC method */ +export interface QueryNFTResponse { + nft?: NFT; +} + +/** QueryClassRequest is the request type for the Query/Class RPC method */ +export interface QueryClassRequest { + class_id: string; +} + +/** QueryClassResponse is the response type for the Query/Class RPC method */ +export interface QueryClassResponse { + class?: Class; +} + +/** QueryClassesRequest is the request type for the Query/Classes RPC method */ +export interface QueryClassesRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryClassesResponse is the response type for the Query/Classes RPC method */ +export interface QueryClassesResponse { + classes: Class[]; + pagination?: PageResponse; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { class_id: "", owner: "" }; +} + +export const QueryBalanceRequest = { + encode(message: QueryBalanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.class_id = reader.string(); + break; + case 2: + message.owner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.owner !== undefined && (obj.owner = message.owner); + return obj; + }, + + fromPartial, I>>(object: I): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.class_id = object.class_id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { amount: "0" }; +} + +export const QueryBalanceResponse = { + encode(message: QueryBalanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== "0") { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { amount: isSet(object.amount) ? String(object.amount) : "0" }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseQueryOwnerRequest(): QueryOwnerRequest { + return { class_id: "", id: "" }; +} + +export const QueryOwnerRequest = { + encode(message: QueryOwnerRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryOwnerRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOwnerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryOwnerRequest { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + }; + }, + + toJSON(message: QueryOwnerRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): QueryOwnerRequest { + const message = createBaseQueryOwnerRequest(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryOwnerResponse(): QueryOwnerResponse { + return { owner: "" }; +} + +export const QueryOwnerResponse = { + encode(message: QueryOwnerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryOwnerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOwnerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryOwnerResponse { + return { owner: isSet(object.owner) ? String(object.owner) : "" }; + }, + + toJSON(message: QueryOwnerResponse): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + return obj; + }, + + fromPartial, I>>(object: I): QueryOwnerResponse { + const message = createBaseQueryOwnerResponse(); + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyRequest(): QuerySupplyRequest { + return { class_id: "" }; +} + +export const QuerySupplyRequest = { + encode(message: QuerySupplyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySupplyRequest { + return { class_id: isSet(object.class_id) ? String(object.class_id) : "" }; + }, + + toJSON(message: QuerySupplyRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + return obj; + }, + + fromPartial, I>>(object: I): QuerySupplyRequest { + const message = createBaseQuerySupplyRequest(); + message.class_id = object.class_id ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyResponse(): QuerySupplyResponse { + return { amount: "0" }; +} + +export const QuerySupplyResponse = { + encode(message: QuerySupplyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== "0") { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySupplyResponse { + return { amount: isSet(object.amount) ? String(object.amount) : "0" }; + }, + + toJSON(message: QuerySupplyResponse): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): QuerySupplyResponse { + const message = createBaseQuerySupplyResponse(); + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseQueryNFTsRequest(): QueryNFTsRequest { + return { class_id: "", owner: "", pagination: undefined }; +} + +export const QueryNFTsRequest = { + encode(message: QueryNFTsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.owner = reader.string(); + break; + case 3: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryNFTsRequest { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryNFTsRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.owner !== undefined && (obj.owner = message.owner); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryNFTsRequest { + const message = createBaseQueryNFTsRequest(); + message.class_id = object.class_id ?? ""; + message.owner = object.owner ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryNFTsResponse(): QueryNFTsResponse { + return { nfts: [], pagination: undefined }; +} + +export const QueryNFTsResponse = { + encode(message: QueryNFTsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nfts.push(NFT.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryNFTsResponse { + return { + nfts: Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryNFTsResponse): unknown { + const obj: any = {}; + if (message.nfts) { + obj.nfts = message.nfts.map((e) => e ? NFT.toJSON(e) : undefined); + } else { + obj.nfts = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryNFTsResponse { + const message = createBaseQueryNFTsResponse(); + message.nfts = object.nfts?.map((e) => NFT.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryNFTRequest(): QueryNFTRequest { + return { class_id: "", id: "" }; +} + +export const QueryNFTRequest = { + encode(message: QueryNFTRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryNFTRequest { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + }; + }, + + toJSON(message: QueryNFTRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): QueryNFTRequest { + const message = createBaseQueryNFTRequest(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryNFTResponse(): QueryNFTResponse { + return { nft: undefined }; +} + +export const QueryNFTResponse = { + encode(message: QueryNFTResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.nft !== undefined) { + NFT.encode(message.nft, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nft = NFT.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryNFTResponse { + return { nft: isSet(object.nft) ? NFT.fromJSON(object.nft) : undefined }; + }, + + toJSON(message: QueryNFTResponse): unknown { + const obj: any = {}; + message.nft !== undefined && (obj.nft = message.nft ? NFT.toJSON(message.nft) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryNFTResponse { + const message = createBaseQueryNFTResponse(); + message.nft = (object.nft !== undefined && object.nft !== null) ? NFT.fromPartial(object.nft) : undefined; + return message; + }, +}; + +function createBaseQueryClassRequest(): QueryClassRequest { + return { class_id: "" }; +} + +export const QueryClassRequest = { + encode(message: QueryClassRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryClassRequest { + return { class_id: isSet(object.class_id) ? String(object.class_id) : "" }; + }, + + toJSON(message: QueryClassRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryClassRequest { + const message = createBaseQueryClassRequest(); + message.class_id = object.class_id ?? ""; + return message; + }, +}; + +function createBaseQueryClassResponse(): QueryClassResponse { + return { class: undefined }; +} + +export const QueryClassResponse = { + encode(message: QueryClassResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class !== undefined) { + Class.encode(message.class, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class = Class.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryClassResponse { + return { class: isSet(object.class) ? Class.fromJSON(object.class) : undefined }; + }, + + toJSON(message: QueryClassResponse): unknown { + const obj: any = {}; + message.class !== undefined && (obj.class = message.class ? Class.toJSON(message.class) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryClassResponse { + const message = createBaseQueryClassResponse(); + message.class = (object.class !== undefined && object.class !== null) ? Class.fromPartial(object.class) : undefined; + return message; + }, +}; + +function createBaseQueryClassesRequest(): QueryClassesRequest { + return { pagination: undefined }; +} + +export const QueryClassesRequest = { + encode(message: QueryClassesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesRequest(); + 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; + }, + + fromJSON(object: any): QueryClassesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryClassesRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryClassesRequest { + const message = createBaseQueryClassesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryClassesResponse(): QueryClassesResponse { + return { classes: [], pagination: undefined }; +} + +export const QueryClassesResponse = { + encode(message: QueryClassesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.classes.push(Class.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryClassesResponse { + return { + classes: Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryClassesResponse): unknown { + const obj: any = {}; + if (message.classes) { + obj.classes = message.classes.map((e) => e ? Class.toJSON(e) : undefined); + } else { + obj.classes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryClassesResponse { + const message = createBaseQueryClassesResponse(); + message.classes = object.classes?.map((e) => Class.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 */ + Balance(request: QueryBalanceRequest): Promise; + /** Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 */ + Owner(request: QueryOwnerRequest): Promise; + /** Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. */ + Supply(request: QuerySupplyRequest): Promise; + /** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + */ + NFTs(request: QueryNFTsRequest): Promise; + /** NFT queries an NFT based on its class and id. */ + NFT(request: QueryNFTRequest): Promise; + /** Class queries an NFT class based on its id */ + Class(request: QueryClassRequest): Promise; + /** Classes queries all NFT classes */ + Classes(request: QueryClassesRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.nft.v1beta1.Query"; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.Owner = this.Owner.bind(this); + this.Supply = this.Supply.bind(this); + this.NFTs = this.NFTs.bind(this); + this.NFT = this.NFT.bind(this); + this.Class = this.Class.bind(this); + this.Classes = this.Classes.bind(this); + } + Balance(request: QueryBalanceRequest): Promise { + const data = QueryBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Balance", data); + return promise.then((data) => QueryBalanceResponse.decode(new _m0.Reader(data))); + } + + Owner(request: QueryOwnerRequest): Promise { + const data = QueryOwnerRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Owner", data); + return promise.then((data) => QueryOwnerResponse.decode(new _m0.Reader(data))); + } + + Supply(request: QuerySupplyRequest): Promise { + const data = QuerySupplyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Supply", data); + return promise.then((data) => QuerySupplyResponse.decode(new _m0.Reader(data))); + } + + NFTs(request: QueryNFTsRequest): Promise { + const data = QueryNFTsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "NFTs", data); + return promise.then((data) => QueryNFTsResponse.decode(new _m0.Reader(data))); + } + + NFT(request: QueryNFTRequest): Promise { + const data = QueryNFTRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "NFT", data); + return promise.then((data) => QueryNFTResponse.decode(new _m0.Reader(data))); + } + + Class(request: QueryClassRequest): Promise { + const data = QueryClassRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Class", data); + return promise.then((data) => QueryClassResponse.decode(new _m0.Reader(data))); + } + + Classes(request: QueryClassesRequest): Promise { + const data = QueryClassesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Classes", data); + return promise.then((data) => QueryClassesResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/nft/v1beta1/tx.ts b/common/types/src/client/cosmos/nft/v1beta1/tx.ts new file mode 100644 index 00000000..e0a8855a --- /dev/null +++ b/common/types/src/client/cosmos/nft/v1beta1/tx.ts @@ -0,0 +1,175 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** MsgSend represents a message to send a nft from one account to another account. */ +export interface MsgSend { + /** class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 */ + class_id: string; + /** id defines the unique identification of nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; +} + +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponse { +} + +function createBaseMsgSend(): MsgSend { + return { class_id: "", id: "", sender: "", receiver: "" }; +} + +export const MsgSend = { + encode(message: MsgSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(34).string(message.receiver); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.sender = reader.string(); + break; + case 4: + message.receiver = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + sender: isSet(object.sender) ? String(object.sender) : "", + receiver: isSet(object.receiver) ? String(object.receiver) : "", + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + message.sender !== undefined && (obj.sender = message.sender); + message.receiver !== undefined && (obj.receiver = message.receiver); + return obj; + }, + + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse = { + encode(_: MsgSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +/** Msg defines the nft Msg service. */ +export interface Msg { + /** Send defines a method to send a nft from one account to another account. */ + Send(request: MsgSend): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.nft.v1beta1.Msg"; + this.rpc = rpc; + this.Send = this.Send.bind(this); + } + Send(request: MsgSend): Promise { + const data = MsgSend.encode(request).finish(); + const promise = this.rpc.request(this.service, "Send", data); + return promise.then((data) => MsgSendResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/orm/v1/orm.ts b/common/types/src/client/cosmos/orm/v1/orm.ts new file mode 100644 index 00000000..512affa0 --- /dev/null +++ b/common/types/src/client/cosmos/orm/v1/orm.ts @@ -0,0 +1,356 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.orm.v1"; + +/** TableDescriptor describes an ORM table. */ +export interface TableDescriptor { + /** primary_key defines the primary key for the table. */ + primary_key?: PrimaryKeyDescriptor; + /** index defines one or more secondary indexes. */ + index: SecondaryIndexDescriptor[]; + /** + * id is a non-zero integer ID that must be unique within the + * tables and singletons in this file. It may be deprecated in the future when this + * can be auto-generated. + */ + id: number; +} + +/** PrimaryKeyDescriptor describes a table primary key. */ +export interface PrimaryKeyDescriptor { + /** + * fields is a comma-separated list of fields in the primary key. Spaces are + * not allowed. Supported field types, their encodings, and any applicable constraints + * are described below. + * - uint32 are encoded as 2,3,4 or 5 bytes using a compact encoding that + * is suitable for sorted iteration (not varint encoding). This type is + * well-suited for small integers. + * - uint64 are encoded as 2,4,6 or 9 bytes using a compact encoding that + * is suitable for sorted iteration (not varint encoding). This type is + * well-suited for small integers such as auto-incrementing sequences. + * - fixed32, fixed64 are encoded as big-endian fixed width bytes and support + * sorted iteration. These types are well-suited for encoding fixed with + * decimals as integers. + * - string's are encoded as raw bytes in terminal key segments and null-terminated + * in non-terminal segments. Null characters are thus forbidden in strings. + * string fields support sorted iteration. + * - bytes are encoded as raw bytes in terminal segments and length-prefixed + * with a 32-bit unsigned varint in non-terminal segments. + * - int32, sint32, int64, sint64, sfixed32, sfixed64 are encoded as fixed width bytes with + * an encoding that enables sorted iteration. + * - google.protobuf.Timestamp and google.protobuf.Duration are encoded + * as 12 bytes using an encoding that enables sorted iteration. + * - enum fields are encoded using varint encoding and do not support sorted + * iteration. + * - bool fields are encoded as a single byte 0 or 1. + * + * All other fields types are unsupported in keys including repeated and + * oneof fields. + * + * Primary keys are prefixed by the varint encoded table id and the byte 0x0 + * plus any additional prefix specified by the schema. + */ + fields: string; + /** + * auto_increment specifies that the primary key is generated by an + * auto-incrementing integer. If this is set to true fields must only + * contain one field of that is of type uint64. + */ + auto_increment: boolean; +} + +/** PrimaryKeyDescriptor describes a table secondary index. */ +export interface SecondaryIndexDescriptor { + /** + * fields is a comma-separated list of fields in the index. The supported + * field types are the same as those for PrimaryKeyDescriptor.fields. + * Index keys are prefixed by the varint encoded table id and the varint + * encoded index id plus any additional prefix specified by the schema. + * + * In addition the the field segments, non-unique index keys are suffixed with + * any additional primary key fields not present in the index fields so that the + * primary key can be reconstructed. Unique indexes instead of being suffixed + * store the remaining primary key fields in the value.. + */ + fields: string; + /** + * id is a non-zero integer ID that must be unique within the indexes for this + * table and less than 32768. It may be deprecated in the future when this can + * be auto-generated. + */ + id: number; + /** unique specifies that this an unique index. */ + unique: boolean; +} + +/** TableDescriptor describes an ORM singleton table which has at most one instance. */ +export interface SingletonDescriptor { + /** + * id is a non-zero integer ID that must be unique within the + * tables and singletons in this file. It may be deprecated in the future when this + * can be auto-generated. + */ + id: number; +} + +function createBaseTableDescriptor(): TableDescriptor { + return { primary_key: undefined, index: [], id: 0 }; +} + +export const TableDescriptor = { + encode(message: TableDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.primary_key !== undefined) { + PrimaryKeyDescriptor.encode(message.primary_key, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.index) { + SecondaryIndexDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.id !== 0) { + writer.uint32(24).uint32(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TableDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTableDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.primary_key = PrimaryKeyDescriptor.decode(reader, reader.uint32()); + break; + case 2: + message.index.push(SecondaryIndexDescriptor.decode(reader, reader.uint32())); + break; + case 3: + message.id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TableDescriptor { + return { + primary_key: isSet(object.primary_key) ? PrimaryKeyDescriptor.fromJSON(object.primary_key) : undefined, + index: Array.isArray(object?.index) ? object.index.map((e: any) => SecondaryIndexDescriptor.fromJSON(e)) : [], + id: isSet(object.id) ? Number(object.id) : 0, + }; + }, + + toJSON(message: TableDescriptor): unknown { + const obj: any = {}; + message.primary_key !== undefined && + (obj.primary_key = message.primary_key ? PrimaryKeyDescriptor.toJSON(message.primary_key) : undefined); + if (message.index) { + obj.index = message.index.map((e) => e ? SecondaryIndexDescriptor.toJSON(e) : undefined); + } else { + obj.index = []; + } + message.id !== undefined && (obj.id = Math.round(message.id)); + return obj; + }, + + fromPartial, I>>(object: I): TableDescriptor { + const message = createBaseTableDescriptor(); + message.primary_key = (object.primary_key !== undefined && object.primary_key !== null) + ? PrimaryKeyDescriptor.fromPartial(object.primary_key) + : undefined; + message.index = object.index?.map((e) => SecondaryIndexDescriptor.fromPartial(e)) || []; + message.id = object.id ?? 0; + return message; + }, +}; + +function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { + return { fields: "", auto_increment: false }; +} + +export const PrimaryKeyDescriptor = { + encode(message: PrimaryKeyDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.auto_increment === true) { + writer.uint32(16).bool(message.auto_increment); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PrimaryKeyDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrimaryKeyDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fields = reader.string(); + break; + case 2: + message.auto_increment = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PrimaryKeyDescriptor { + return { + fields: isSet(object.fields) ? String(object.fields) : "", + auto_increment: isSet(object.auto_increment) ? Boolean(object.auto_increment) : false, + }; + }, + + toJSON(message: PrimaryKeyDescriptor): unknown { + const obj: any = {}; + message.fields !== undefined && (obj.fields = message.fields); + message.auto_increment !== undefined && (obj.auto_increment = message.auto_increment); + return obj; + }, + + fromPartial, I>>(object: I): PrimaryKeyDescriptor { + const message = createBasePrimaryKeyDescriptor(); + message.fields = object.fields ?? ""; + message.auto_increment = object.auto_increment ?? false; + return message; + }, +}; + +function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { + return { fields: "", id: 0, unique: false }; +} + +export const SecondaryIndexDescriptor = { + encode(message: SecondaryIndexDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.id !== 0) { + writer.uint32(16).uint32(message.id); + } + if (message.unique === true) { + writer.uint32(24).bool(message.unique); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SecondaryIndexDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecondaryIndexDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fields = reader.string(); + break; + case 2: + message.id = reader.uint32(); + break; + case 3: + message.unique = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SecondaryIndexDescriptor { + return { + fields: isSet(object.fields) ? String(object.fields) : "", + id: isSet(object.id) ? Number(object.id) : 0, + unique: isSet(object.unique) ? Boolean(object.unique) : false, + }; + }, + + toJSON(message: SecondaryIndexDescriptor): unknown { + const obj: any = {}; + message.fields !== undefined && (obj.fields = message.fields); + message.id !== undefined && (obj.id = Math.round(message.id)); + message.unique !== undefined && (obj.unique = message.unique); + return obj; + }, + + fromPartial, I>>(object: I): SecondaryIndexDescriptor { + const message = createBaseSecondaryIndexDescriptor(); + message.fields = object.fields ?? ""; + message.id = object.id ?? 0; + message.unique = object.unique ?? false; + return message; + }, +}; + +function createBaseSingletonDescriptor(): SingletonDescriptor { + return { id: 0 }; +} + +export const SingletonDescriptor = { + encode(message: SingletonDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SingletonDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSingletonDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SingletonDescriptor { + return { id: isSet(object.id) ? Number(object.id) : 0 }; + }, + + toJSON(message: SingletonDescriptor): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + return obj; + }, + + fromPartial, I>>(object: I): SingletonDescriptor { + const message = createBaseSingletonDescriptor(); + message.id = object.id ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/orm/v1alpha1/schema.ts b/common/types/src/client/cosmos/orm/v1alpha1/schema.ts new file mode 100644 index 00000000..87c69780 --- /dev/null +++ b/common/types/src/client/cosmos/orm/v1alpha1/schema.ts @@ -0,0 +1,314 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.orm.v1alpha1"; + +/** StorageType */ +export enum StorageType { + /** + * STORAGE_TYPE_DEFAULT_UNSPECIFIED - STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent + * KV-storage where primary key entries are stored in merkle-tree + * backed commitment storage and indexes and seqs are stored in + * fast index storage. Note that the Cosmos SDK before store/v2alpha1 + * does not support this. + */ + STORAGE_TYPE_DEFAULT_UNSPECIFIED = 0, + /** + * STORAGE_TYPE_MEMORY - STORAGE_TYPE_MEMORY indicates in-memory storage that will be + * reloaded every time an app restarts. Tables with this type of storage + * will by default be ignored when importing and exporting a module's + * state from JSON. + */ + STORAGE_TYPE_MEMORY = 1, + /** + * STORAGE_TYPE_TRANSIENT - STORAGE_TYPE_TRANSIENT indicates transient storage that is reset + * at the end of every block. Tables with this type of storage + * will by default be ignored when importing and exporting a module's + * state from JSON. + */ + STORAGE_TYPE_TRANSIENT = 2, + /** + * STORAGE_TYPE_INDEX - STORAGE_TYPE_INDEX indicates persistent storage which is not backed + * by a merkle-tree and won't affect the app hash. Note that the Cosmos SDK + * before store/v2alpha1 does not support this. + */ + STORAGE_TYPE_INDEX = 3, + /** + * STORAGE_TYPE_COMMITMENT - STORAGE_TYPE_INDEX indicates persistent storage which is backed by + * a merkle-tree. With this type of storage, both primary and index keys + * will affect the app hash and this is generally less efficient + * than using STORAGE_TYPE_DEFAULT_UNSPECIFIED which separates index + * keys into index storage. Note that modules built with the + * Cosmos SDK before store/v2alpha1 must specify STORAGE_TYPE_COMMITMENT + * instead of STORAGE_TYPE_DEFAULT_UNSPECIFIED or STORAGE_TYPE_INDEX + * because this is the only type of persistent storage available. + */ + STORAGE_TYPE_COMMITMENT = 4, + UNRECOGNIZED = -1, +} + +export function storageTypeFromJSON(object: any): StorageType { + switch (object) { + case 0: + case "STORAGE_TYPE_DEFAULT_UNSPECIFIED": + return StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED; + case 1: + case "STORAGE_TYPE_MEMORY": + return StorageType.STORAGE_TYPE_MEMORY; + case 2: + case "STORAGE_TYPE_TRANSIENT": + return StorageType.STORAGE_TYPE_TRANSIENT; + case 3: + case "STORAGE_TYPE_INDEX": + return StorageType.STORAGE_TYPE_INDEX; + case 4: + case "STORAGE_TYPE_COMMITMENT": + return StorageType.STORAGE_TYPE_COMMITMENT; + case -1: + case "UNRECOGNIZED": + default: + return StorageType.UNRECOGNIZED; + } +} + +export function storageTypeToJSON(object: StorageType): string { + switch (object) { + case StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED: + return "STORAGE_TYPE_DEFAULT_UNSPECIFIED"; + case StorageType.STORAGE_TYPE_MEMORY: + return "STORAGE_TYPE_MEMORY"; + case StorageType.STORAGE_TYPE_TRANSIENT: + return "STORAGE_TYPE_TRANSIENT"; + case StorageType.STORAGE_TYPE_INDEX: + return "STORAGE_TYPE_INDEX"; + case StorageType.STORAGE_TYPE_COMMITMENT: + return "STORAGE_TYPE_COMMITMENT"; + case StorageType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptor { + schema_file: ModuleSchemaDescriptor_FileEntry[]; + /** + * prefix is an optional prefix that precedes all keys in this module's + * store. + */ + prefix: Uint8Array; +} + +/** FileEntry describes an ORM file used in a module. */ +export interface ModuleSchemaDescriptor_FileEntry { + /** + * id is a prefix that will be varint encoded and prepended to all the + * table keys specified in the file's tables. + */ + id: number; + /** + * proto_file_name is the name of a file .proto in that contains + * table definitions. The .proto file must be in a package that the + * module has referenced using cosmos.app.v1.ModuleDescriptor.use_package. + */ + proto_file_name: string; + /** + * storage_type optionally indicates the type of storage this file's + * tables should used. If it is left unspecified, the default KV-storage + * of the app will be used. + */ + storage_type: StorageType; +} + +function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { + return { schema_file: [], prefix: new Uint8Array() }; +} + +export const ModuleSchemaDescriptor = { + encode(message: ModuleSchemaDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.schema_file) { + ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleSchemaDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleSchemaDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.schema_file.push(ModuleSchemaDescriptor_FileEntry.decode(reader, reader.uint32())); + break; + case 2: + message.prefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor { + return { + schema_file: Array.isArray(object?.schema_file) + ? object.schema_file.map((e: any) => ModuleSchemaDescriptor_FileEntry.fromJSON(e)) + : [], + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(), + }; + }, + + toJSON(message: ModuleSchemaDescriptor): unknown { + const obj: any = {}; + if (message.schema_file) { + obj.schema_file = message.schema_file.map((e) => e ? ModuleSchemaDescriptor_FileEntry.toJSON(e) : undefined); + } else { + obj.schema_file = []; + } + message.prefix !== undefined && + (obj.prefix = base64FromBytes(message.prefix !== undefined ? message.prefix : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): ModuleSchemaDescriptor { + const message = createBaseModuleSchemaDescriptor(); + message.schema_file = object.schema_file?.map((e) => ModuleSchemaDescriptor_FileEntry.fromPartial(e)) || []; + message.prefix = object.prefix ?? new Uint8Array(); + return message; + }, +}; + +function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { + return { id: 0, proto_file_name: "", storage_type: 0 }; +} + +export const ModuleSchemaDescriptor_FileEntry = { + encode(message: ModuleSchemaDescriptor_FileEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.proto_file_name !== "") { + writer.uint32(18).string(message.proto_file_name); + } + if (message.storage_type !== 0) { + writer.uint32(24).int32(message.storage_type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleSchemaDescriptor_FileEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleSchemaDescriptor_FileEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + case 2: + message.proto_file_name = reader.string(); + break; + case 3: + message.storage_type = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor_FileEntry { + return { + id: isSet(object.id) ? Number(object.id) : 0, + proto_file_name: isSet(object.proto_file_name) ? String(object.proto_file_name) : "", + storage_type: isSet(object.storage_type) ? storageTypeFromJSON(object.storage_type) : 0, + }; + }, + + toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + message.proto_file_name !== undefined && (obj.proto_file_name = message.proto_file_name); + message.storage_type !== undefined && (obj.storage_type = storageTypeToJSON(message.storage_type)); + return obj; + }, + + fromPartial, I>>( + object: I, + ): ModuleSchemaDescriptor_FileEntry { + const message = createBaseModuleSchemaDescriptor_FileEntry(); + message.id = object.id ?? 0; + message.proto_file_name = object.proto_file_name ?? ""; + message.storage_type = object.storage_type ?? 0; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/params/v1beta1/params.ts b/common/types/src/client/cosmos/params/v1beta1/params.ts new file mode 100644 index 00000000..ebcaa371 --- /dev/null +++ b/common/types/src/client/cosmos/params/v1beta1/params.ts @@ -0,0 +1,174 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.params.v1beta1"; + +/** ParameterChangeProposal defines a proposal to change one or more parameters. */ +export interface ParameterChangeProposal { + title: string; + description: string; + changes: ParamChange[]; +} + +/** + * ParamChange defines an individual parameter change, for use in + * ParameterChangeProposal. + */ +export interface ParamChange { + subspace: string; + key: string; + value: string; +} + +function createBaseParameterChangeProposal(): ParameterChangeProposal { + return { title: "", description: "", changes: [] }; +} + +export const ParameterChangeProposal = { + encode(message: ParameterChangeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + for (const v of message.changes) { + ParamChange.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ParameterChangeProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParameterChangeProposal(); + 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.changes.push(ParamChange.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ParameterChangeProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + changes: Array.isArray(object?.changes) ? object.changes.map((e: any) => ParamChange.fromJSON(e)) : [], + }; + }, + + toJSON(message: ParameterChangeProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + if (message.changes) { + obj.changes = message.changes.map((e) => e ? ParamChange.toJSON(e) : undefined); + } else { + obj.changes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ParameterChangeProposal { + const message = createBaseParameterChangeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.changes = object.changes?.map((e) => ParamChange.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseParamChange(): ParamChange { + return { subspace: "", key: "", value: "" }; +} + +export const ParamChange = { + encode(message: ParamChange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.value !== "") { + writer.uint32(26).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ParamChange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParamChange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subspace = reader.string(); + break; + case 2: + message.key = reader.string(); + break; + case 3: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ParamChange { + return { + subspace: isSet(object.subspace) ? String(object.subspace) : "", + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "", + }; + }, + + toJSON(message: ParamChange): unknown { + const obj: any = {}; + message.subspace !== undefined && (obj.subspace = message.subspace); + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + fromPartial, I>>(object: I): ParamChange { + const message = createBaseParamChange(); + message.subspace = object.subspace ?? ""; + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/params/v1beta1/query.ts b/common/types/src/client/cosmos/params/v1beta1/query.ts new file mode 100644 index 00000000..f70bdfcc --- /dev/null +++ b/common/types/src/client/cosmos/params/v1beta1/query.ts @@ -0,0 +1,356 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { ParamChange } from "./params"; + +export const protobufPackage = "cosmos.params.v1beta1"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** subspace defines the module to query the parameter for. */ + subspace: string; + /** key defines the key of the parameter in the subspace. */ + key: string; +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** param defines the queried parameter. */ + param?: ParamChange; +} + +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + */ +export interface QuerySubspacesRequest { +} + +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + */ +export interface QuerySubspacesResponse { + subspaces: Subspace[]; +} + +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + */ +export interface Subspace { + subspace: string; + keys: string[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { subspace: "", key: "" }; +} + +export const QueryParamsRequest = { + encode(message: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.subspace = reader.string(); + break; + case 2: + message.key = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { + subspace: isSet(object.subspace) ? String(object.subspace) : "", + key: isSet(object.key) ? String(object.key) : "", + }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + message.subspace !== undefined && (obj.subspace = message.subspace); + message.key !== undefined && (obj.key = message.key); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.subspace = object.subspace ?? ""; + message.key = object.key ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { param: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.param !== undefined) { + ParamChange.encode(message.param, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.param = ParamChange.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.param !== undefined && (obj.param = message.param ? ParamChange.toJSON(message.param) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.param = (object.param !== undefined && object.param !== null) + ? ParamChange.fromPartial(object.param) + : undefined; + return message; + }, +}; + +function createBaseQuerySubspacesRequest(): QuerySubspacesRequest { + return {}; +} + +export const QuerySubspacesRequest = { + encode(_: QuerySubspacesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySubspacesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QuerySubspacesRequest { + return {}; + }, + + toJSON(_: QuerySubspacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QuerySubspacesRequest { + const message = createBaseQuerySubspacesRequest(); + return message; + }, +}; + +function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { + return { subspaces: [] }; +} + +export const QuerySubspacesResponse = { + encode(message: QuerySubspacesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.subspaces) { + Subspace.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySubspacesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subspaces.push(Subspace.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySubspacesResponse { + return { + subspaces: Array.isArray(object?.subspaces) ? object.subspaces.map((e: any) => Subspace.fromJSON(e)) : [], + }; + }, + + toJSON(message: QuerySubspacesResponse): unknown { + const obj: any = {}; + if (message.subspaces) { + obj.subspaces = message.subspaces.map((e) => e ? Subspace.toJSON(e) : undefined); + } else { + obj.subspaces = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QuerySubspacesResponse { + const message = createBaseQuerySubspacesResponse(); + message.subspaces = object.subspaces?.map((e) => Subspace.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSubspace(): Subspace { + return { subspace: "", keys: [] }; +} + +export const Subspace = { + encode(message: Subspace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + for (const v of message.keys) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Subspace { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubspace(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subspace = reader.string(); + break; + case 2: + message.keys.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Subspace { + return { + subspace: isSet(object.subspace) ? String(object.subspace) : "", + keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: Subspace): unknown { + const obj: any = {}; + message.subspace !== undefined && (obj.subspace = message.subspace); + if (message.keys) { + obj.keys = message.keys.map((e) => e); + } else { + obj.keys = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Subspace { + const message = createBaseSubspace(); + message.subspace = object.subspace ?? ""; + message.keys = object.keys?.map((e) => e) || []; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Params queries a specific parameter of a module, given its subspace and + * key. + */ + Params(request: QueryParamsRequest): Promise; + /** Subspaces queries for all registered subspaces and all keys for a subspace. */ + Subspaces(request: QuerySubspacesRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.params.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Subspaces = this.Subspaces.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + Subspaces(request: QuerySubspacesRequest): Promise { + const data = QuerySubspacesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Subspaces", data); + return promise.then((data) => QuerySubspacesResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/slashing/v1beta1/genesis.ts b/common/types/src/client/cosmos/slashing/v1beta1/genesis.ts new file mode 100644 index 00000000..01f795e0 --- /dev/null +++ b/common/types/src/client/cosmos/slashing/v1beta1/genesis.ts @@ -0,0 +1,341 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Params, ValidatorSigningInfo } from "./slashing"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** GenesisState defines the slashing module's genesis state. */ +export interface GenesisState { + /** params defines all the paramaters of related to deposit. */ + params?: Params; + /** + * signing_infos represents a map between validator addresses and their + * signing infos. + */ + signing_infos: SigningInfo[]; + /** + * missed_blocks represents a map between validator addresses and their + * missed blocks. + */ + missed_blocks: ValidatorMissedBlocks[]; +} + +/** SigningInfo stores validator signing info of corresponding address. */ +export interface SigningInfo { + /** address is the validator address. */ + address: string; + /** validator_signing_info represents the signing info of this validator. */ + validator_signing_info?: ValidatorSigningInfo; +} + +/** + * ValidatorMissedBlocks contains array of missed blocks of corresponding + * address. + */ +export interface ValidatorMissedBlocks { + /** address is the validator address. */ + address: string; + /** missed_blocks is an array of missed blocks by the validator. */ + missed_blocks: MissedBlock[]; +} + +/** MissedBlock contains height and missed status as boolean. */ +export interface MissedBlock { + /** index is the height at which the block was missed. */ + index: string; + /** missed is the missed status. */ + missed: boolean; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, signing_infos: [], missed_blocks: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.signing_infos) { + SigningInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.missed_blocks) { + ValidatorMissedBlocks.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.signing_infos.push(SigningInfo.decode(reader, reader.uint32())); + break; + case 3: + message.missed_blocks.push(ValidatorMissedBlocks.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + signing_infos: Array.isArray(object?.signing_infos) + ? object.signing_infos.map((e: any) => SigningInfo.fromJSON(e)) + : [], + missed_blocks: Array.isArray(object?.missed_blocks) + ? object.missed_blocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.signing_infos) { + obj.signing_infos = message.signing_infos.map((e) => e ? SigningInfo.toJSON(e) : undefined); + } else { + obj.signing_infos = []; + } + if (message.missed_blocks) { + obj.missed_blocks = message.missed_blocks.map((e) => e ? ValidatorMissedBlocks.toJSON(e) : undefined); + } else { + obj.missed_blocks = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.signing_infos = object.signing_infos?.map((e) => SigningInfo.fromPartial(e)) || []; + message.missed_blocks = object.missed_blocks?.map((e) => ValidatorMissedBlocks.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningInfo(): SigningInfo { + return { address: "", validator_signing_info: undefined }; +} + +export const SigningInfo = { + encode(message: SigningInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.validator_signing_info !== undefined) { + ValidatorSigningInfo.encode(message.validator_signing_info, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SigningInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSigningInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.validator_signing_info = ValidatorSigningInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SigningInfo { + return { + address: isSet(object.address) ? String(object.address) : "", + validator_signing_info: isSet(object.validator_signing_info) + ? ValidatorSigningInfo.fromJSON(object.validator_signing_info) + : undefined, + }; + }, + + toJSON(message: SigningInfo): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.validator_signing_info !== undefined && (obj.validator_signing_info = message.validator_signing_info + ? ValidatorSigningInfo.toJSON(message.validator_signing_info) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): SigningInfo { + const message = createBaseSigningInfo(); + message.address = object.address ?? ""; + message.validator_signing_info = + (object.validator_signing_info !== undefined && object.validator_signing_info !== null) + ? ValidatorSigningInfo.fromPartial(object.validator_signing_info) + : undefined; + return message; + }, +}; + +function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { + return { address: "", missed_blocks: [] }; +} + +export const ValidatorMissedBlocks = { + encode(message: ValidatorMissedBlocks, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.missed_blocks) { + MissedBlock.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorMissedBlocks { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorMissedBlocks(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.missed_blocks.push(MissedBlock.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorMissedBlocks { + return { + address: isSet(object.address) ? String(object.address) : "", + missed_blocks: Array.isArray(object?.missed_blocks) + ? object.missed_blocks.map((e: any) => MissedBlock.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorMissedBlocks): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.missed_blocks) { + obj.missed_blocks = message.missed_blocks.map((e) => e ? MissedBlock.toJSON(e) : undefined); + } else { + obj.missed_blocks = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ValidatorMissedBlocks { + const message = createBaseValidatorMissedBlocks(); + message.address = object.address ?? ""; + message.missed_blocks = object.missed_blocks?.map((e) => MissedBlock.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMissedBlock(): MissedBlock { + return { index: "0", missed: false }; +} + +export const MissedBlock = { + encode(message: MissedBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).int64(message.index); + } + if (message.missed === true) { + writer.uint32(16).bool(message.missed); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MissedBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMissedBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.int64() as Long); + break; + case 2: + message.missed = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MissedBlock { + return { + index: isSet(object.index) ? String(object.index) : "0", + missed: isSet(object.missed) ? Boolean(object.missed) : false, + }; + }, + + toJSON(message: MissedBlock): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.missed !== undefined && (obj.missed = message.missed); + return obj; + }, + + fromPartial, I>>(object: I): MissedBlock { + const message = createBaseMissedBlock(); + message.index = object.index ?? "0"; + message.missed = object.missed ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/slashing/v1beta1/query.ts b/common/types/src/client/cosmos/slashing/v1beta1/query.ts new file mode 100644 index 00000000..5150df45 --- /dev/null +++ b/common/types/src/client/cosmos/slashing/v1beta1/query.ts @@ -0,0 +1,414 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Params, ValidatorSigningInfo } from "./slashing"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** QueryParamsRequest is the request type for the Query/Params RPC method */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method */ +export interface QueryParamsResponse { + params?: Params; +} + +/** + * QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoRequest { + /** cons_address is the address to query signing info of */ + cons_address: string; +} + +/** + * QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoResponse { + /** val_signing_info is the signing info of requested val cons address */ + val_signing_info?: ValidatorSigningInfo; +} + +/** + * QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosRequest { + pagination?: PageRequest; +} + +/** + * QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosResponse { + /** info is the signing info of all validators */ + info: ValidatorSigningInfo[]; + pagination?: PageResponse; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { + return { cons_address: "" }; +} + +export const QuerySigningInfoRequest = { + encode(message: QuerySigningInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.cons_address !== "") { + writer.uint32(10).string(message.cons_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.cons_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoRequest { + return { cons_address: isSet(object.cons_address) ? String(object.cons_address) : "" }; + }, + + toJSON(message: QuerySigningInfoRequest): unknown { + const obj: any = {}; + message.cons_address !== undefined && (obj.cons_address = message.cons_address); + return obj; + }, + + fromPartial, I>>(object: I): QuerySigningInfoRequest { + const message = createBaseQuerySigningInfoRequest(); + message.cons_address = object.cons_address ?? ""; + return message; + }, +}; + +function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { + return { val_signing_info: undefined }; +} + +export const QuerySigningInfoResponse = { + encode(message: QuerySigningInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.val_signing_info !== undefined) { + ValidatorSigningInfo.encode(message.val_signing_info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.val_signing_info = ValidatorSigningInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoResponse { + return { + val_signing_info: isSet(object.val_signing_info) + ? ValidatorSigningInfo.fromJSON(object.val_signing_info) + : undefined, + }; + }, + + toJSON(message: QuerySigningInfoResponse): unknown { + const obj: any = {}; + message.val_signing_info !== undefined && (obj.val_signing_info = message.val_signing_info + ? ValidatorSigningInfo.toJSON(message.val_signing_info) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QuerySigningInfoResponse { + const message = createBaseQuerySigningInfoResponse(); + message.val_signing_info = (object.val_signing_info !== undefined && object.val_signing_info !== null) + ? ValidatorSigningInfo.fromPartial(object.val_signing_info) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { + return { pagination: undefined }; +} + +export const QuerySigningInfosRequest = { + encode(message: QuerySigningInfosRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfosRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfosRequest(); + 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; + }, + + fromJSON(object: any): QuerySigningInfosRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QuerySigningInfosRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QuerySigningInfosRequest { + const message = createBaseQuerySigningInfosRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfosResponse(): QuerySigningInfosResponse { + return { info: [], pagination: undefined }; +} + +export const QuerySigningInfosResponse = { + encode(message: QuerySigningInfosResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.info) { + ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfosResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfosResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info.push(ValidatorSigningInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosResponse { + return { + info: Array.isArray(object?.info) ? object.info.map((e: any) => ValidatorSigningInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySigningInfosResponse): unknown { + const obj: any = {}; + if (message.info) { + obj.info = message.info.map((e) => e ? ValidatorSigningInfo.toJSON(e) : undefined); + } else { + obj.info = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QuerySigningInfosResponse { + const message = createBaseQuerySigningInfosResponse(); + message.info = object.info?.map((e) => ValidatorSigningInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query provides defines the gRPC querier service */ +export interface Query { + /** Params queries the parameters of slashing module */ + Params(request: QueryParamsRequest): Promise; + /** SigningInfo queries the signing info of given cons address */ + SigningInfo(request: QuerySigningInfoRequest): Promise; + /** SigningInfos queries signing info of all validators */ + SigningInfos(request: QuerySigningInfosRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.slashing.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.SigningInfo = this.SigningInfo.bind(this); + this.SigningInfos = this.SigningInfos.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + SigningInfo(request: QuerySigningInfoRequest): Promise { + const data = QuerySigningInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SigningInfo", data); + return promise.then((data) => QuerySigningInfoResponse.decode(new _m0.Reader(data))); + } + + SigningInfos(request: QuerySigningInfosRequest): Promise { + const data = QuerySigningInfosRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SigningInfos", data); + return promise.then((data) => QuerySigningInfosResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/slashing/v1beta1/slashing.ts b/common/types/src/client/cosmos/slashing/v1beta1/slashing.ts new file mode 100644 index 00000000..6f15c86e --- /dev/null +++ b/common/types/src/client/cosmos/slashing/v1beta1/slashing.ts @@ -0,0 +1,348 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** + * ValidatorSigningInfo defines a validator's signing info for monitoring their + * liveness activity. + */ +export interface ValidatorSigningInfo { + address: string; + /** Height at which validator was first a candidate OR was unjailed */ + start_height: string; + /** + * Index which is incremented each time the validator was a bonded + * in a block and may have signed a precommit or not. This in conjunction with the + * `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`. + */ + index_offset: string; + /** Timestamp until which the validator is jailed due to liveness downtime. */ + jailed_until?: Date; + /** + * Whether or not a validator has been tombstoned (killed out of validator set). It is set + * once the validator commits an equivocation or for any other configured misbehiavor. + */ + tombstoned: boolean; + /** + * A counter kept to avoid unnecessary array reads. + * Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. + */ + missed_blocks_counter: string; +} + +/** Params represents the parameters used for by the slashing module. */ +export interface Params { + signed_blocks_window: string; + min_signed_per_window: Uint8Array; + downtime_jail_duration?: Duration; + slash_fraction_double_sign: Uint8Array; + slash_fraction_downtime: Uint8Array; +} + +function createBaseValidatorSigningInfo(): ValidatorSigningInfo { + return { + address: "", + start_height: "0", + index_offset: "0", + jailed_until: undefined, + tombstoned: false, + missed_blocks_counter: "0", + }; +} + +export const ValidatorSigningInfo = { + encode(message: ValidatorSigningInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.start_height !== "0") { + writer.uint32(16).int64(message.start_height); + } + if (message.index_offset !== "0") { + writer.uint32(24).int64(message.index_offset); + } + if (message.jailed_until !== undefined) { + Timestamp.encode(toTimestamp(message.jailed_until), writer.uint32(34).fork()).ldelim(); + } + if (message.tombstoned === true) { + writer.uint32(40).bool(message.tombstoned); + } + if (message.missed_blocks_counter !== "0") { + writer.uint32(48).int64(message.missed_blocks_counter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSigningInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSigningInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.start_height = longToString(reader.int64() as Long); + break; + case 3: + message.index_offset = longToString(reader.int64() as Long); + break; + case 4: + message.jailed_until = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.tombstoned = reader.bool(); + break; + case 6: + message.missed_blocks_counter = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorSigningInfo { + return { + address: isSet(object.address) ? String(object.address) : "", + start_height: isSet(object.start_height) ? String(object.start_height) : "0", + index_offset: isSet(object.index_offset) ? String(object.index_offset) : "0", + jailed_until: isSet(object.jailed_until) ? fromJsonTimestamp(object.jailed_until) : undefined, + tombstoned: isSet(object.tombstoned) ? Boolean(object.tombstoned) : false, + missed_blocks_counter: isSet(object.missed_blocks_counter) ? String(object.missed_blocks_counter) : "0", + }; + }, + + toJSON(message: ValidatorSigningInfo): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.start_height !== undefined && (obj.start_height = message.start_height); + message.index_offset !== undefined && (obj.index_offset = message.index_offset); + message.jailed_until !== undefined && (obj.jailed_until = message.jailed_until.toISOString()); + message.tombstoned !== undefined && (obj.tombstoned = message.tombstoned); + message.missed_blocks_counter !== undefined && (obj.missed_blocks_counter = message.missed_blocks_counter); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorSigningInfo { + const message = createBaseValidatorSigningInfo(); + message.address = object.address ?? ""; + message.start_height = object.start_height ?? "0"; + message.index_offset = object.index_offset ?? "0"; + message.jailed_until = object.jailed_until ?? undefined; + message.tombstoned = object.tombstoned ?? false; + message.missed_blocks_counter = object.missed_blocks_counter ?? "0"; + return message; + }, +}; + +function createBaseParams(): Params { + return { + signed_blocks_window: "0", + min_signed_per_window: new Uint8Array(), + downtime_jail_duration: undefined, + slash_fraction_double_sign: new Uint8Array(), + slash_fraction_downtime: new Uint8Array(), + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.signed_blocks_window !== "0") { + writer.uint32(8).int64(message.signed_blocks_window); + } + if (message.min_signed_per_window.length !== 0) { + writer.uint32(18).bytes(message.min_signed_per_window); + } + if (message.downtime_jail_duration !== undefined) { + Duration.encode(message.downtime_jail_duration, writer.uint32(26).fork()).ldelim(); + } + if (message.slash_fraction_double_sign.length !== 0) { + writer.uint32(34).bytes(message.slash_fraction_double_sign); + } + if (message.slash_fraction_downtime.length !== 0) { + writer.uint32(42).bytes(message.slash_fraction_downtime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.signed_blocks_window = longToString(reader.int64() as Long); + break; + case 2: + message.min_signed_per_window = reader.bytes(); + break; + case 3: + message.downtime_jail_duration = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.slash_fraction_double_sign = reader.bytes(); + break; + case 5: + message.slash_fraction_downtime = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + signed_blocks_window: isSet(object.signed_blocks_window) ? String(object.signed_blocks_window) : "0", + min_signed_per_window: isSet(object.min_signed_per_window) + ? bytesFromBase64(object.min_signed_per_window) + : new Uint8Array(), + downtime_jail_duration: isSet(object.downtime_jail_duration) + ? Duration.fromJSON(object.downtime_jail_duration) + : undefined, + slash_fraction_double_sign: isSet(object.slash_fraction_double_sign) + ? bytesFromBase64(object.slash_fraction_double_sign) + : new Uint8Array(), + slash_fraction_downtime: isSet(object.slash_fraction_downtime) + ? bytesFromBase64(object.slash_fraction_downtime) + : new Uint8Array(), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.signed_blocks_window !== undefined && (obj.signed_blocks_window = message.signed_blocks_window); + message.min_signed_per_window !== undefined && + (obj.min_signed_per_window = base64FromBytes( + message.min_signed_per_window !== undefined ? message.min_signed_per_window : new Uint8Array(), + )); + message.downtime_jail_duration !== undefined && (obj.downtime_jail_duration = message.downtime_jail_duration + ? Duration.toJSON(message.downtime_jail_duration) + : undefined); + message.slash_fraction_double_sign !== undefined && + (obj.slash_fraction_double_sign = base64FromBytes( + message.slash_fraction_double_sign !== undefined ? message.slash_fraction_double_sign : new Uint8Array(), + )); + message.slash_fraction_downtime !== undefined && + (obj.slash_fraction_downtime = base64FromBytes( + message.slash_fraction_downtime !== undefined ? message.slash_fraction_downtime : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.signed_blocks_window = object.signed_blocks_window ?? "0"; + message.min_signed_per_window = object.min_signed_per_window ?? new Uint8Array(); + message.downtime_jail_duration = + (object.downtime_jail_duration !== undefined && object.downtime_jail_duration !== null) + ? Duration.fromPartial(object.downtime_jail_duration) + : undefined; + message.slash_fraction_double_sign = object.slash_fraction_double_sign ?? new Uint8Array(); + message.slash_fraction_downtime = object.slash_fraction_downtime ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/slashing/v1beta1/tx.ts b/common/types/src/client/cosmos/slashing/v1beta1/tx.ts new file mode 100644 index 00000000..54d56e48 --- /dev/null +++ b/common/types/src/client/cosmos/slashing/v1beta1/tx.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** MsgUnjail defines the Msg/Unjail request type */ +export interface MsgUnjail { + validator_addr: string; +} + +/** MsgUnjailResponse defines the Msg/Unjail response type */ +export interface MsgUnjailResponse { +} + +function createBaseMsgUnjail(): MsgUnjail { + return { validator_addr: "" }; +} + +export const MsgUnjail = { + encode(message: MsgUnjail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUnjail { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjail(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUnjail { + return { validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "" }; + }, + + toJSON(message: MsgUnjail): unknown { + const obj: any = {}; + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + return obj; + }, + + fromPartial, I>>(object: I): MsgUnjail { + const message = createBaseMsgUnjail(); + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +function createBaseMsgUnjailResponse(): MsgUnjailResponse { + return {}; +} + +export const MsgUnjailResponse = { + encode(_: MsgUnjailResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUnjailResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjailResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUnjailResponse { + return {}; + }, + + toJSON(_: MsgUnjailResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUnjailResponse { + const message = createBaseMsgUnjailResponse(); + return message; + }, +}; + +/** Msg defines the slashing Msg service. */ +export interface Msg { + /** + * Unjail defines a method for unjailing a jailed validator, thus returning + * them into the bonded validator set, so they can begin receiving provisions + * and rewards again. + */ + Unjail(request: MsgUnjail): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.slashing.v1beta1.Msg"; + this.rpc = rpc; + this.Unjail = this.Unjail.bind(this); + } + Unjail(request: MsgUnjail): Promise { + const data = MsgUnjail.encode(request).finish(); + const promise = this.rpc.request(this.service, "Unjail", data); + return promise.then((data) => MsgUnjailResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/staking/v1beta1/authz.ts b/common/types/src/client/cosmos/staking/v1beta1/authz.ts new file mode 100644 index 00000000..14ea6f34 --- /dev/null +++ b/common/types/src/client/cosmos/staking/v1beta1/authz.ts @@ -0,0 +1,244 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** + * AuthorizationType defines the type of staking module authorization type + * + * Since: cosmos-sdk 0.43 + */ +export enum AuthorizationType { + /** AUTHORIZATION_TYPE_UNSPECIFIED - AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type */ + AUTHORIZATION_TYPE_UNSPECIFIED = 0, + /** AUTHORIZATION_TYPE_DELEGATE - AUTHORIZATION_TYPE_DELEGATE defines an authorization type for Msg/Delegate */ + AUTHORIZATION_TYPE_DELEGATE = 1, + /** AUTHORIZATION_TYPE_UNDELEGATE - AUTHORIZATION_TYPE_UNDELEGATE defines an authorization type for Msg/Undelegate */ + AUTHORIZATION_TYPE_UNDELEGATE = 2, + /** AUTHORIZATION_TYPE_REDELEGATE - AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate */ + AUTHORIZATION_TYPE_REDELEGATE = 3, + UNRECOGNIZED = -1, +} + +export function authorizationTypeFromJSON(object: any): AuthorizationType { + switch (object) { + case 0: + case "AUTHORIZATION_TYPE_UNSPECIFIED": + return AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED; + case 1: + case "AUTHORIZATION_TYPE_DELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_DELEGATE; + case 2: + case "AUTHORIZATION_TYPE_UNDELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE; + case 3: + case "AUTHORIZATION_TYPE_REDELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE; + case -1: + case "UNRECOGNIZED": + default: + return AuthorizationType.UNRECOGNIZED; + } +} + +export function authorizationTypeToJSON(object: AuthorizationType): string { + switch (object) { + case AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED: + return "AUTHORIZATION_TYPE_UNSPECIFIED"; + case AuthorizationType.AUTHORIZATION_TYPE_DELEGATE: + return "AUTHORIZATION_TYPE_DELEGATE"; + case AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE: + return "AUTHORIZATION_TYPE_UNDELEGATE"; + case AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE: + return "AUTHORIZATION_TYPE_REDELEGATE"; + case AuthorizationType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * StakeAuthorization defines authorization for delegate/undelegate/redelegate. + * + * Since: cosmos-sdk 0.43 + */ +export interface StakeAuthorization { + /** + * max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is + * empty, there is no spend limit and any amount of coins can be delegated. + */ + max_tokens?: Coin; + /** + * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + * account. + */ + allow_list?: + | StakeAuthorization_Validators + | undefined; + /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ + deny_list?: + | StakeAuthorization_Validators + | undefined; + /** authorization_type defines one of AuthorizationType. */ + authorization_type: AuthorizationType; +} + +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_Validators { + address: string[]; +} + +function createBaseStakeAuthorization(): StakeAuthorization { + return { max_tokens: undefined, allow_list: undefined, deny_list: undefined, authorization_type: 0 }; +} + +export const StakeAuthorization = { + encode(message: StakeAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.max_tokens !== undefined) { + Coin.encode(message.max_tokens, writer.uint32(10).fork()).ldelim(); + } + if (message.allow_list !== undefined) { + StakeAuthorization_Validators.encode(message.allow_list, writer.uint32(18).fork()).ldelim(); + } + if (message.deny_list !== undefined) { + StakeAuthorization_Validators.encode(message.deny_list, writer.uint32(26).fork()).ldelim(); + } + if (message.authorization_type !== 0) { + writer.uint32(32).int32(message.authorization_type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakeAuthorization { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.max_tokens = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.allow_list = StakeAuthorization_Validators.decode(reader, reader.uint32()); + break; + case 3: + message.deny_list = StakeAuthorization_Validators.decode(reader, reader.uint32()); + break; + case 4: + message.authorization_type = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StakeAuthorization { + return { + max_tokens: isSet(object.max_tokens) ? Coin.fromJSON(object.max_tokens) : undefined, + allow_list: isSet(object.allow_list) ? StakeAuthorization_Validators.fromJSON(object.allow_list) : undefined, + deny_list: isSet(object.deny_list) ? StakeAuthorization_Validators.fromJSON(object.deny_list) : undefined, + authorization_type: isSet(object.authorization_type) ? authorizationTypeFromJSON(object.authorization_type) : 0, + }; + }, + + toJSON(message: StakeAuthorization): unknown { + const obj: any = {}; + message.max_tokens !== undefined && + (obj.max_tokens = message.max_tokens ? Coin.toJSON(message.max_tokens) : undefined); + message.allow_list !== undefined && + (obj.allow_list = message.allow_list ? StakeAuthorization_Validators.toJSON(message.allow_list) : undefined); + message.deny_list !== undefined && + (obj.deny_list = message.deny_list ? StakeAuthorization_Validators.toJSON(message.deny_list) : undefined); + message.authorization_type !== undefined && + (obj.authorization_type = authorizationTypeToJSON(message.authorization_type)); + return obj; + }, + + fromPartial, I>>(object: I): StakeAuthorization { + const message = createBaseStakeAuthorization(); + message.max_tokens = (object.max_tokens !== undefined && object.max_tokens !== null) + ? Coin.fromPartial(object.max_tokens) + : undefined; + message.allow_list = (object.allow_list !== undefined && object.allow_list !== null) + ? StakeAuthorization_Validators.fromPartial(object.allow_list) + : undefined; + message.deny_list = (object.deny_list !== undefined && object.deny_list !== null) + ? StakeAuthorization_Validators.fromPartial(object.deny_list) + : undefined; + message.authorization_type = object.authorization_type ?? 0; + return message; + }, +}; + +function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { + return { address: [] }; +} + +export const StakeAuthorization_Validators = { + encode(message: StakeAuthorization_Validators, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.address) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakeAuthorization_Validators { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeAuthorization_Validators(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StakeAuthorization_Validators { + return { address: Array.isArray(object?.address) ? object.address.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: StakeAuthorization_Validators): unknown { + const obj: any = {}; + if (message.address) { + obj.address = message.address.map((e) => e); + } else { + obj.address = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): StakeAuthorization_Validators { + const message = createBaseStakeAuthorization_Validators(); + message.address = object.address?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/staking/v1beta1/genesis.ts b/common/types/src/client/cosmos/staking/v1beta1/genesis.ts new file mode 100644 index 00000000..e4bad586 --- /dev/null +++ b/common/types/src/client/cosmos/staking/v1beta1/genesis.ts @@ -0,0 +1,321 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Delegation, Params, Redelegation, UnbondingDelegation, Validator } from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** GenesisState defines the staking module's genesis state. */ +export interface GenesisState { + /** params defines all the paramaters of related to deposit. */ + params?: Params; + /** + * last_total_power tracks the total amounts of bonded tokens recorded during + * the previous end block. + */ + last_total_power: Uint8Array; + /** + * last_validator_powers is a special index that provides a historical list + * of the last-block's bonded validators. + */ + last_validator_powers: LastValidatorPower[]; + /** delegations defines the validator set at genesis. */ + validators: Validator[]; + /** delegations defines the delegations active at genesis. */ + delegations: Delegation[]; + /** unbonding_delegations defines the unbonding delegations active at genesis. */ + unbonding_delegations: UnbondingDelegation[]; + /** redelegations defines the redelegations active at genesis. */ + redelegations: Redelegation[]; + exported: boolean; +} + +/** LastValidatorPower required for validator set update logic. */ +export interface LastValidatorPower { + /** address is the address of the validator. */ + address: string; + /** power defines the power of the validator. */ + power: string; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + last_total_power: new Uint8Array(), + last_validator_powers: [], + validators: [], + delegations: [], + unbonding_delegations: [], + redelegations: [], + exported: false, + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.last_total_power.length !== 0) { + writer.uint32(18).bytes(message.last_total_power); + } + for (const v of message.last_validator_powers) { + LastValidatorPower.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.delegations) { + Delegation.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.unbonding_delegations) { + UnbondingDelegation.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.redelegations) { + Redelegation.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.exported === true) { + writer.uint32(64).bool(message.exported); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.last_total_power = reader.bytes(); + break; + case 3: + message.last_validator_powers.push(LastValidatorPower.decode(reader, reader.uint32())); + break; + case 4: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 5: + message.delegations.push(Delegation.decode(reader, reader.uint32())); + break; + case 6: + message.unbonding_delegations.push(UnbondingDelegation.decode(reader, reader.uint32())); + break; + case 7: + message.redelegations.push(Redelegation.decode(reader, reader.uint32())); + break; + case 8: + message.exported = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + last_total_power: isSet(object.last_total_power) ? bytesFromBase64(object.last_total_power) : new Uint8Array(), + last_validator_powers: Array.isArray(object?.last_validator_powers) + ? object.last_validator_powers.map((e: any) => LastValidatorPower.fromJSON(e)) + : [], + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + delegations: Array.isArray(object?.delegations) ? object.delegations.map((e: any) => Delegation.fromJSON(e)) : [], + unbonding_delegations: Array.isArray(object?.unbonding_delegations) + ? object.unbonding_delegations.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + redelegations: Array.isArray(object?.redelegations) + ? object.redelegations.map((e: any) => Redelegation.fromJSON(e)) + : [], + exported: isSet(object.exported) ? Boolean(object.exported) : false, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + message.last_total_power !== undefined && + (obj.last_total_power = base64FromBytes( + message.last_total_power !== undefined ? message.last_total_power : new Uint8Array(), + )); + if (message.last_validator_powers) { + obj.last_validator_powers = message.last_validator_powers.map((e) => + e ? LastValidatorPower.toJSON(e) : undefined + ); + } else { + obj.last_validator_powers = []; + } + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + if (message.delegations) { + obj.delegations = message.delegations.map((e) => e ? Delegation.toJSON(e) : undefined); + } else { + obj.delegations = []; + } + if (message.unbonding_delegations) { + obj.unbonding_delegations = message.unbonding_delegations.map((e) => + e ? UnbondingDelegation.toJSON(e) : undefined + ); + } else { + obj.unbonding_delegations = []; + } + if (message.redelegations) { + obj.redelegations = message.redelegations.map((e) => e ? Redelegation.toJSON(e) : undefined); + } else { + obj.redelegations = []; + } + message.exported !== undefined && (obj.exported = message.exported); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.last_total_power = object.last_total_power ?? new Uint8Array(); + message.last_validator_powers = object.last_validator_powers?.map((e) => LastValidatorPower.fromPartial(e)) || []; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.delegations = object.delegations?.map((e) => Delegation.fromPartial(e)) || []; + message.unbonding_delegations = object.unbonding_delegations?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.redelegations = object.redelegations?.map((e) => Redelegation.fromPartial(e)) || []; + message.exported = object.exported ?? false; + return message; + }, +}; + +function createBaseLastValidatorPower(): LastValidatorPower { + return { address: "", power: "0" }; +} + +export const LastValidatorPower = { + encode(message: LastValidatorPower, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.power !== "0") { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LastValidatorPower { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLastValidatorPower(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.power = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LastValidatorPower { + return { + address: isSet(object.address) ? String(object.address) : "", + power: isSet(object.power) ? String(object.power) : "0", + }; + }, + + toJSON(message: LastValidatorPower): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.power !== undefined && (obj.power = message.power); + return obj; + }, + + fromPartial, I>>(object: I): LastValidatorPower { + const message = createBaseLastValidatorPower(); + message.address = object.address ?? ""; + message.power = object.power ?? "0"; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/staking/v1beta1/query.ts b/common/types/src/client/cosmos/staking/v1beta1/query.ts new file mode 100644 index 00000000..d0d16cfe --- /dev/null +++ b/common/types/src/client/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,2090 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + DelegationResponse, + HistoricalInfo, + Params, + Pool, + RedelegationResponse, + UnbondingDelegation, + Validator, +} from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** 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; +} + +/** 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; +} + +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequest { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponse { + /** validator defines the the validator info. */ + validator?: Validator; +} + +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponse { + delegation_responses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponse { + unbonding_responses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponse { + /** delegation_responses defines the delegation info of a delegation. */ + delegation_response?: DelegationResponse; +} + +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponse { + /** unbond defines the unbonding information of a delegation. */ + unbond?: UnbondingDelegation; +} + +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponse { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegation_responses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponse { + unbonding_responses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequest { + /** 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?: PageRequest; +} + +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponse { + redelegation_responses: RedelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the the validators' info of a delegator. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponse { + /** validator defines the the validator info. */ + validator?: Validator; +} + +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequest { + /** height defines at which height to query the historical info. */ + height: string; +} + +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponse { + /** hist defines the historical info at the given height. */ + hist?: HistoricalInfo; +} + +/** QueryPoolRequest is request type for the Query/Pool RPC method. */ +export interface QueryPoolRequest { +} + +/** QueryPoolResponse is response type for the Query/Pool RPC method. */ +export interface QueryPoolResponse { + /** pool defines the pool info. */ + pool?: Pool; +} + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { + return { status: "", pagination: undefined }; +} + +export const QueryValidatorsRequest = { + encode(message: QueryValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryValidatorsRequest { + return { + status: isSet(object.status) ? String(object.status) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsRequest): unknown { + const obj: any = {}; + message.status !== undefined && (obj.status = message.status); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryValidatorsRequest { + const message = createBaseQueryValidatorsRequest(); + message.status = object.status ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorsResponse(): QueryValidatorsResponse { + return { validators: [], pagination: undefined }; +} + +export const QueryValidatorsResponse = { + encode(message: QueryValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryValidatorsResponse { + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryValidatorRequest(): QueryValidatorRequest { + return { validator_addr: "" }; +} + +export const QueryValidatorRequest = { + encode(message: QueryValidatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorRequest { + return { validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "" }; + }, + + toJSON(message: QueryValidatorRequest): unknown { + const obj: any = {}; + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + return obj; + }, + + fromPartial, I>>(object: I): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorResponse(): QueryValidatorResponse { + return { validator: undefined }; +} + +export const QueryValidatorResponse = { + encode(message: QueryValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryValidatorResponse): unknown { + const obj: any = {}; + message.validator !== undefined && + (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryValidatorResponse { + const message = createBaseQueryValidatorResponse(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegationsRequest { + return { validator_addr: "", pagination: undefined }; +} + +export const QueryValidatorDelegationsRequest = { + encode(message: QueryValidatorDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_addr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsRequest { + return { + validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsRequest): unknown { + const obj: any = {}; + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validator_addr = object.validator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { + return { delegation_responses: [], pagination: undefined }; +} + +export const QueryValidatorDelegationsResponse = { + encode(message: QueryValidatorDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.delegation_responses) { + 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: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegation_responses.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; + }, + + fromJSON(object: any): QueryValidatorDelegationsResponse { + return { + delegation_responses: Array.isArray(object?.delegation_responses) + ? object.delegation_responses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegation_responses) { + obj.delegation_responses = message.delegation_responses.map((e) => e ? DelegationResponse.toJSON(e) : undefined); + } else { + obj.delegation_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegation_responses = object.delegation_responses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { + return { validator_addr: "", pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsRequest = { + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_addr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { + return { + validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validator_addr = object.validator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { + return { unbonding_responses: [], pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsResponse = { + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.unbonding_responses) { + 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: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.unbonding_responses.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; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { + return { + unbonding_responses: Array.isArray(object?.unbonding_responses) + ? object.unbonding_responses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbonding_responses) { + obj.unbonding_responses = message.unbonding_responses.map((e) => e ? UnbondingDelegation.toJSON(e) : undefined); + } else { + obj.unbonding_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbonding_responses = object.unbonding_responses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegationRequest(): QueryDelegationRequest { + return { delegator_addr: "", validator_addr: "" }; +} + +export const QueryDelegationRequest = { + encode(message: QueryDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.validator_addr !== "") { + writer.uint32(18).string(message.validator_addr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegationRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "", + }; + }, + + toJSON(message: QueryDelegationRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + return obj; + }, + + fromPartial, I>>(object: I): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationResponse(): QueryDelegationResponse { + return { delegation_response: undefined }; +} + +export const QueryDelegationResponse = { + encode(message: QueryDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegation_response !== undefined) { + DelegationResponse.encode(message.delegation_response, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegation_response = DelegationResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegationResponse { + return { + delegation_response: isSet(object.delegation_response) + ? DelegationResponse.fromJSON(object.delegation_response) + : undefined, + }; + }, + + toJSON(message: QueryDelegationResponse): unknown { + const obj: any = {}; + message.delegation_response !== undefined && (obj.delegation_response = message.delegation_response + ? DelegationResponse.toJSON(message.delegation_response) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + message.delegation_response = (object.delegation_response !== undefined && object.delegation_response !== null) + ? DelegationResponse.fromPartial(object.delegation_response) + : undefined; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { + return { delegator_addr: "", validator_addr: "" }; +} + +export const QueryUnbondingDelegationRequest = { + encode(message: QueryUnbondingDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.validator_addr !== "") { + writer.uint32(18).string(message.validator_addr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "", + }; + }, + + toJSON(message: QueryUnbondingDelegationRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { + return { unbond: undefined }; +} + +export const QueryUnbondingDelegationResponse = { + encode(message: QueryUnbondingDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.unbond !== undefined) { + UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryUnbondingDelegationResponse { + return { unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined }; + }, + + toJSON(message: QueryUnbondingDelegationResponse): unknown { + const obj: any = {}; + message.unbond !== undefined && + (obj.unbond = message.unbond ? UnbondingDelegation.toJSON(message.unbond) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryUnbondingDelegationResponse { + const message = createBaseQueryUnbondingDelegationResponse(); + message.unbond = (object.unbond !== undefined && object.unbond !== null) + ? UnbondingDelegation.fromPartial(object.unbond) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegationsRequest { + return { delegator_addr: "", pagination: undefined }; +} + +export const QueryDelegatorDelegationsRequest = { + encode(message: QueryDelegatorDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { + return { delegation_responses: [], pagination: undefined }; +} + +export const QueryDelegatorDelegationsResponse = { + encode(message: QueryDelegatorDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.delegation_responses) { + 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: _m0.Reader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegation_responses.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; + }, + + fromJSON(object: any): QueryDelegatorDelegationsResponse { + return { + delegation_responses: Array.isArray(object?.delegation_responses) + ? object.delegation_responses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegation_responses) { + obj.delegation_responses = message.delegation_responses.map((e) => e ? DelegationResponse.toJSON(e) : undefined); + } else { + obj.delegation_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegation_responses = object.delegation_responses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { + return { delegator_addr: "", pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsRequest = { + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { + return { unbonding_responses: [], pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsResponse = { + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.unbonding_responses) { + 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: _m0.Reader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.unbonding_responses.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; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { + return { + unbonding_responses: Array.isArray(object?.unbonding_responses) + ? object.unbonding_responses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbonding_responses) { + obj.unbonding_responses = message.unbonding_responses.map((e) => e ? UnbondingDelegation.toJSON(e) : undefined); + } else { + obj.unbonding_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbonding_responses = object.unbonding_responses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { delegator_addr: "", src_validator_addr: "", dst_validator_addr: "", pagination: undefined }; +} + +export const QueryRedelegationsRequest = { + encode(message: QueryRedelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.src_validator_addr !== "") { + writer.uint32(18).string(message.src_validator_addr); + } + if (message.dst_validator_addr !== "") { + writer.uint32(26).string(message.dst_validator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.src_validator_addr = reader.string(); + break; + case 3: + message.dst_validator_addr = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + src_validator_addr: isSet(object.src_validator_addr) ? String(object.src_validator_addr) : "", + dst_validator_addr: isSet(object.dst_validator_addr) ? String(object.dst_validator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.src_validator_addr !== undefined && (obj.src_validator_addr = message.src_validator_addr); + message.dst_validator_addr !== undefined && (obj.dst_validator_addr = message.dst_validator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.src_validator_addr = object.src_validator_addr ?? ""; + message.dst_validator_addr = object.dst_validator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { redelegation_responses: [], pagination: undefined }; +} + +export const QueryRedelegationsResponse = { + encode(message: QueryRedelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.redelegation_responses) { + 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: _m0.Reader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.redelegation_responses.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; + }, + + fromJSON(object: any): QueryRedelegationsResponse { + return { + redelegation_responses: Array.isArray(object?.redelegation_responses) + ? object.redelegation_responses.map((e: any) => RedelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsResponse): unknown { + const obj: any = {}; + if (message.redelegation_responses) { + obj.redelegation_responses = message.redelegation_responses.map((e) => + e ? RedelegationResponse.toJSON(e) : undefined + ); + } else { + obj.redelegation_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegation_responses = object.redelegation_responses?.map((e) => RedelegationResponse.fromPartial(e)) || + []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegator_addr: "", pagination: undefined }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [], pagination: undefined }; +} + +export const QueryDelegatorValidatorsResponse = { + encode(message: QueryDelegatorValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): 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; + }, +}; + +function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequest { + return { delegator_addr: "", validator_addr: "" }; +} + +export const QueryDelegatorValidatorRequest = { + encode(message: QueryDelegatorValidatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.validator_addr !== "") { + writer.uint32(18).string(message.validator_addr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "", + }; + }, + + toJSON(message: QueryDelegatorValidatorRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { + return { validator: undefined }; +} + +export const QueryDelegatorValidatorResponse = { + encode(message: QueryDelegatorValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDelegatorValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryDelegatorValidatorResponse): unknown { + const obj: any = {}; + message.validator !== undefined && + (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorResponse { + const message = createBaseQueryDelegatorValidatorResponse(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + return message; + }, +}; + +function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { + return { height: "0" }; +} + +export const QueryHistoricalInfoRequest = { + encode(message: QueryHistoricalInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoRequest { + return { height: isSet(object.height) ? String(object.height) : "0" }; + }, + + toJSON(message: QueryHistoricalInfoRequest): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>(object: I): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { + return { hist: undefined }; +} + +export const QueryHistoricalInfoResponse = { + encode(message: QueryHistoricalInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hist !== undefined) { + HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryHistoricalInfoResponse { + return { hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined }; + }, + + toJSON(message: QueryHistoricalInfoResponse): unknown { + const obj: any = {}; + message.hist !== undefined && (obj.hist = message.hist ? HistoricalInfo.toJSON(message.hist) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryHistoricalInfoResponse { + const message = createBaseQueryHistoricalInfoResponse(); + message.hist = (object.hist !== undefined && object.hist !== null) + ? HistoricalInfo.fromPartial(object.hist) + : undefined; + return message; + }, +}; + +function createBaseQueryPoolRequest(): QueryPoolRequest { + return {}; +} + +export const QueryPoolRequest = { + encode(_: QueryPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryPoolRequest { + return {}; + }, + + toJSON(_: QueryPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, +}; + +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { pool: undefined }; +} + +export const QueryPoolResponse = { + encode(message: QueryPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool !== undefined) { + Pool.encode(message.pool, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryPoolResponse { + return { pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined }; + }, + + toJSON(message: QueryPoolResponse): unknown { + const obj: any = {}; + message.pool !== undefined && (obj.pool = message.pool ? Pool.toJSON(message.pool) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryPoolResponse { + const message = createBaseQueryPoolResponse(); + message.pool = (object.pool !== undefined && object.pool !== null) ? Pool.fromPartial(object.pool) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Validators queries all validators that match the given status. */ + Validators(request: QueryValidatorsRequest): Promise; + /** Validator queries validator info for given validator address. */ + Validator(request: QueryValidatorRequest): Promise; + /** ValidatorDelegations queries delegate info for given validator. */ + ValidatorDelegations(request: QueryValidatorDelegationsRequest): Promise; + /** ValidatorUnbondingDelegations queries unbonding delegations of a validator. */ + ValidatorUnbondingDelegations( + request: QueryValidatorUnbondingDelegationsRequest, + ): Promise; + /** Delegation queries delegate info for given validator delegator pair. */ + Delegation(request: QueryDelegationRequest): Promise; + /** + * UnbondingDelegation queries unbonding info for given validator delegator + * pair. + */ + UnbondingDelegation(request: QueryUnbondingDelegationRequest): Promise; + /** DelegatorDelegations queries all delegations of a given delegator address. */ + DelegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise; + /** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + */ + DelegatorUnbondingDelegations( + request: QueryDelegatorUnbondingDelegationsRequest, + ): Promise; + /** Redelegations queries redelegations of given address. */ + Redelegations(request: QueryRedelegationsRequest): Promise; + /** + * DelegatorValidators queries all validators info for given delegator + * address. + */ + DelegatorValidators(request: QueryDelegatorValidatorsRequest): Promise; + /** + * DelegatorValidator queries validator info for given delegator validator + * pair. + */ + DelegatorValidator(request: QueryDelegatorValidatorRequest): Promise; + /** HistoricalInfo queries the historical info for given height. */ + HistoricalInfo(request: QueryHistoricalInfoRequest): Promise; + /** Pool queries the pool info. */ + Pool(request: QueryPoolRequest): Promise; + /** Parameters queries the staking parameters. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.staking.v1beta1.Query"; + this.rpc = rpc; + this.Validators = this.Validators.bind(this); + this.Validator = this.Validator.bind(this); + this.ValidatorDelegations = this.ValidatorDelegations.bind(this); + this.ValidatorUnbondingDelegations = this.ValidatorUnbondingDelegations.bind(this); + this.Delegation = this.Delegation.bind(this); + this.UnbondingDelegation = this.UnbondingDelegation.bind(this); + this.DelegatorDelegations = this.DelegatorDelegations.bind(this); + this.DelegatorUnbondingDelegations = this.DelegatorUnbondingDelegations.bind(this); + this.Redelegations = this.Redelegations.bind(this); + this.DelegatorValidators = this.DelegatorValidators.bind(this); + this.DelegatorValidator = this.DelegatorValidator.bind(this); + this.HistoricalInfo = this.HistoricalInfo.bind(this); + this.Pool = this.Pool.bind(this); + this.Params = this.Params.bind(this); + } + Validators(request: QueryValidatorsRequest): Promise { + const data = QueryValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Validators", data); + return promise.then((data) => QueryValidatorsResponse.decode(new _m0.Reader(data))); + } + + Validator(request: QueryValidatorRequest): Promise { + const data = QueryValidatorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Validator", data); + return promise.then((data) => QueryValidatorResponse.decode(new _m0.Reader(data))); + } + + ValidatorDelegations(request: QueryValidatorDelegationsRequest): Promise { + const data = QueryValidatorDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDelegations", data); + return promise.then((data) => QueryValidatorDelegationsResponse.decode(new _m0.Reader(data))); + } + + ValidatorUnbondingDelegations( + request: QueryValidatorUnbondingDelegationsRequest, + ): Promise { + const data = QueryValidatorUnbondingDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorUnbondingDelegations", data); + return promise.then((data) => QueryValidatorUnbondingDelegationsResponse.decode(new _m0.Reader(data))); + } + + Delegation(request: QueryDelegationRequest): Promise { + const data = QueryDelegationRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Delegation", data); + return promise.then((data) => QueryDelegationResponse.decode(new _m0.Reader(data))); + } + + UnbondingDelegation(request: QueryUnbondingDelegationRequest): Promise { + const data = QueryUnbondingDelegationRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnbondingDelegation", data); + return promise.then((data) => QueryUnbondingDelegationResponse.decode(new _m0.Reader(data))); + } + + DelegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise { + const data = QueryDelegatorDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorDelegations", data); + return promise.then((data) => QueryDelegatorDelegationsResponse.decode(new _m0.Reader(data))); + } + + DelegatorUnbondingDelegations( + request: QueryDelegatorUnbondingDelegationsRequest, + ): Promise { + const data = QueryDelegatorUnbondingDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorUnbondingDelegations", data); + return promise.then((data) => QueryDelegatorUnbondingDelegationsResponse.decode(new _m0.Reader(data))); + } + + Redelegations(request: QueryRedelegationsRequest): Promise { + const data = QueryRedelegationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Redelegations", data); + return promise.then((data) => QueryRedelegationsResponse.decode(new _m0.Reader(data))); + } + + DelegatorValidators(request: QueryDelegatorValidatorsRequest): Promise { + const data = QueryDelegatorValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorValidators", data); + return promise.then((data) => QueryDelegatorValidatorsResponse.decode(new _m0.Reader(data))); + } + + DelegatorValidator(request: QueryDelegatorValidatorRequest): Promise { + const data = QueryDelegatorValidatorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorValidator", data); + return promise.then((data) => QueryDelegatorValidatorResponse.decode(new _m0.Reader(data))); + } + + HistoricalInfo(request: QueryHistoricalInfoRequest): Promise { + const data = QueryHistoricalInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "HistoricalInfo", data); + return promise.then((data) => QueryHistoricalInfoResponse.decode(new _m0.Reader(data))); + } + + Pool(request: QueryPoolRequest): Promise { + const data = QueryPoolRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pool", data); + return promise.then((data) => QueryPoolResponse.decode(new _m0.Reader(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/staking/v1beta1/staking.ts b/common/types/src/client/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 00000000..9a992ee3 --- /dev/null +++ b/common/types/src/client/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,1787 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Header } from "../../../tendermint/types/types"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** 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 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"; + } +} + +/** + * 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[]; +} + +/** + * 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. */ + max_rate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + max_change_rate: string; +} + +/** 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. */ + commission_rates?: CommissionRates; + /** update_time is the last time the commission rate was changed. */ + update_time?: Date; +} + +/** 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. */ + security_contact: string; + /** details define other optional details. */ + details: string; +} + +/** + * 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. */ + operator_address: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensus_pubkey?: Any; + /** 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?: Description; + /** 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?: Date; + /** commission defines the commission parameters. */ + commission?: Commission; + /** min_self_delegation is the validator's self declared minimum self delegation. */ + min_self_delegation: string; +} + +/** ValAddresses defines a repeated set of validator addresses. */ +export interface ValAddresses { + addresses: string[]; +} + +/** + * 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 { + delegator_address: string; + validator_address: string; +} + +/** DVPairs defines an array of DVPair objects. */ +export interface DVPairs { + pairs: DVPair[]; +} + +/** + * 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 { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; +} + +/** DVVTriplets defines an array of DVVTriplet objects. */ +export interface DVVTriplets { + triplets: DVVTriplet[]; +} + +/** + * 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 bech32-encoded address of the delegator. */ + delegator_address: string; + /** validator_address is the bech32-encoded address of the validator. */ + validator_address: string; + /** shares define the delegation shares received. */ + shares: string; +} + +/** + * 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 bech32-encoded address of the delegator. */ + delegator_address: string; + /** validator_address is the bech32-encoded address of the validator. */ + validator_address: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntry[]; +} + +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntry { + /** creation_height is the height which the unbonding took place. */ + creation_height: string; + /** completion_time is the unix time for unbonding completion. */ + completion_time?: Date; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initial_balance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; +} + +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntry { + /** creation_height defines the height which the redelegation took place. */ + creation_height: string; + /** completion_time defines the unix time for redelegation completion. */ + completion_time?: Date; + /** 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; +} + +/** + * 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. */ + 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: RedelegationEntry[]; +} + +/** Params defines the parameters for the staking module. */ +export interface Params { + /** unbonding_time is the time duration of unbonding. */ + unbonding_time?: Duration; + /** 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; +} + +/** + * 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; +} + +/** + * 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 { + redelegation_entry?: RedelegationEntry; + balance: string; +} + +/** + * 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[]; +} + +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface Pool { + not_bonded_tokens: string; + bonded_tokens: string; +} + +function createBaseHistoricalInfo(): HistoricalInfo { + return { header: undefined, valset: [] }; +} + +export const HistoricalInfo = { + encode(message: HistoricalInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): HistoricalInfo { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + valset: Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [], + }; + }, + + toJSON(message: HistoricalInfo): unknown { + const obj: any = {}; + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + if (message.valset) { + obj.valset = message.valset.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.valset = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseCommissionRates(): CommissionRates { + return { rate: "", max_rate: "", max_change_rate: "" }; +} + +export const CommissionRates = { + encode(message: CommissionRates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.max_rate !== "") { + writer.uint32(18).string(message.max_rate); + } + if (message.max_change_rate !== "") { + writer.uint32(26).string(message.max_change_rate); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.max_rate = reader.string(); + break; + case 3: + message.max_change_rate = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommissionRates { + return { + rate: isSet(object.rate) ? String(object.rate) : "", + max_rate: isSet(object.max_rate) ? String(object.max_rate) : "", + max_change_rate: isSet(object.max_change_rate) ? String(object.max_change_rate) : "", + }; + }, + + toJSON(message: CommissionRates): unknown { + const obj: any = {}; + message.rate !== undefined && (obj.rate = message.rate); + message.max_rate !== undefined && (obj.max_rate = message.max_rate); + message.max_change_rate !== undefined && (obj.max_change_rate = message.max_change_rate); + return obj; + }, + + fromPartial, I>>(object: I): CommissionRates { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.max_rate = object.max_rate ?? ""; + message.max_change_rate = object.max_change_rate ?? ""; + return message; + }, +}; + +function createBaseCommission(): Commission { + return { commission_rates: undefined, update_time: undefined }; +} + +export const Commission = { + encode(message: Commission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.commission_rates !== undefined) { + CommissionRates.encode(message.commission_rates, writer.uint32(10).fork()).ldelim(); + } + if (message.update_time !== undefined) { + Timestamp.encode(toTimestamp(message.update_time), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Commission { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.commission_rates = CommissionRates.decode(reader, reader.uint32()); + break; + case 2: + message.update_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Commission { + return { + commission_rates: isSet(object.commission_rates) ? CommissionRates.fromJSON(object.commission_rates) : undefined, + update_time: isSet(object.update_time) ? fromJsonTimestamp(object.update_time) : undefined, + }; + }, + + toJSON(message: Commission): unknown { + const obj: any = {}; + message.commission_rates !== undefined && + (obj.commission_rates = message.commission_rates ? CommissionRates.toJSON(message.commission_rates) : undefined); + message.update_time !== undefined && (obj.update_time = message.update_time.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): Commission { + const message = createBaseCommission(); + message.commission_rates = (object.commission_rates !== undefined && object.commission_rates !== null) + ? CommissionRates.fromPartial(object.commission_rates) + : undefined; + message.update_time = object.update_time ?? undefined; + return message; + }, +}; + +function createBaseDescription(): Description { + return { moniker: "", identity: "", website: "", security_contact: "", details: "" }; +} + +export const Description = { + encode(message: Description, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.security_contact !== "") { + writer.uint32(34).string(message.security_contact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Description { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.security_contact = reader.string(); + break; + case 5: + message.details = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Description { + return { + moniker: isSet(object.moniker) ? String(object.moniker) : "", + identity: isSet(object.identity) ? String(object.identity) : "", + website: isSet(object.website) ? String(object.website) : "", + security_contact: isSet(object.security_contact) ? String(object.security_contact) : "", + details: isSet(object.details) ? String(object.details) : "", + }; + }, + + toJSON(message: Description): unknown { + const obj: any = {}; + message.moniker !== undefined && (obj.moniker = message.moniker); + message.identity !== undefined && (obj.identity = message.identity); + message.website !== undefined && (obj.website = message.website); + message.security_contact !== undefined && (obj.security_contact = message.security_contact); + message.details !== undefined && (obj.details = message.details); + return obj; + }, + + fromPartial, I>>(object: I): Description { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.security_contact = object.security_contact ?? ""; + message.details = object.details ?? ""; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { + operator_address: "", + consensus_pubkey: undefined, + jailed: false, + status: 0, + tokens: "", + delegator_shares: "", + description: undefined, + unbonding_height: "0", + unbonding_time: undefined, + commission: undefined, + min_self_delegation: "", + }; +} + +export const Validator = { + encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operator_address !== "") { + writer.uint32(10).string(message.operator_address); + } + if (message.consensus_pubkey !== undefined) { + Any.encode(message.consensus_pubkey, 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.delegator_shares !== "") { + writer.uint32(50).string(message.delegator_shares); + } + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(58).fork()).ldelim(); + } + if (message.unbonding_height !== "0") { + writer.uint32(64).int64(message.unbonding_height); + } + if (message.unbonding_time !== undefined) { + Timestamp.encode(toTimestamp(message.unbonding_time), writer.uint32(74).fork()).ldelim(); + } + if (message.commission !== undefined) { + Commission.encode(message.commission, writer.uint32(82).fork()).ldelim(); + } + if (message.min_self_delegation !== "") { + writer.uint32(90).string(message.min_self_delegation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Validator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.operator_address = reader.string(); + break; + case 2: + message.consensus_pubkey = Any.decode(reader, reader.uint32()); + 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.delegator_shares = reader.string(); + break; + case 7: + message.description = Description.decode(reader, reader.uint32()); + break; + case 8: + message.unbonding_height = longToString(reader.int64() as Long); + break; + case 9: + message.unbonding_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 10: + message.commission = Commission.decode(reader, reader.uint32()); + break; + case 11: + message.min_self_delegation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Validator { + return { + operator_address: isSet(object.operator_address) ? String(object.operator_address) : "", + consensus_pubkey: isSet(object.consensus_pubkey) ? Any.fromJSON(object.consensus_pubkey) : undefined, + jailed: isSet(object.jailed) ? Boolean(object.jailed) : false, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, + tokens: isSet(object.tokens) ? String(object.tokens) : "", + delegator_shares: isSet(object.delegator_shares) ? String(object.delegator_shares) : "", + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + unbonding_height: isSet(object.unbonding_height) ? String(object.unbonding_height) : "0", + unbonding_time: isSet(object.unbonding_time) ? fromJsonTimestamp(object.unbonding_time) : undefined, + commission: isSet(object.commission) ? Commission.fromJSON(object.commission) : undefined, + min_self_delegation: isSet(object.min_self_delegation) ? String(object.min_self_delegation) : "", + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + message.operator_address !== undefined && (obj.operator_address = message.operator_address); + message.consensus_pubkey !== undefined && + (obj.consensus_pubkey = message.consensus_pubkey ? Any.toJSON(message.consensus_pubkey) : undefined); + message.jailed !== undefined && (obj.jailed = message.jailed); + message.status !== undefined && (obj.status = bondStatusToJSON(message.status)); + message.tokens !== undefined && (obj.tokens = message.tokens); + message.delegator_shares !== undefined && (obj.delegator_shares = message.delegator_shares); + message.description !== undefined && + (obj.description = message.description ? Description.toJSON(message.description) : undefined); + message.unbonding_height !== undefined && (obj.unbonding_height = message.unbonding_height); + message.unbonding_time !== undefined && (obj.unbonding_time = message.unbonding_time.toISOString()); + message.commission !== undefined && + (obj.commission = message.commission ? Commission.toJSON(message.commission) : undefined); + message.min_self_delegation !== undefined && (obj.min_self_delegation = message.min_self_delegation); + return obj; + }, + + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.operator_address = object.operator_address ?? ""; + message.consensus_pubkey = (object.consensus_pubkey !== undefined && object.consensus_pubkey !== null) + ? Any.fromPartial(object.consensus_pubkey) + : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? 0; + message.tokens = object.tokens ?? ""; + message.delegator_shares = object.delegator_shares ?? ""; + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.unbonding_height = object.unbonding_height ?? "0"; + message.unbonding_time = object.unbonding_time ?? undefined; + message.commission = (object.commission !== undefined && object.commission !== null) + ? Commission.fromPartial(object.commission) + : undefined; + message.min_self_delegation = object.min_self_delegation ?? ""; + return message; + }, +}; + +function createBaseValAddresses(): ValAddresses { + return { addresses: [] }; +} + +export const ValAddresses = { + encode(message: ValAddresses, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ValAddresses { + return { addresses: Array.isArray(object?.addresses) ? object.addresses.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: ValAddresses): unknown { + const obj: any = {}; + if (message.addresses) { + obj.addresses = message.addresses.map((e) => e); + } else { + obj.addresses = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDVPair(): DVPair { + return { delegator_address: "", validator_address: "" }; +} + +export const DVPair = { + encode(message: DVPair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DVPair { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DVPair { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + }; + }, + + toJSON(message: DVPair): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>(object: I): DVPair { + const message = createBaseDVPair(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseDVPairs(): DVPairs { + return { pairs: [] }; +} + +export const DVPairs = { + encode(message: DVPairs, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pairs) { + DVPair.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DVPairs { + return { pairs: Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] }; + }, + + toJSON(message: DVPairs): unknown { + const obj: any = {}; + if (message.pairs) { + obj.pairs = message.pairs.map((e) => e ? DVPair.toJSON(e) : undefined); + } else { + obj.pairs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map((e) => DVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDVVTriplet(): DVVTriplet { + return { delegator_address: "", validator_src_address: "", validator_dst_address: "" }; +} + +export const DVVTriplet = { + encode(message: DVVTriplet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_src_address !== "") { + writer.uint32(18).string(message.validator_src_address); + } + if (message.validator_dst_address !== "") { + writer.uint32(26).string(message.validator_dst_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_src_address = reader.string(); + break; + case 3: + message.validator_dst_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DVVTriplet { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_src_address: isSet(object.validator_src_address) ? String(object.validator_src_address) : "", + validator_dst_address: isSet(object.validator_dst_address) ? String(object.validator_dst_address) : "", + }; + }, + + toJSON(message: DVVTriplet): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_src_address !== undefined && (obj.validator_src_address = message.validator_src_address); + message.validator_dst_address !== undefined && (obj.validator_dst_address = message.validator_dst_address); + return obj; + }, + + fromPartial, I>>(object: I): DVVTriplet { + const message = createBaseDVVTriplet(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_src_address = object.validator_src_address ?? ""; + message.validator_dst_address = object.validator_dst_address ?? ""; + return message; + }, +}; + +function createBaseDVVTriplets(): DVVTriplets { + return { triplets: [] }; +} + +export const DVVTriplets = { + encode(message: DVVTriplets, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.triplets) { + DVVTriplet.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DVVTriplets { + return { triplets: Array.isArray(object?.triplets) ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) : [] }; + }, + + toJSON(message: DVVTriplets): unknown { + const obj: any = {}; + if (message.triplets) { + obj.triplets = message.triplets.map((e) => e ? DVVTriplet.toJSON(e) : undefined); + } else { + obj.triplets = []; + } + return obj; + }, + + fromPartial, I>>(object: I): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map((e) => DVVTriplet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDelegation(): Delegation { + return { delegator_address: "", validator_address: "", shares: "" }; +} + +export const Delegation = { + encode(message: Delegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Delegation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.shares = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Delegation { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + shares: isSet(object.shares) ? String(object.shares) : "", + }; + }, + + toJSON(message: Delegation): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.shares !== undefined && (obj.shares = message.shares); + return obj; + }, + + fromPartial, I>>(object: I): Delegation { + const message = createBaseDelegation(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.shares = object.shares ?? ""; + return message; + }, +}; + +function createBaseUnbondingDelegation(): UnbondingDelegation { + return { delegator_address: "", validator_address: "", entries: [] }; +} + +export const UnbondingDelegation = { + encode(message: UnbondingDelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + for (const v of message.entries) { + UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingDelegation { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + entries: Array.isArray(object?.entries) + ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: UnbondingDelegation): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + if (message.entries) { + obj.entries = message.entries.map((e) => e ? UnbondingDelegationEntry.toJSON(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + + fromPartial, I>>(object: I): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.entries = object.entries?.map((e) => UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { + return { creation_height: "0", completion_time: undefined, initial_balance: "", balance: "" }; +} + +export const UnbondingDelegationEntry = { + encode(message: UnbondingDelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creation_height !== "0") { + writer.uint32(8).int64(message.creation_height); + } + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(18).fork()).ldelim(); + } + if (message.initial_balance !== "") { + writer.uint32(26).string(message.initial_balance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.creation_height = longToString(reader.int64() as Long); + break; + case 2: + message.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.initial_balance = reader.string(); + break; + case 4: + message.balance = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationEntry { + return { + creation_height: isSet(object.creation_height) ? String(object.creation_height) : "0", + completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined, + initial_balance: isSet(object.initial_balance) ? String(object.initial_balance) : "", + balance: isSet(object.balance) ? String(object.balance) : "", + }; + }, + + toJSON(message: UnbondingDelegationEntry): unknown { + const obj: any = {}; + message.creation_height !== undefined && (obj.creation_height = message.creation_height); + message.completion_time !== undefined && (obj.completion_time = message.completion_time.toISOString()); + message.initial_balance !== undefined && (obj.initial_balance = message.initial_balance); + message.balance !== undefined && (obj.balance = message.balance); + return obj; + }, + + fromPartial, I>>(object: I): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + message.creation_height = object.creation_height ?? "0"; + message.completion_time = object.completion_time ?? undefined; + message.initial_balance = object.initial_balance ?? ""; + message.balance = object.balance ?? ""; + return message; + }, +}; + +function createBaseRedelegationEntry(): RedelegationEntry { + return { creation_height: "0", completion_time: undefined, initial_balance: "", shares_dst: "" }; +} + +export const RedelegationEntry = { + encode(message: RedelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creation_height !== "0") { + writer.uint32(8).int64(message.creation_height); + } + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(18).fork()).ldelim(); + } + if (message.initial_balance !== "") { + writer.uint32(26).string(message.initial_balance); + } + if (message.shares_dst !== "") { + writer.uint32(34).string(message.shares_dst); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.creation_height = longToString(reader.int64() as Long); + break; + case 2: + message.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.initial_balance = reader.string(); + break; + case 4: + message.shares_dst = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RedelegationEntry { + return { + creation_height: isSet(object.creation_height) ? String(object.creation_height) : "0", + completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined, + initial_balance: isSet(object.initial_balance) ? String(object.initial_balance) : "", + shares_dst: isSet(object.shares_dst) ? String(object.shares_dst) : "", + }; + }, + + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + message.creation_height !== undefined && (obj.creation_height = message.creation_height); + message.completion_time !== undefined && (obj.completion_time = message.completion_time.toISOString()); + message.initial_balance !== undefined && (obj.initial_balance = message.initial_balance); + message.shares_dst !== undefined && (obj.shares_dst = message.shares_dst); + return obj; + }, + + fromPartial, I>>(object: I): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creation_height = object.creation_height ?? "0"; + message.completion_time = object.completion_time ?? undefined; + message.initial_balance = object.initial_balance ?? ""; + message.shares_dst = object.shares_dst ?? ""; + return message; + }, +}; + +function createBaseRedelegation(): Redelegation { + return { delegator_address: "", validator_src_address: "", validator_dst_address: "", entries: [] }; +} + +export const Redelegation = { + encode(message: Redelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_src_address !== "") { + writer.uint32(18).string(message.validator_src_address); + } + if (message.validator_dst_address !== "") { + writer.uint32(26).string(message.validator_dst_address); + } + for (const v of message.entries) { + RedelegationEntry.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_src_address = reader.string(); + break; + case 3: + message.validator_dst_address = reader.string(); + break; + case 4: + message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Redelegation { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_src_address: isSet(object.validator_src_address) ? String(object.validator_src_address) : "", + validator_dst_address: isSet(object.validator_dst_address) ? String(object.validator_dst_address) : "", + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) : [], + }; + }, + + toJSON(message: Redelegation): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_src_address !== undefined && (obj.validator_src_address = message.validator_src_address); + message.validator_dst_address !== undefined && (obj.validator_dst_address = message.validator_dst_address); + if (message.entries) { + obj.entries = message.entries.map((e) => e ? RedelegationEntry.toJSON(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Redelegation { + const message = createBaseRedelegation(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_src_address = object.validator_src_address ?? ""; + message.validator_dst_address = object.validator_dst_address ?? ""; + message.entries = object.entries?.map((e) => RedelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + unbonding_time: undefined, + max_validators: 0, + max_entries: 0, + historical_entries: 0, + bond_denom: "", + min_commission_rate: "", + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.unbonding_time !== undefined) { + Duration.encode(message.unbonding_time, writer.uint32(10).fork()).ldelim(); + } + if (message.max_validators !== 0) { + writer.uint32(16).uint32(message.max_validators); + } + if (message.max_entries !== 0) { + writer.uint32(24).uint32(message.max_entries); + } + if (message.historical_entries !== 0) { + writer.uint32(32).uint32(message.historical_entries); + } + if (message.bond_denom !== "") { + writer.uint32(42).string(message.bond_denom); + } + if (message.min_commission_rate !== "") { + writer.uint32(50).string(message.min_commission_rate); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.unbonding_time = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.max_validators = reader.uint32(); + break; + case 3: + message.max_entries = reader.uint32(); + break; + case 4: + message.historical_entries = reader.uint32(); + break; + case 5: + message.bond_denom = reader.string(); + break; + case 6: + message.min_commission_rate = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + unbonding_time: isSet(object.unbonding_time) ? Duration.fromJSON(object.unbonding_time) : undefined, + max_validators: isSet(object.max_validators) ? Number(object.max_validators) : 0, + max_entries: isSet(object.max_entries) ? Number(object.max_entries) : 0, + historical_entries: isSet(object.historical_entries) ? Number(object.historical_entries) : 0, + bond_denom: isSet(object.bond_denom) ? String(object.bond_denom) : "", + min_commission_rate: isSet(object.min_commission_rate) ? String(object.min_commission_rate) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.unbonding_time !== undefined && + (obj.unbonding_time = message.unbonding_time ? Duration.toJSON(message.unbonding_time) : undefined); + message.max_validators !== undefined && (obj.max_validators = Math.round(message.max_validators)); + message.max_entries !== undefined && (obj.max_entries = Math.round(message.max_entries)); + message.historical_entries !== undefined && (obj.historical_entries = Math.round(message.historical_entries)); + message.bond_denom !== undefined && (obj.bond_denom = message.bond_denom); + message.min_commission_rate !== undefined && (obj.min_commission_rate = message.min_commission_rate); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.unbonding_time = (object.unbonding_time !== undefined && object.unbonding_time !== null) + ? Duration.fromPartial(object.unbonding_time) + : undefined; + message.max_validators = object.max_validators ?? 0; + message.max_entries = object.max_entries ?? 0; + message.historical_entries = object.historical_entries ?? 0; + message.bond_denom = object.bond_denom ?? ""; + message.min_commission_rate = object.min_commission_rate ?? ""; + return message; + }, +}; + +function createBaseDelegationResponse(): DelegationResponse { + return { delegation: undefined, balance: undefined }; +} + +export const DelegationResponse = { + encode(message: DelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DelegationResponse { + return { + delegation: isSet(object.delegation) ? Delegation.fromJSON(object.delegation) : undefined, + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, + }; + }, + + toJSON(message: DelegationResponse): unknown { + const obj: any = {}; + message.delegation !== undefined && + (obj.delegation = message.delegation ? Delegation.toJSON(message.delegation) : undefined); + message.balance !== undefined && (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseRedelegationEntryResponse(): RedelegationEntryResponse { + return { redelegation_entry: undefined, balance: "" }; +} + +export const RedelegationEntryResponse = { + encode(message: RedelegationEntryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.redelegation_entry !== undefined) { + RedelegationEntry.encode(message.redelegation_entry, writer.uint32(10).fork()).ldelim(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.redelegation_entry = RedelegationEntry.decode(reader, reader.uint32()); + break; + case 4: + message.balance = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RedelegationEntryResponse { + return { + redelegation_entry: isSet(object.redelegation_entry) + ? RedelegationEntry.fromJSON(object.redelegation_entry) + : undefined, + balance: isSet(object.balance) ? String(object.balance) : "", + }; + }, + + toJSON(message: RedelegationEntryResponse): unknown { + const obj: any = {}; + message.redelegation_entry !== undefined && (obj.redelegation_entry = message.redelegation_entry + ? RedelegationEntry.toJSON(message.redelegation_entry) + : undefined); + message.balance !== undefined && (obj.balance = message.balance); + return obj; + }, + + fromPartial, I>>(object: I): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + message.redelegation_entry = (object.redelegation_entry !== undefined && object.redelegation_entry !== null) + ? RedelegationEntry.fromPartial(object.redelegation_entry) + : undefined; + message.balance = object.balance ?? ""; + return message; + }, +}; + +function createBaseRedelegationResponse(): RedelegationResponse { + return { redelegation: undefined, entries: [] }; +} + +export const RedelegationResponse = { + encode(message: RedelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): RedelegationResponse { + return { + redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined, + entries: Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RedelegationResponse): unknown { + const obj: any = {}; + message.redelegation !== undefined && + (obj.redelegation = message.redelegation ? Redelegation.toJSON(message.redelegation) : undefined); + if (message.entries) { + obj.entries = message.entries.map((e) => e ? RedelegationEntryResponse.toJSON(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBasePool(): Pool { + return { not_bonded_tokens: "", bonded_tokens: "" }; +} + +export const Pool = { + encode(message: Pool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.not_bonded_tokens !== "") { + writer.uint32(10).string(message.not_bonded_tokens); + } + if (message.bonded_tokens !== "") { + writer.uint32(18).string(message.bonded_tokens); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Pool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.not_bonded_tokens = reader.string(); + break; + case 2: + message.bonded_tokens = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Pool { + return { + not_bonded_tokens: isSet(object.not_bonded_tokens) ? String(object.not_bonded_tokens) : "", + bonded_tokens: isSet(object.bonded_tokens) ? String(object.bonded_tokens) : "", + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + message.not_bonded_tokens !== undefined && (obj.not_bonded_tokens = message.not_bonded_tokens); + message.bonded_tokens !== undefined && (obj.bonded_tokens = message.bonded_tokens); + return obj; + }, + + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.not_bonded_tokens = object.not_bonded_tokens ?? ""; + message.bonded_tokens = object.bonded_tokens ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/staking/v1beta1/tx.ts b/common/types/src/client/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 00000000..b38c9f5c --- /dev/null +++ b/common/types/src/client/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,818 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { CommissionRates, Description } from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidator { + description?: Description; + commission?: CommissionRates; + min_self_delegation: string; + delegator_address: string; + validator_address: string; + pubkey?: Any; + value?: Coin; +} + +/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ +export interface MsgCreateValidatorResponse { +} + +/** MsgEditValidator defines a SDK message for editing an existing validator. */ +export interface MsgEditValidator { + description?: Description; + 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; +} + +/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ +export interface MsgEditValidatorResponse { +} + +/** + * MsgDelegate defines a SDK message for performing a delegation of coins + * from a delegator to a validator. + */ +export interface MsgDelegate { + delegator_address: string; + validator_address: string; + amount?: Coin; +} + +/** MsgDelegateResponse defines the Msg/Delegate response type. */ +export interface MsgDelegateResponse { +} + +/** + * MsgBeginRedelegate defines a SDK message for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ +export interface MsgBeginRedelegate { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; + amount?: Coin; +} + +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponse { + completion_time?: Date; +} + +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegate { + delegator_address: string; + validator_address: string; + amount?: Coin; +} + +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponse { + completion_time?: Date; +} + +function createBaseMsgCreateValidator(): MsgCreateValidator { + return { + description: undefined, + commission: undefined, + min_self_delegation: "", + delegator_address: "", + validator_address: "", + pubkey: undefined, + value: undefined, + }; +} + +export const MsgCreateValidator = { + encode(message: MsgCreateValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.min_self_delegation !== "") { + writer.uint32(26).string(message.min_self_delegation); + } + if (message.delegator_address !== "") { + writer.uint32(34).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(42).string(message.validator_address); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(50).fork()).ldelim(); + } + if (message.value !== undefined) { + Coin.encode(message.value, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.min_self_delegation = reader.string(); + break; + case 4: + message.delegator_address = reader.string(); + break; + case 5: + message.validator_address = reader.string(); + break; + case 6: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 7: + message.value = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + commission: isSet(object.commission) ? CommissionRates.fromJSON(object.commission) : undefined, + min_self_delegation: isSet(object.min_self_delegation) ? String(object.min_self_delegation) : "", + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + pubkey: isSet(object.pubkey) ? Any.fromJSON(object.pubkey) : undefined, + value: isSet(object.value) ? Coin.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: MsgCreateValidator): unknown { + const obj: any = {}; + message.description !== undefined && + (obj.description = message.description ? Description.toJSON(message.description) : undefined); + message.commission !== undefined && + (obj.commission = message.commission ? CommissionRates.toJSON(message.commission) : undefined); + message.min_self_delegation !== undefined && (obj.min_self_delegation = message.min_self_delegation); + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.value !== undefined && (obj.value = message.value ? Coin.toJSON(message.value) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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.min_self_delegation = object.min_self_delegation ?? ""; + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.pubkey = (object.pubkey !== undefined && object.pubkey !== null) + ? Any.fromPartial(object.pubkey) + : undefined; + message.value = (object.value !== undefined && object.value !== null) ? Coin.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse { + return {}; +} + +export const MsgCreateValidatorResponse = { + encode(_: MsgCreateValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgCreateValidatorResponse { + return {}; + }, + + toJSON(_: MsgCreateValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, +}; + +function createBaseMsgEditValidator(): MsgEditValidator { + return { description: undefined, validator_address: "", commission_rate: "", min_self_delegation: "" }; +} + +export const MsgEditValidator = { + encode(message: MsgEditValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).ldelim(); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.commission_rate !== "") { + writer.uint32(26).string(message.commission_rate); + } + if (message.min_self_delegation !== "") { + writer.uint32(34).string(message.min_self_delegation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_address = reader.string(); + break; + case 3: + message.commission_rate = reader.string(); + break; + case 4: + message.min_self_delegation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgEditValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + commission_rate: isSet(object.commission_rate) ? String(object.commission_rate) : "", + min_self_delegation: isSet(object.min_self_delegation) ? String(object.min_self_delegation) : "", + }; + }, + + toJSON(message: MsgEditValidator): unknown { + const obj: any = {}; + message.description !== undefined && + (obj.description = message.description ? Description.toJSON(message.description) : undefined); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.commission_rate !== undefined && (obj.commission_rate = message.commission_rate); + message.min_self_delegation !== undefined && (obj.min_self_delegation = message.min_self_delegation); + return obj; + }, + + fromPartial, I>>(object: I): MsgEditValidator { + const message = createBaseMsgEditValidator(); + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.validator_address = object.validator_address ?? ""; + message.commission_rate = object.commission_rate ?? ""; + message.min_self_delegation = object.min_self_delegation ?? ""; + return message; + }, +}; + +function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { + return {}; +} + +export const MsgEditValidatorResponse = { + encode(_: MsgEditValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgEditValidatorResponse { + return {}; + }, + + toJSON(_: MsgEditValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, +}; + +function createBaseMsgDelegate(): MsgDelegate { + return { delegator_address: "", validator_address: "", amount: undefined }; +} + +export const MsgDelegate = { + encode(message: MsgDelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDelegate { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgDelegate { + const message = createBaseMsgDelegate(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} + +export const MsgDelegateResponse = { + encode(_: MsgDelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgDelegateResponse { + return {}; + }, + + toJSON(_: MsgDelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; + +function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { + return { delegator_address: "", validator_src_address: "", validator_dst_address: "", amount: undefined }; +} + +export const MsgBeginRedelegate = { + encode(message: MsgBeginRedelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_src_address !== "") { + writer.uint32(18).string(message.validator_src_address); + } + if (message.validator_dst_address !== "") { + writer.uint32(26).string(message.validator_dst_address); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_src_address = reader.string(); + break; + case 3: + message.validator_dst_address = reader.string(); + break; + case 4: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegate { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_src_address: isSet(object.validator_src_address) ? String(object.validator_src_address) : "", + validator_dst_address: isSet(object.validator_dst_address) ? String(object.validator_dst_address) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgBeginRedelegate): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_src_address !== undefined && (obj.validator_src_address = message.validator_src_address); + message.validator_dst_address !== undefined && (obj.validator_dst_address = message.validator_dst_address); + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_src_address = object.validator_src_address ?? ""; + message.validator_dst_address = object.validator_dst_address ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { + return { completion_time: undefined }; +} + +export const MsgBeginRedelegateResponse = { + encode(message: MsgBeginRedelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegateResponse { + return { completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined }; + }, + + toJSON(message: MsgBeginRedelegateResponse): unknown { + const obj: any = {}; + message.completion_time !== undefined && (obj.completion_time = message.completion_time.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + message.completion_time = object.completion_time ?? undefined; + return message; + }, +}; + +function createBaseMsgUndelegate(): MsgUndelegate { + return { delegator_address: "", validator_address: "", amount: undefined }; +} + +export const MsgUndelegate = { + encode(message: MsgUndelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUndelegate { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return { completion_time: undefined }; +} + +export const MsgUndelegateResponse = { + encode(message: MsgUndelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUndelegateResponse { + return { completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined }; + }, + + toJSON(message: MsgUndelegateResponse): unknown { + const obj: any = {}; + message.completion_time !== undefined && (obj.completion_time = message.completion_time.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + message.completion_time = object.completion_time ?? undefined; + return message; + }, +}; + +/** Msg defines the staking Msg service. */ +export interface Msg { + /** CreateValidator defines a method for creating a new validator. */ + CreateValidator(request: MsgCreateValidator): Promise; + /** EditValidator defines a method for editing an existing validator. */ + EditValidator(request: MsgEditValidator): Promise; + /** + * Delegate defines a method for performing a delegation of coins + * from a delegator to a validator. + */ + Delegate(request: MsgDelegate): Promise; + /** + * BeginRedelegate defines a method for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ + BeginRedelegate(request: MsgBeginRedelegate): Promise; + /** + * Undelegate defines a method for performing an undelegation from a + * delegate and a validator. + */ + Undelegate(request: MsgUndelegate): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.staking.v1beta1.Msg"; + this.rpc = rpc; + this.CreateValidator = this.CreateValidator.bind(this); + this.EditValidator = this.EditValidator.bind(this); + this.Delegate = this.Delegate.bind(this); + this.BeginRedelegate = this.BeginRedelegate.bind(this); + this.Undelegate = this.Undelegate.bind(this); + } + CreateValidator(request: MsgCreateValidator): Promise { + const data = MsgCreateValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateValidator", data); + return promise.then((data) => MsgCreateValidatorResponse.decode(new _m0.Reader(data))); + } + + EditValidator(request: MsgEditValidator): Promise { + const data = MsgEditValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "EditValidator", data); + return promise.then((data) => MsgEditValidatorResponse.decode(new _m0.Reader(data))); + } + + Delegate(request: MsgDelegate): Promise { + const data = MsgDelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "Delegate", data); + return promise.then((data) => MsgDelegateResponse.decode(new _m0.Reader(data))); + } + + BeginRedelegate(request: MsgBeginRedelegate): Promise { + const data = MsgBeginRedelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "BeginRedelegate", data); + return promise.then((data) => MsgBeginRedelegateResponse.decode(new _m0.Reader(data))); + } + + Undelegate(request: MsgUndelegate): Promise { + const data = MsgUndelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "Undelegate", data); + return promise.then((data) => MsgUndelegateResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/tx/signing/v1beta1/signing.ts b/common/types/src/client/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 00000000..37bf2ff5 --- /dev/null +++ b/common/types/src/client/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,532 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../../google/protobuf/any"; +import { CompactBitArray } from "../../../crypto/multisig/v1beta1/multisig"; + +export const protobufPackage = "cosmos.tx.signing.v1beta1"; + +/** + * 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. It is currently not supported. + */ + 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`. It also allows + * for adding Tips in transactions. + * + * 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, + UNRECOGNIZED = -1, +} + +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 -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.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} + +/** + * 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 */ + public_key?: 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: string; +} + +/** Data represents signature data */ +export interface SignatureDescriptor_Data { + /** single represents a single signer */ + single?: + | SignatureDescriptor_Data_Single + | undefined; + /** multi represents a multisig signer */ + multi?: SignatureDescriptor_Data_Multi | undefined; +} + +/** 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; +} + +/** 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[]; +} + +function createBaseSignatureDescriptors(): SignatureDescriptors { + return { signatures: [] }; +} + +export const SignatureDescriptors = { + encode(message: SignatureDescriptors, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.signatures) { + SignatureDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SignatureDescriptors { + return { + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptors): unknown { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => e ? SignatureDescriptor.toJSON(e) : undefined); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map((e) => SignatureDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSignatureDescriptor(): SignatureDescriptor { + return { public_key: undefined, data: undefined, sequence: "0" }; +} + +export const SignatureDescriptor = { + encode(message: SignatureDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.public_key !== undefined) { + Any.encode(message.public_key, writer.uint32(10).fork()).ldelim(); + } + if (message.data !== undefined) { + SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim(); + } + if (message.sequence !== "0") { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.public_key = Any.decode(reader, reader.uint32()); + break; + case 2: + message.data = SignatureDescriptor_Data.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor { + return { + public_key: isSet(object.public_key) ? Any.fromJSON(object.public_key) : undefined, + data: isSet(object.data) ? SignatureDescriptor_Data.fromJSON(object.data) : undefined, + sequence: isSet(object.sequence) ? String(object.sequence) : "0", + }; + }, + + toJSON(message: SignatureDescriptor): unknown { + const obj: any = {}; + message.public_key !== undefined && + (obj.public_key = message.public_key ? Any.toJSON(message.public_key) : undefined); + message.data !== undefined && (obj.data = message.data ? SignatureDescriptor_Data.toJSON(message.data) : undefined); + message.sequence !== undefined && (obj.sequence = message.sequence); + return obj; + }, + + fromPartial, I>>(object: I): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + message.public_key = (object.public_key !== undefined && object.public_key !== null) + ? Any.fromPartial(object.public_key) + : undefined; + message.data = (object.data !== undefined && object.data !== null) + ? SignatureDescriptor_Data.fromPartial(object.data) + : undefined; + message.sequence = object.sequence ?? "0"; + return message; + }, +}; + +function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { + return { single: undefined, multi: undefined }; +} + +export const SignatureDescriptor_Data = { + encode(message: SignatureDescriptor_Data, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SignatureDescriptor_Data { + return { + single: isSet(object.single) ? SignatureDescriptor_Data_Single.fromJSON(object.single) : undefined, + multi: isSet(object.multi) ? SignatureDescriptor_Data_Multi.fromJSON(object.multi) : undefined, + }; + }, + + toJSON(message: SignatureDescriptor_Data): unknown { + const obj: any = {}; + message.single !== undefined && + (obj.single = message.single ? SignatureDescriptor_Data_Single.toJSON(message.single) : undefined); + message.multi !== undefined && + (obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toJSON(message.multi) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseSignatureDescriptor_Data_Single(): SignatureDescriptor_Data_Single { + return { mode: 0, signature: new Uint8Array() }; +} + +export const SignatureDescriptor_Data_Single = { + encode(message: SignatureDescriptor_Data_Single, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SignatureDescriptor_Data_Single { + return { + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + }; + }, + + toJSON(message: SignatureDescriptor_Data_Single): unknown { + const obj: any = {}; + message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + + fromPartial, I>>( + object: I, + ): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + message.mode = object.mode ?? 0; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; + +function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { + return { bitarray: undefined, signatures: [] }; +} + +export const SignatureDescriptor_Data_Multi = { + encode(message: SignatureDescriptor_Data_Multi, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SignatureDescriptor_Data_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptor_Data_Multi): unknown { + const obj: any = {}; + message.bitarray !== undefined && + (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => e ? SignatureDescriptor_Data.toJSON(e) : undefined); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): 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; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/tx/v1beta1/service.ts b/common/types/src/client/cosmos/tx/v1beta1/service.ts new file mode 100644 index 00000000..7efc5371 --- /dev/null +++ b/common/types/src/client/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,1002 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Block } from "../../../tendermint/types/block"; +import { BlockID } from "../../../tendermint/types/types"; +import { GasInfo, Result, TxResponse } from "../../base/abci/v1beta1/abci"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Tx } from "./tx"; + +export const protobufPackage = "cosmos.tx.v1beta1"; + +/** 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 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 - BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for + * the tx to be committed in a block. + */ + 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 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. */ + events: string[]; + /** pagination defines a pagination for the request. */ + pagination?: PageRequest; + order_by: OrderBy; +} + +/** + * 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. */ + tx_responses: TxResponse[]; + /** pagination defines a pagination for the response. */ + pagination?: PageResponse; +} + +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequest { + /** tx_bytes is the raw transaction. */ + tx_bytes: Uint8Array; + mode: BroadcastMode; +} + +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponse { + /** tx_response is the queried TxResponses. */ + tx_response?: TxResponse; +} + +/** + * 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 + */ + tx_bytes: Uint8Array; +} + +/** + * SimulateResponse is the response type for the + * Service.SimulateRPC method. + */ +export interface SimulateResponse { + /** gas_info is the information about gas used in the simulation. */ + gas_info?: GasInfo; + /** result is the result of the simulation. */ + result?: Result; +} + +/** + * 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; +} + +/** 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. */ + tx_response?: TxResponse; +} + +/** + * 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: string; + /** pagination defines a pagination for the request. */ + pagination?: PageRequest; +} + +/** + * 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[]; + block_id?: BlockID; + block?: Block; + /** pagination defines a pagination for the response. */ + pagination?: PageResponse; +} + +function createBaseGetTxsEventRequest(): GetTxsEventRequest { + return { events: [], pagination: undefined, order_by: 0 }; +} + +export const GetTxsEventRequest = { + encode(message: GetTxsEventRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.order_by !== 0) { + writer.uint32(24).int32(message.order_by); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.order_by = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetTxsEventRequest { + return { + events: Array.isArray(object?.events) ? object.events.map((e: any) => String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + order_by: isSet(object.order_by) ? orderByFromJSON(object.order_by) : 0, + }; + }, + + toJSON(message: GetTxsEventRequest): unknown { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map((e) => e); + } else { + obj.events = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.order_by !== undefined && (obj.order_by = orderByToJSON(message.order_by)); + return obj; + }, + + fromPartial, I>>(object: I): 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.order_by = object.order_by ?? 0; + return message; + }, +}; + +function createBaseGetTxsEventResponse(): GetTxsEventResponse { + return { txs: [], tx_responses: [], pagination: undefined }; +} + +export const GetTxsEventResponse = { + encode(message: GetTxsEventResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.tx_responses) { + TxResponse.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.tx_responses.push(TxResponse.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetTxsEventResponse { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + tx_responses: Array.isArray(object?.tx_responses) + ? object.tx_responses.map((e: any) => TxResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetTxsEventResponse): unknown { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => e ? Tx.toJSON(e) : undefined); + } else { + obj.txs = []; + } + if (message.tx_responses) { + obj.tx_responses = message.tx_responses.map((e) => e ? TxResponse.toJSON(e) : undefined); + } else { + obj.tx_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.tx_responses = object.tx_responses?.map((e) => TxResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseBroadcastTxRequest(): BroadcastTxRequest { + return { tx_bytes: new Uint8Array(), mode: 0 }; +} + +export const BroadcastTxRequest = { + encode(message: BroadcastTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx_bytes.length !== 0) { + writer.uint32(10).bytes(message.tx_bytes); + } + if (message.mode !== 0) { + writer.uint32(16).int32(message.mode); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.tx_bytes = reader.bytes(); + break; + case 2: + message.mode = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BroadcastTxRequest { + return { + tx_bytes: isSet(object.tx_bytes) ? bytesFromBase64(object.tx_bytes) : new Uint8Array(), + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0, + }; + }, + + toJSON(message: BroadcastTxRequest): unknown { + const obj: any = {}; + message.tx_bytes !== undefined && + (obj.tx_bytes = base64FromBytes(message.tx_bytes !== undefined ? message.tx_bytes : new Uint8Array())); + message.mode !== undefined && (obj.mode = broadcastModeToJSON(message.mode)); + return obj; + }, + + fromPartial, I>>(object: I): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + message.tx_bytes = object.tx_bytes ?? new Uint8Array(); + message.mode = object.mode ?? 0; + return message; + }, +}; + +function createBaseBroadcastTxResponse(): BroadcastTxResponse { + return { tx_response: undefined }; +} + +export const BroadcastTxResponse = { + encode(message: BroadcastTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx_response !== undefined) { + TxResponse.encode(message.tx_response, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.tx_response = TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BroadcastTxResponse { + return { tx_response: isSet(object.tx_response) ? TxResponse.fromJSON(object.tx_response) : undefined }; + }, + + toJSON(message: BroadcastTxResponse): unknown { + const obj: any = {}; + message.tx_response !== undefined && + (obj.tx_response = message.tx_response ? TxResponse.toJSON(message.tx_response) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + message.tx_response = (object.tx_response !== undefined && object.tx_response !== null) + ? TxResponse.fromPartial(object.tx_response) + : undefined; + return message; + }, +}; + +function createBaseSimulateRequest(): SimulateRequest { + return { tx: undefined, tx_bytes: new Uint8Array() }; +} + +export const SimulateRequest = { + encode(message: SimulateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + if (message.tx_bytes.length !== 0) { + writer.uint32(18).bytes(message.tx_bytes); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.tx_bytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SimulateRequest { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + tx_bytes: isSet(object.tx_bytes) ? bytesFromBase64(object.tx_bytes) : new Uint8Array(), + }; + }, + + toJSON(message: SimulateRequest): unknown { + const obj: any = {}; + message.tx !== undefined && (obj.tx = message.tx ? Tx.toJSON(message.tx) : undefined); + message.tx_bytes !== undefined && + (obj.tx_bytes = base64FromBytes(message.tx_bytes !== undefined ? message.tx_bytes : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): SimulateRequest { + const message = createBaseSimulateRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.tx_bytes = object.tx_bytes ?? new Uint8Array(); + return message; + }, +}; + +function createBaseSimulateResponse(): SimulateResponse { + return { gas_info: undefined, result: undefined }; +} + +export const SimulateResponse = { + encode(message: SimulateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.gas_info !== undefined) { + GasInfo.encode(message.gas_info, writer.uint32(10).fork()).ldelim(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.gas_info = GasInfo.decode(reader, reader.uint32()); + break; + case 2: + message.result = Result.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SimulateResponse { + return { + gas_info: isSet(object.gas_info) ? GasInfo.fromJSON(object.gas_info) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulateResponse): unknown { + const obj: any = {}; + message.gas_info !== undefined && (obj.gas_info = message.gas_info ? GasInfo.toJSON(message.gas_info) : undefined); + message.result !== undefined && (obj.result = message.result ? Result.toJSON(message.result) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): SimulateResponse { + const message = createBaseSimulateResponse(); + message.gas_info = (object.gas_info !== undefined && object.gas_info !== null) + ? GasInfo.fromPartial(object.gas_info) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseGetTxRequest(): GetTxRequest { + return { hash: "" }; +} + +export const GetTxRequest = { + encode(message: GetTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): GetTxRequest { + return { hash: isSet(object.hash) ? String(object.hash) : "" }; + }, + + toJSON(message: GetTxRequest): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = message.hash); + return obj; + }, + + fromPartial, I>>(object: I): GetTxRequest { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseGetTxResponse(): GetTxResponse { + return { tx: undefined, tx_response: undefined }; +} + +export const GetTxResponse = { + encode(message: GetTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + if (message.tx_response !== undefined) { + TxResponse.encode(message.tx_response, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.tx_response = TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetTxResponse { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + tx_response: isSet(object.tx_response) ? TxResponse.fromJSON(object.tx_response) : undefined, + }; + }, + + toJSON(message: GetTxResponse): unknown { + const obj: any = {}; + message.tx !== undefined && (obj.tx = message.tx ? Tx.toJSON(message.tx) : undefined); + message.tx_response !== undefined && + (obj.tx_response = message.tx_response ? TxResponse.toJSON(message.tx_response) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetTxResponse { + const message = createBaseGetTxResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.tx_response = (object.tx_response !== undefined && object.tx_response !== null) + ? TxResponse.fromPartial(object.tx_response) + : undefined; + return message; + }, +}; + +function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { + return { height: "0", pagination: undefined }; +} + +export const GetBlockWithTxsRequest = { + encode(message: GetBlockWithTxsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsRequest { + return { + height: isSet(object.height) ? String(object.height) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsRequest): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetBlockWithTxsRequest { + const message = createBaseGetBlockWithTxsRequest(); + message.height = object.height ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { + return { txs: [], block_id: undefined, block: undefined, pagination: undefined }; +} + +export const GetBlockWithTxsResponse = { + encode(message: GetBlockWithTxsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, 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: _m0.Reader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.block_id = 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; + }, + + fromJSON(object: any): GetBlockWithTxsResponse { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsResponse): unknown { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => e ? Tx.toJSON(e) : undefined); + } else { + obj.txs = []; + } + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.block !== undefined && (obj.block = message.block ? Block.toJSON(message.block) : undefined); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : 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; + }, +}; + +/** Service defines a gRPC service for interacting with transactions. */ +export interface Service { + /** Simulate simulates executing a transaction for estimating gas usage. */ + Simulate(request: SimulateRequest): Promise; + /** GetTx fetches a tx by hash. */ + GetTx(request: GetTxRequest): Promise; + /** BroadcastTx broadcast transaction. */ + BroadcastTx(request: BroadcastTxRequest): Promise; + /** GetTxsEvent fetches txs by event. */ + GetTxsEvent(request: GetTxsEventRequest): Promise; + /** + * GetBlockWithTxs fetches a block with decoded txs. + * + * Since: cosmos-sdk 0.45.2 + */ + GetBlockWithTxs(request: GetBlockWithTxsRequest): Promise; +} + +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.tx.v1beta1.Service"; + this.rpc = rpc; + this.Simulate = this.Simulate.bind(this); + this.GetTx = this.GetTx.bind(this); + this.BroadcastTx = this.BroadcastTx.bind(this); + this.GetTxsEvent = this.GetTxsEvent.bind(this); + this.GetBlockWithTxs = this.GetBlockWithTxs.bind(this); + } + Simulate(request: SimulateRequest): Promise { + const data = SimulateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Simulate", data); + return promise.then((data) => SimulateResponse.decode(new _m0.Reader(data))); + } + + GetTx(request: GetTxRequest): Promise { + const data = GetTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetTx", data); + return promise.then((data) => GetTxResponse.decode(new _m0.Reader(data))); + } + + BroadcastTx(request: BroadcastTxRequest): Promise { + const data = BroadcastTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "BroadcastTx", data); + return promise.then((data) => BroadcastTxResponse.decode(new _m0.Reader(data))); + } + + GetTxsEvent(request: GetTxsEventRequest): Promise { + const data = GetTxsEventRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetTxsEvent", data); + return promise.then((data) => GetTxsEventResponse.decode(new _m0.Reader(data))); + } + + GetBlockWithTxs(request: GetBlockWithTxsRequest): Promise { + const data = GetBlockWithTxsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetBlockWithTxs", data); + return promise.then((data) => GetBlockWithTxsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/tx/v1beta1/tx.ts b/common/types/src/client/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 00000000..b98d602d --- /dev/null +++ b/common/types/src/client/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,1338 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Coin } from "../../base/v1beta1/coin"; +import { CompactBitArray } from "../../crypto/multisig/v1beta1/multisig"; +import { SignMode, signModeFromJSON, signModeToJSON } from "../signing/v1beta1/signing"; + +export const protobufPackage = "cosmos.tx.v1beta1"; + +/** 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 + */ + auth_info?: 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[]; +} + +/** + * 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. + */ + body_bytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + auth_info_bytes: 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[]; +} + +/** 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. + */ + body_bytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + auth_info_bytes: 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 + */ + chain_id: string; + /** account_number is the account number of the account in state */ + account_number: string; +} + +/** + * 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. + */ + body_bytes: Uint8Array; + /** public_key is the public key of the signing account. */ + public_key?: 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. + */ + 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; + /** + * Tip is the optional tip used for meta-transactions. It should be left + * empty if the signer is not the tipper for this transaction. + */ + tip?: Tip; +} + +/** 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 + */ + 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: 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 + */ + non_critical_extension_options: Any[]; +} + +/** + * 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. + */ + signer_infos: 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 meta-transactions. + * + * Since: cosmos-sdk 0.46 + */ + tip?: Tip; +} + +/** + * 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. + */ + public_key?: Any; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + mode_info?: 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: string; +} + +/** ModeInfo describes the signing mode of a single or nested multisig signer. */ +export interface ModeInfo { + /** single represents a single signer */ + single?: + | ModeInfo_Single + | undefined; + /** multi represents a nested multisig signer */ + multi?: ModeInfo_Multi | undefined; +} + +/** + * 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; +} + +/** 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 + */ + mode_infos: ModeInfo[]; +} + +/** + * 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 + */ + 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; +} + +/** + * Tip is the tip used for meta-transactions. + * + * Since: cosmos-sdk 0.46 + */ +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; +} + +/** + * 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_MOD_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?: SignDocDirectAux; + /** mode is the signing mode of the single signer */ + mode: SignMode; + /** sig is the signature of the sign doc. */ + sig: Uint8Array; +} + +function createBaseTx(): Tx { + return { body: undefined, auth_info: undefined, signatures: [] }; +} + +export const Tx = { + encode(message: Tx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.body !== undefined) { + TxBody.encode(message.body, writer.uint32(10).fork()).ldelim(); + } + if (message.auth_info !== undefined) { + AuthInfo.encode(message.auth_info, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Tx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.auth_info = AuthInfo.decode(reader, reader.uint32()); + break; + case 3: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Tx { + return { + body: isSet(object.body) ? TxBody.fromJSON(object.body) : undefined, + auth_info: isSet(object.auth_info) ? AuthInfo.fromJSON(object.auth_info) : undefined, + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Tx): unknown { + const obj: any = {}; + message.body !== undefined && (obj.body = message.body ? TxBody.toJSON(message.body) : undefined); + message.auth_info !== undefined && + (obj.auth_info = message.auth_info ? AuthInfo.toJSON(message.auth_info) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Tx { + const message = createBaseTx(); + message.body = (object.body !== undefined && object.body !== null) ? TxBody.fromPartial(object.body) : undefined; + message.auth_info = (object.auth_info !== undefined && object.auth_info !== null) + ? AuthInfo.fromPartial(object.auth_info) + : undefined; + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTxRaw(): TxRaw { + return { body_bytes: new Uint8Array(), auth_info_bytes: new Uint8Array(), signatures: [] }; +} + +export const TxRaw = { + encode(message: TxRaw, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.body_bytes.length !== 0) { + writer.uint32(10).bytes(message.body_bytes); + } + if (message.auth_info_bytes.length !== 0) { + writer.uint32(18).bytes(message.auth_info_bytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.body_bytes = reader.bytes(); + break; + case 2: + message.auth_info_bytes = reader.bytes(); + break; + case 3: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TxRaw { + return { + body_bytes: isSet(object.body_bytes) ? bytesFromBase64(object.body_bytes) : new Uint8Array(), + auth_info_bytes: isSet(object.auth_info_bytes) ? bytesFromBase64(object.auth_info_bytes) : new Uint8Array(), + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: TxRaw): unknown { + const obj: any = {}; + message.body_bytes !== undefined && + (obj.body_bytes = base64FromBytes(message.body_bytes !== undefined ? message.body_bytes : new Uint8Array())); + message.auth_info_bytes !== undefined && + (obj.auth_info_bytes = base64FromBytes( + message.auth_info_bytes !== undefined ? message.auth_info_bytes : new Uint8Array(), + )); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): TxRaw { + const message = createBaseTxRaw(); + message.body_bytes = object.body_bytes ?? new Uint8Array(); + message.auth_info_bytes = object.auth_info_bytes ?? new Uint8Array(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSignDoc(): SignDoc { + return { body_bytes: new Uint8Array(), auth_info_bytes: new Uint8Array(), chain_id: "", account_number: "0" }; +} + +export const SignDoc = { + encode(message: SignDoc, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.body_bytes.length !== 0) { + writer.uint32(10).bytes(message.body_bytes); + } + if (message.auth_info_bytes.length !== 0) { + writer.uint32(18).bytes(message.auth_info_bytes); + } + if (message.chain_id !== "") { + writer.uint32(26).string(message.chain_id); + } + if (message.account_number !== "0") { + writer.uint32(32).uint64(message.account_number); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.body_bytes = reader.bytes(); + break; + case 2: + message.auth_info_bytes = reader.bytes(); + break; + case 3: + message.chain_id = reader.string(); + break; + case 4: + message.account_number = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SignDoc { + return { + body_bytes: isSet(object.body_bytes) ? bytesFromBase64(object.body_bytes) : new Uint8Array(), + auth_info_bytes: isSet(object.auth_info_bytes) ? bytesFromBase64(object.auth_info_bytes) : new Uint8Array(), + chain_id: isSet(object.chain_id) ? String(object.chain_id) : "", + account_number: isSet(object.account_number) ? String(object.account_number) : "0", + }; + }, + + toJSON(message: SignDoc): unknown { + const obj: any = {}; + message.body_bytes !== undefined && + (obj.body_bytes = base64FromBytes(message.body_bytes !== undefined ? message.body_bytes : new Uint8Array())); + message.auth_info_bytes !== undefined && + (obj.auth_info_bytes = base64FromBytes( + message.auth_info_bytes !== undefined ? message.auth_info_bytes : new Uint8Array(), + )); + message.chain_id !== undefined && (obj.chain_id = message.chain_id); + message.account_number !== undefined && (obj.account_number = message.account_number); + return obj; + }, + + fromPartial, I>>(object: I): SignDoc { + const message = createBaseSignDoc(); + message.body_bytes = object.body_bytes ?? new Uint8Array(); + message.auth_info_bytes = object.auth_info_bytes ?? new Uint8Array(); + message.chain_id = object.chain_id ?? ""; + message.account_number = object.account_number ?? "0"; + return message; + }, +}; + +function createBaseSignDocDirectAux(): SignDocDirectAux { + return { + body_bytes: new Uint8Array(), + public_key: undefined, + chain_id: "", + account_number: "0", + sequence: "0", + tip: undefined, + }; +} + +export const SignDocDirectAux = { + encode(message: SignDocDirectAux, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.body_bytes.length !== 0) { + writer.uint32(10).bytes(message.body_bytes); + } + if (message.public_key !== undefined) { + Any.encode(message.public_key, writer.uint32(18).fork()).ldelim(); + } + if (message.chain_id !== "") { + writer.uint32(26).string(message.chain_id); + } + if (message.account_number !== "0") { + writer.uint32(32).uint64(message.account_number); + } + if (message.sequence !== "0") { + writer.uint32(40).uint64(message.sequence); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignDocDirectAux { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.body_bytes = reader.bytes(); + break; + case 2: + message.public_key = Any.decode(reader, reader.uint32()); + break; + case 3: + message.chain_id = reader.string(); + break; + case 4: + message.account_number = longToString(reader.uint64() as Long); + break; + case 5: + message.sequence = longToString(reader.uint64() as Long); + break; + case 6: + message.tip = Tip.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SignDocDirectAux { + return { + body_bytes: isSet(object.body_bytes) ? bytesFromBase64(object.body_bytes) : new Uint8Array(), + public_key: isSet(object.public_key) ? Any.fromJSON(object.public_key) : undefined, + chain_id: isSet(object.chain_id) ? String(object.chain_id) : "", + account_number: isSet(object.account_number) ? String(object.account_number) : "0", + sequence: isSet(object.sequence) ? String(object.sequence) : "0", + tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined, + }; + }, + + toJSON(message: SignDocDirectAux): unknown { + const obj: any = {}; + message.body_bytes !== undefined && + (obj.body_bytes = base64FromBytes(message.body_bytes !== undefined ? message.body_bytes : new Uint8Array())); + message.public_key !== undefined && + (obj.public_key = message.public_key ? Any.toJSON(message.public_key) : undefined); + message.chain_id !== undefined && (obj.chain_id = message.chain_id); + message.account_number !== undefined && (obj.account_number = message.account_number); + message.sequence !== undefined && (obj.sequence = message.sequence); + message.tip !== undefined && (obj.tip = message.tip ? Tip.toJSON(message.tip) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + message.body_bytes = object.body_bytes ?? new Uint8Array(); + message.public_key = (object.public_key !== undefined && object.public_key !== null) + ? Any.fromPartial(object.public_key) + : undefined; + message.chain_id = object.chain_id ?? ""; + message.account_number = object.account_number ?? "0"; + message.sequence = object.sequence ?? "0"; + message.tip = (object.tip !== undefined && object.tip !== null) ? Tip.fromPartial(object.tip) : undefined; + return message; + }, +}; + +function createBaseTxBody(): TxBody { + return { messages: [], memo: "", timeout_height: "0", extension_options: [], non_critical_extension_options: [] }; +} + +export const TxBody = { + encode(message: TxBody, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.timeout_height !== "0") { + writer.uint32(24).uint64(message.timeout_height); + } + for (const v of message.extension_options) { + Any.encode(v!, writer.uint32(8186).fork()).ldelim(); + } + for (const v of message.non_critical_extension_options) { + Any.encode(v!, writer.uint32(16378).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxBody { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.timeout_height = longToString(reader.uint64() as Long); + break; + case 1023: + message.extension_options.push(Any.decode(reader, reader.uint32())); + break; + case 2047: + message.non_critical_extension_options.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TxBody { + return { + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + memo: isSet(object.memo) ? String(object.memo) : "", + timeout_height: isSet(object.timeout_height) ? String(object.timeout_height) : "0", + extension_options: Array.isArray(object?.extension_options) + ? object.extension_options.map((e: any) => Any.fromJSON(e)) + : [], + non_critical_extension_options: Array.isArray(object?.non_critical_extension_options) + ? object.non_critical_extension_options.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxBody): unknown { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + message.memo !== undefined && (obj.memo = message.memo); + message.timeout_height !== undefined && (obj.timeout_height = message.timeout_height); + if (message.extension_options) { + obj.extension_options = message.extension_options.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.extension_options = []; + } + if (message.non_critical_extension_options) { + obj.non_critical_extension_options = message.non_critical_extension_options.map((e) => + e ? Any.toJSON(e) : undefined + ); + } else { + obj.non_critical_extension_options = []; + } + return obj; + }, + + fromPartial, I>>(object: I): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeout_height = object.timeout_height ?? "0"; + message.extension_options = object.extension_options?.map((e) => Any.fromPartial(e)) || []; + message.non_critical_extension_options = object.non_critical_extension_options?.map((e) => Any.fromPartial(e)) || + []; + return message; + }, +}; + +function createBaseAuthInfo(): AuthInfo { + return { signer_infos: [], fee: undefined, tip: undefined }; +} + +export const AuthInfo = { + encode(message: AuthInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.signer_infos) { + 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: _m0.Reader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.signer_infos.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; + }, + + fromJSON(object: any): AuthInfo { + return { + signer_infos: Array.isArray(object?.signer_infos) + ? object.signer_infos.map((e: any) => SignerInfo.fromJSON(e)) + : [], + fee: isSet(object.fee) ? Fee.fromJSON(object.fee) : undefined, + tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined, + }; + }, + + toJSON(message: AuthInfo): unknown { + const obj: any = {}; + if (message.signer_infos) { + obj.signer_infos = message.signer_infos.map((e) => e ? SignerInfo.toJSON(e) : undefined); + } else { + obj.signer_infos = []; + } + message.fee !== undefined && (obj.fee = message.fee ? Fee.toJSON(message.fee) : undefined); + message.tip !== undefined && (obj.tip = message.tip ? Tip.toJSON(message.tip) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): AuthInfo { + const message = createBaseAuthInfo(); + message.signer_infos = object.signer_infos?.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; + }, +}; + +function createBaseSignerInfo(): SignerInfo { + return { public_key: undefined, mode_info: undefined, sequence: "0" }; +} + +export const SignerInfo = { + encode(message: SignerInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.public_key !== undefined) { + Any.encode(message.public_key, writer.uint32(10).fork()).ldelim(); + } + if (message.mode_info !== undefined) { + ModeInfo.encode(message.mode_info, writer.uint32(18).fork()).ldelim(); + } + if (message.sequence !== "0") { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.public_key = Any.decode(reader, reader.uint32()); + break; + case 2: + message.mode_info = ModeInfo.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SignerInfo { + return { + public_key: isSet(object.public_key) ? Any.fromJSON(object.public_key) : undefined, + mode_info: isSet(object.mode_info) ? ModeInfo.fromJSON(object.mode_info) : undefined, + sequence: isSet(object.sequence) ? String(object.sequence) : "0", + }; + }, + + toJSON(message: SignerInfo): unknown { + const obj: any = {}; + message.public_key !== undefined && + (obj.public_key = message.public_key ? Any.toJSON(message.public_key) : undefined); + message.mode_info !== undefined && + (obj.mode_info = message.mode_info ? ModeInfo.toJSON(message.mode_info) : undefined); + message.sequence !== undefined && (obj.sequence = message.sequence); + return obj; + }, + + fromPartial, I>>(object: I): SignerInfo { + const message = createBaseSignerInfo(); + message.public_key = (object.public_key !== undefined && object.public_key !== null) + ? Any.fromPartial(object.public_key) + : undefined; + message.mode_info = (object.mode_info !== undefined && object.mode_info !== null) + ? ModeInfo.fromPartial(object.mode_info) + : undefined; + message.sequence = object.sequence ?? "0"; + return message; + }, +}; + +function createBaseModeInfo(): ModeInfo { + return { single: undefined, multi: undefined }; +} + +export const ModeInfo = { + encode(message: ModeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ModeInfo { + return { + single: isSet(object.single) ? ModeInfo_Single.fromJSON(object.single) : undefined, + multi: isSet(object.multi) ? ModeInfo_Multi.fromJSON(object.multi) : undefined, + }; + }, + + toJSON(message: ModeInfo): unknown { + const obj: any = {}; + message.single !== undefined && (obj.single = message.single ? ModeInfo_Single.toJSON(message.single) : undefined); + message.multi !== undefined && (obj.multi = message.multi ? ModeInfo_Multi.toJSON(message.multi) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseModeInfo_Single(): ModeInfo_Single { + return { mode: 0 }; +} + +export const ModeInfo_Single = { + encode(message: ModeInfo_Single, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo_Single { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ModeInfo_Single { + return { mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 }; + }, + + toJSON(message: ModeInfo_Single): unknown { + const obj: any = {}; + message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); + return obj; + }, + + fromPartial, I>>(object: I): ModeInfo_Single { + const message = createBaseModeInfo_Single(); + message.mode = object.mode ?? 0; + return message; + }, +}; + +function createBaseModeInfo_Multi(): ModeInfo_Multi { + return { bitarray: undefined, mode_infos: [] }; +} + +export const ModeInfo_Multi = { + encode(message: ModeInfo_Multi, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.mode_infos) { + ModeInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo_Multi { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.mode_infos.push(ModeInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModeInfo_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + mode_infos: Array.isArray(object?.mode_infos) ? object.mode_infos.map((e: any) => ModeInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: ModeInfo_Multi): unknown { + const obj: any = {}; + message.bitarray !== undefined && + (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); + if (message.mode_infos) { + obj.mode_infos = message.mode_infos.map((e) => e ? ModeInfo.toJSON(e) : undefined); + } else { + obj.mode_infos = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + message.bitarray = (object.bitarray !== undefined && object.bitarray !== null) + ? CompactBitArray.fromPartial(object.bitarray) + : undefined; + message.mode_infos = object.mode_infos?.map((e) => ModeInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFee(): Fee { + return { amount: [], gas_limit: "0", payer: "", granter: "" }; +} + +export const Fee = { + encode(message: Fee, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.gas_limit !== "0") { + writer.uint32(16).uint64(message.gas_limit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Fee { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.gas_limit = longToString(reader.uint64() as Long); + break; + case 3: + message.payer = reader.string(); + break; + case 4: + message.granter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Fee { + return { + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + gas_limit: isSet(object.gas_limit) ? String(object.gas_limit) : "0", + payer: isSet(object.payer) ? String(object.payer) : "", + granter: isSet(object.granter) ? String(object.granter) : "", + }; + }, + + toJSON(message: Fee): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + message.gas_limit !== undefined && (obj.gas_limit = message.gas_limit); + message.payer !== undefined && (obj.payer = message.payer); + message.granter !== undefined && (obj.granter = message.granter); + return obj; + }, + + fromPartial, I>>(object: I): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.gas_limit = object.gas_limit ?? "0"; + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, +}; + +function createBaseTip(): Tip { + return { amount: [], tipper: "" }; +} + +export const Tip = { + encode(message: Tip, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Tip { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Tip { + return { + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + tipper: isSet(object.tipper) ? String(object.tipper) : "", + }; + }, + + toJSON(message: Tip): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + message.tipper !== undefined && (obj.tipper = message.tipper); + return obj; + }, + + fromPartial, I>>(object: I): Tip { + const message = createBaseTip(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.tipper = object.tipper ?? ""; + return message; + }, +}; + +function createBaseAuxSignerData(): AuxSignerData { + return { address: "", sign_doc: undefined, mode: 0, sig: new Uint8Array() }; +} + +export const AuxSignerData = { + encode(message: AuxSignerData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.sign_doc !== undefined) { + SignDocDirectAux.encode(message.sign_doc, 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: _m0.Reader | Uint8Array, length?: number): AuxSignerData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.sign_doc = 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; + }, + + fromJSON(object: any): AuxSignerData { + return { + address: isSet(object.address) ? String(object.address) : "", + sign_doc: isSet(object.sign_doc) ? SignDocDirectAux.fromJSON(object.sign_doc) : undefined, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array(), + }; + }, + + toJSON(message: AuxSignerData): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.sign_doc !== undefined && + (obj.sign_doc = message.sign_doc ? SignDocDirectAux.toJSON(message.sign_doc) : undefined); + message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); + message.sig !== undefined && + (obj.sig = base64FromBytes(message.sig !== undefined ? message.sig : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): AuxSignerData { + const message = createBaseAuxSignerData(); + message.address = object.address ?? ""; + message.sign_doc = (object.sign_doc !== undefined && object.sign_doc !== null) + ? SignDocDirectAux.fromPartial(object.sign_doc) + : undefined; + message.mode = object.mode ?? 0; + message.sig = object.sig ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/upgrade/v1beta1/query.ts b/common/types/src/client/cosmos/upgrade/v1beta1/query.ts new file mode 100644 index 00000000..108af104 --- /dev/null +++ b/common/types/src/client/cosmos/upgrade/v1beta1/query.ts @@ -0,0 +1,723 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { ModuleVersion, Plan } from "./upgrade"; + +export const protobufPackage = "cosmos.upgrade.v1beta1"; + +/** + * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanRequest { +} + +/** + * QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanResponse { + /** plan is the current upgrade plan. */ + plan?: Plan; +} + +/** + * QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanRequest { + /** name is the name of the applied plan to query for. */ + name: string; +} + +/** + * QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanResponse { + /** height is the block height at which the plan was applied. */ + height: string; +} + +/** + * QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState + * RPC method. + * + * @deprecated + */ +export interface QueryUpgradedConsensusStateRequest { + /** + * last height of the current chain must be sent in request + * as this is the height under which next consensus state is stored + */ + last_height: string; +} + +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + * + * @deprecated + */ +export interface QueryUpgradedConsensusStateResponse { + /** Since: cosmos-sdk 0.43 */ + upgraded_consensus_state: Uint8Array; +} + +/** + * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsRequest { + /** + * module_name is a field to query a specific module + * consensus version from state. Leaving this empty will + * fetch the full list of module versions from state + */ + module_name: string; +} + +/** + * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsResponse { + /** module_versions is a list of module names with their consensus versions. */ + module_versions: ModuleVersion[]; +} + +/** + * QueryAuthorityRequest is the request type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityRequest { +} + +/** + * QueryAuthorityResponse is the response type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityResponse { + address: string; +} + +function createBaseQueryCurrentPlanRequest(): QueryCurrentPlanRequest { + return {}; +} + +export const QueryCurrentPlanRequest = { + encode(_: QueryCurrentPlanRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentPlanRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryCurrentPlanRequest { + return {}; + }, + + toJSON(_: QueryCurrentPlanRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryCurrentPlanRequest { + const message = createBaseQueryCurrentPlanRequest(); + return message; + }, +}; + +function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { + return { plan: undefined }; +} + +export const QueryCurrentPlanResponse = { + encode(message: QueryCurrentPlanResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentPlanResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.plan = Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCurrentPlanResponse { + return { plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined }; + }, + + toJSON(message: QueryCurrentPlanResponse): unknown { + const obj: any = {}; + message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryCurrentPlanResponse { + const message = createBaseQueryCurrentPlanResponse(); + message.plan = (object.plan !== undefined && object.plan !== null) ? Plan.fromPartial(object.plan) : undefined; + return message; + }, +}; + +function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { + return { name: "" }; +} + +export const QueryAppliedPlanRequest = { + encode(message: QueryAppliedPlanRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAppliedPlanRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAppliedPlanRequest(); + 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; + }, + + fromJSON(object: any): QueryAppliedPlanRequest { + return { name: isSet(object.name) ? String(object.name) : "" }; + }, + + toJSON(message: QueryAppliedPlanRequest): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + return obj; + }, + + fromPartial, I>>(object: I): QueryAppliedPlanRequest { + const message = createBaseQueryAppliedPlanRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { + return { height: "0" }; +} + +export const QueryAppliedPlanResponse = { + encode(message: QueryAppliedPlanResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAppliedPlanResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAppliedPlanResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanResponse { + return { height: isSet(object.height) ? String(object.height) : "0" }; + }, + + toJSON(message: QueryAppliedPlanResponse): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>(object: I): QueryAppliedPlanResponse { + const message = createBaseQueryAppliedPlanResponse(); + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { + return { last_height: "0" }; +} + +export const QueryUpgradedConsensusStateRequest = { + encode(message: QueryUpgradedConsensusStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.last_height !== "0") { + writer.uint32(8).int64(message.last_height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.last_height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateRequest { + return { last_height: isSet(object.last_height) ? String(object.last_height) : "0" }; + }, + + toJSON(message: QueryUpgradedConsensusStateRequest): unknown { + const obj: any = {}; + message.last_height !== undefined && (obj.last_height = message.last_height); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + message.last_height = object.last_height ?? "0"; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { + return { upgraded_consensus_state: new Uint8Array() }; +} + +export const QueryUpgradedConsensusStateResponse = { + encode(message: QueryUpgradedConsensusStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.upgraded_consensus_state.length !== 0) { + writer.uint32(18).bytes(message.upgraded_consensus_state); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.upgraded_consensus_state = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateResponse { + return { + upgraded_consensus_state: isSet(object.upgraded_consensus_state) + ? bytesFromBase64(object.upgraded_consensus_state) + : new Uint8Array(), + }; + }, + + toJSON(message: QueryUpgradedConsensusStateResponse): unknown { + const obj: any = {}; + message.upgraded_consensus_state !== undefined && + (obj.upgraded_consensus_state = base64FromBytes( + message.upgraded_consensus_state !== undefined ? message.upgraded_consensus_state : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgraded_consensus_state = object.upgraded_consensus_state ?? new Uint8Array(); + return message; + }, +}; + +function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { + return { module_name: "" }; +} + +export const QueryModuleVersionsRequest = { + encode(message: QueryModuleVersionsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.module_name !== "") { + writer.uint32(10).string(message.module_name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleVersionsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleVersionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.module_name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsRequest { + return { module_name: isSet(object.module_name) ? String(object.module_name) : "" }; + }, + + toJSON(message: QueryModuleVersionsRequest): unknown { + const obj: any = {}; + message.module_name !== undefined && (obj.module_name = message.module_name); + return obj; + }, + + fromPartial, I>>(object: I): QueryModuleVersionsRequest { + const message = createBaseQueryModuleVersionsRequest(); + message.module_name = object.module_name ?? ""; + return message; + }, +}; + +function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { + return { module_versions: [] }; +} + +export const QueryModuleVersionsResponse = { + encode(message: QueryModuleVersionsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.module_versions) { + ModuleVersion.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleVersionsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleVersionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.module_versions.push(ModuleVersion.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsResponse { + return { + module_versions: Array.isArray(object?.module_versions) + ? object.module_versions.map((e: any) => ModuleVersion.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryModuleVersionsResponse): unknown { + const obj: any = {}; + if (message.module_versions) { + obj.module_versions = message.module_versions.map((e) => e ? ModuleVersion.toJSON(e) : undefined); + } else { + obj.module_versions = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryModuleVersionsResponse { + const message = createBaseQueryModuleVersionsResponse(); + message.module_versions = object.module_versions?.map((e) => ModuleVersion.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { + return {}; +} + +export const QueryAuthorityRequest = { + encode(_: QueryAuthorityRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAuthorityRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryAuthorityRequest { + return {}; + }, + + toJSON(_: QueryAuthorityRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryAuthorityRequest { + const message = createBaseQueryAuthorityRequest(); + return message; + }, +}; + +function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { + return { address: "" }; +} + +export const QueryAuthorityResponse = { + encode(message: QueryAuthorityResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAuthorityResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorityResponse(); + 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; + }, + + fromJSON(object: any): QueryAuthorityResponse { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryAuthorityResponse): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): QueryAuthorityResponse { + const message = createBaseQueryAuthorityResponse(); + message.address = object.address ?? ""; + return message; + }, +}; + +/** Query defines the gRPC upgrade querier service. */ +export interface Query { + /** CurrentPlan queries the current upgrade plan. */ + CurrentPlan(request: QueryCurrentPlanRequest): Promise; + /** AppliedPlan queries a previously applied upgrade plan by its name. */ + AppliedPlan(request: QueryAppliedPlanRequest): Promise; + /** + * UpgradedConsensusState queries the consensus state that will serve + * as a trusted kernel for the next version of this chain. It will only be + * stored at the last height of this chain. + * UpgradedConsensusState RPC not supported with legacy querier + * This rpc is deprecated now that IBC has its own replacement + * (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) + * + * @deprecated + */ + UpgradedConsensusState(request: QueryUpgradedConsensusStateRequest): Promise; + /** + * ModuleVersions queries the list of module versions from state. + * + * Since: cosmos-sdk 0.43 + */ + ModuleVersions(request: QueryModuleVersionsRequest): Promise; + /** Returns the account with authority to conduct upgrades */ + Authority(request: QueryAuthorityRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.upgrade.v1beta1.Query"; + this.rpc = rpc; + this.CurrentPlan = this.CurrentPlan.bind(this); + this.AppliedPlan = this.AppliedPlan.bind(this); + this.UpgradedConsensusState = this.UpgradedConsensusState.bind(this); + this.ModuleVersions = this.ModuleVersions.bind(this); + this.Authority = this.Authority.bind(this); + } + CurrentPlan(request: QueryCurrentPlanRequest): Promise { + const data = QueryCurrentPlanRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CurrentPlan", data); + return promise.then((data) => QueryCurrentPlanResponse.decode(new _m0.Reader(data))); + } + + AppliedPlan(request: QueryAppliedPlanRequest): Promise { + const data = QueryAppliedPlanRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AppliedPlan", data); + return promise.then((data) => QueryAppliedPlanResponse.decode(new _m0.Reader(data))); + } + + UpgradedConsensusState(request: QueryUpgradedConsensusStateRequest): Promise { + const data = QueryUpgradedConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpgradedConsensusState", data); + return promise.then((data) => QueryUpgradedConsensusStateResponse.decode(new _m0.Reader(data))); + } + + ModuleVersions(request: QueryModuleVersionsRequest): Promise { + const data = QueryModuleVersionsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ModuleVersions", data); + return promise.then((data) => QueryModuleVersionsResponse.decode(new _m0.Reader(data))); + } + + Authority(request: QueryAuthorityRequest): Promise { + const data = QueryAuthorityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Authority", data); + return promise.then((data) => QueryAuthorityResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/upgrade/v1beta1/tx.ts b/common/types/src/client/cosmos/upgrade/v1beta1/tx.ts new file mode 100644 index 00000000..0504de6b --- /dev/null +++ b/common/types/src/client/cosmos/upgrade/v1beta1/tx.ts @@ -0,0 +1,284 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Plan } from "./upgrade"; + +export const protobufPackage = "cosmos.upgrade.v1beta1"; + +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgrade { + /** authority is the address of the governance account. */ + authority: string; + /** plan is the upgrade plan. */ + plan?: Plan; +} + +/** + * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeResponse { +} + +/** + * MsgCancelUpgrade is the Msg/CancelUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgrade { + /** authority is the address of the governance account. */ + authority: string; +} + +/** + * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeResponse { +} + +function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { + return { authority: "", plan: undefined }; +} + +export const MsgSoftwareUpgrade = { + encode(message: MsgSoftwareUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSoftwareUpgrade { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSoftwareUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.plan = Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSoftwareUpgrade { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: MsgSoftwareUpgrade): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgSoftwareUpgrade { + const message = createBaseMsgSoftwareUpgrade(); + message.authority = object.authority ?? ""; + message.plan = (object.plan !== undefined && object.plan !== null) ? Plan.fromPartial(object.plan) : undefined; + return message; + }, +}; + +function createBaseMsgSoftwareUpgradeResponse(): MsgSoftwareUpgradeResponse { + return {}; +} + +export const MsgSoftwareUpgradeResponse = { + encode(_: MsgSoftwareUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSoftwareUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgSoftwareUpgradeResponse { + return {}; + }, + + toJSON(_: MsgSoftwareUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSoftwareUpgradeResponse { + const message = createBaseMsgSoftwareUpgradeResponse(); + return message; + }, +}; + +function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { + return { authority: "" }; +} + +export const MsgCancelUpgrade = { + encode(message: MsgCancelUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelUpgrade { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCancelUpgrade { + return { authority: isSet(object.authority) ? String(object.authority) : "" }; + }, + + toJSON(message: MsgCancelUpgrade): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + return obj; + }, + + fromPartial, I>>(object: I): MsgCancelUpgrade { + const message = createBaseMsgCancelUpgrade(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { + return {}; +} + +export const MsgCancelUpgradeResponse = { + encode(_: MsgCancelUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelUpgradeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCancelUpgradeResponse { + return {}; + }, + + toJSON(_: MsgCancelUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCancelUpgradeResponse { + const message = createBaseMsgCancelUpgradeResponse(); + return message; + }, +}; + +/** Msg defines the upgrade Msg service. */ +export interface Msg { + /** + * SoftwareUpgrade is a governance operation for initiating a software upgrade. + * + * Since: cosmos-sdk 0.46 + */ + SoftwareUpgrade(request: MsgSoftwareUpgrade): Promise; + /** + * CancelUpgrade is a governance operation for cancelling a previously + * approvid software upgrade. + * + * Since: cosmos-sdk 0.46 + */ + CancelUpgrade(request: MsgCancelUpgrade): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.upgrade.v1beta1.Msg"; + this.rpc = rpc; + this.SoftwareUpgrade = this.SoftwareUpgrade.bind(this); + this.CancelUpgrade = this.CancelUpgrade.bind(this); + } + SoftwareUpgrade(request: MsgSoftwareUpgrade): Promise { + const data = MsgSoftwareUpgrade.encode(request).finish(); + const promise = this.rpc.request(this.service, "SoftwareUpgrade", data); + return promise.then((data) => MsgSoftwareUpgradeResponse.decode(new _m0.Reader(data))); + } + + CancelUpgrade(request: MsgCancelUpgrade): Promise { + const data = MsgCancelUpgrade.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelUpgrade", data); + return promise.then((data) => MsgCancelUpgradeResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/upgrade/v1beta1/upgrade.ts b/common/types/src/client/cosmos/upgrade/v1beta1/upgrade.ts new file mode 100644 index 00000000..db2b9503 --- /dev/null +++ b/common/types/src/client/cosmos/upgrade/v1beta1/upgrade.ts @@ -0,0 +1,410 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.upgrade.v1beta1"; + +/** 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. + * Only used if Time is not set. + */ + 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?: Any; +} + +/** + * 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: string; + description: string; + plan?: Plan; +} + +/** + * 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: string; + description: string; +} + +/** + * 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: string; +} + +function createBasePlan(): Plan { + return { name: "", time: undefined, height: "0", info: "", upgraded_client_state: undefined }; +} + +export const Plan = { + encode(message: Plan, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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 !== "0") { + writer.uint32(24).int64(message.height); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.upgraded_client_state !== undefined) { + Any.encode(message.upgraded_client_state, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Plan { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.upgraded_client_state = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Plan { + return { + name: isSet(object.name) ? String(object.name) : "", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + height: isSet(object.height) ? String(object.height) : "0", + info: isSet(object.info) ? String(object.info) : "", + upgraded_client_state: isSet(object.upgraded_client_state) + ? Any.fromJSON(object.upgraded_client_state) + : undefined, + }; + }, + + toJSON(message: Plan): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.height !== undefined && (obj.height = message.height); + message.info !== undefined && (obj.info = message.info); + message.upgraded_client_state !== undefined && + (obj.upgraded_client_state = message.upgraded_client_state + ? Any.toJSON(message.upgraded_client_state) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Plan { + const message = createBasePlan(); + message.name = object.name ?? ""; + message.time = object.time ?? undefined; + message.height = object.height ?? "0"; + message.info = object.info ?? ""; + message.upgraded_client_state = + (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) + ? Any.fromPartial(object.upgraded_client_state) + : undefined; + return message; + }, +}; + +function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { + return { title: "", description: "", plan: undefined }; +} + +export const SoftwareUpgradeProposal = { + encode(message: SoftwareUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SoftwareUpgradeProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SoftwareUpgradeProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: SoftwareUpgradeProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposal { + return { title: "", description: "" }; +} + +export const CancelSoftwareUpgradeProposal = { + encode(message: CancelSoftwareUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): CancelSoftwareUpgradeProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + + toJSON(message: CancelSoftwareUpgradeProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + + fromPartial, I>>( + object: I, + ): CancelSoftwareUpgradeProposal { + const message = createBaseCancelSoftwareUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseModuleVersion(): ModuleVersion { + return { name: "", version: "0" }; +} + +export const ModuleVersion = { + encode(message: ModuleVersion, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.version !== "0") { + writer.uint32(16).uint64(message.version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleVersion { + return { + name: isSet(object.name) ? String(object.name) : "", + version: isSet(object.version) ? String(object.version) : "0", + }; + }, + + toJSON(message: ModuleVersion): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.version !== undefined && (obj.version = message.version); + return obj; + }, + + fromPartial, I>>(object: I): ModuleVersion { + const message = createBaseModuleVersion(); + message.name = object.name ?? ""; + message.version = object.version ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/vesting/v1beta1/tx.ts b/common/types/src/client/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 00000000..c3fad147 --- /dev/null +++ b/common/types/src/client/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,506 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Period } from "./vesting"; + +export const protobufPackage = "cosmos.vesting.v1beta1"; + +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreateVestingAccount { + from_address: string; + to_address: string; + amount: Coin[]; + end_time: string; + delayed: boolean; +} + +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponse { +} + +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + */ +export interface MsgCreatePermanentLockedAccount { + from_address: string; + to_address: string; + amount: Coin[]; +} + +/** MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. */ +export interface MsgCreatePermanentLockedAccountResponse { +} + +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreatePeriodicVestingAccount { + from_address: string; + to_address: string; + start_time: string; + vesting_periods: Period[]; +} + +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + */ +export interface MsgCreatePeriodicVestingAccountResponse { +} + +function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { + return { from_address: "", to_address: "", amount: [], end_time: "0", delayed: false }; +} + +export const MsgCreateVestingAccount = { + encode(message: MsgCreateVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.end_time !== "0") { + writer.uint32(32).int64(message.end_time); + } + if (message.delayed === true) { + writer.uint32(40).bool(message.delayed); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.from_address = reader.string(); + break; + case 2: + message.to_address = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.end_time = longToString(reader.int64() as Long); + break; + case 5: + message.delayed = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateVestingAccount { + return { + from_address: isSet(object.from_address) ? String(object.from_address) : "", + to_address: isSet(object.to_address) ? String(object.to_address) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + end_time: isSet(object.end_time) ? String(object.end_time) : "0", + delayed: isSet(object.delayed) ? Boolean(object.delayed) : false, + }; + }, + + toJSON(message: MsgCreateVestingAccount): unknown { + const obj: any = {}; + message.from_address !== undefined && (obj.from_address = message.from_address); + message.to_address !== undefined && (obj.to_address = message.to_address); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + message.end_time !== undefined && (obj.end_time = message.end_time); + message.delayed !== undefined && (obj.delayed = message.delayed); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.end_time = object.end_time ?? "0"; + message.delayed = object.delayed ?? false; + return message; + }, +}; + +function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { + return {}; +} + +export const MsgCreateVestingAccountResponse = { + encode(_: MsgCreateVestingAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgCreateVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreateVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { + return { from_address: "", to_address: "", amount: [] }; +} + +export const MsgCreatePermanentLockedAccount = { + encode(message: MsgCreatePermanentLockedAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.from_address = reader.string(); + break; + case 2: + message.to_address = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreatePermanentLockedAccount { + return { + from_address: isSet(object.from_address) ? String(object.from_address) : "", + to_address: isSet(object.to_address) ? String(object.to_address) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCreatePermanentLockedAccount): unknown { + const obj: any = {}; + message.from_address !== undefined && (obj.from_address = message.from_address); + message.to_address !== undefined && (obj.to_address = message.to_address); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { + return {}; +} + +export const MsgCreatePermanentLockedAccountResponse = { + encode(_: MsgCreatePermanentLockedAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgCreatePermanentLockedAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePermanentLockedAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { + return { from_address: "", to_address: "", start_time: "0", vesting_periods: [] }; +} + +export const MsgCreatePeriodicVestingAccount = { + encode(message: MsgCreatePeriodicVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + if (message.start_time !== "0") { + writer.uint32(24).int64(message.start_time); + } + for (const v of message.vesting_periods) { + Period.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.from_address = reader.string(); + break; + case 2: + message.to_address = reader.string(); + break; + case 3: + message.start_time = longToString(reader.int64() as Long); + break; + case 4: + message.vesting_periods.push(Period.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreatePeriodicVestingAccount { + return { + from_address: isSet(object.from_address) ? String(object.from_address) : "", + to_address: isSet(object.to_address) ? String(object.to_address) : "", + start_time: isSet(object.start_time) ? String(object.start_time) : "0", + vesting_periods: Array.isArray(object?.vesting_periods) + ? object.vesting_periods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreatePeriodicVestingAccount): unknown { + const obj: any = {}; + message.from_address !== undefined && (obj.from_address = message.from_address); + message.to_address !== undefined && (obj.to_address = message.to_address); + message.start_time !== undefined && (obj.start_time = message.start_time); + if (message.vesting_periods) { + obj.vesting_periods = message.vesting_periods.map((e) => e ? Period.toJSON(e) : undefined); + } else { + obj.vesting_periods = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.start_time = object.start_time ?? "0"; + message.vesting_periods = object.vesting_periods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { + return {}; +} + +export const MsgCreatePeriodicVestingAccountResponse = { + encode(_: MsgCreatePeriodicVestingAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgCreatePeriodicVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePeriodicVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgCreatePeriodicVestingAccountResponse { + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** + * CreateVestingAccount defines a method that enables creating a vesting + * account. + */ + CreateVestingAccount(request: MsgCreateVestingAccount): Promise; + /** + * CreatePermanentLockedAccount defines a method that enables creating a permanent + * locked account. + */ + CreatePermanentLockedAccount( + request: MsgCreatePermanentLockedAccount, + ): Promise; + /** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + */ + CreatePeriodicVestingAccount( + request: MsgCreatePeriodicVestingAccount, + ): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.vesting.v1beta1.Msg"; + this.rpc = rpc; + this.CreateVestingAccount = this.CreateVestingAccount.bind(this); + this.CreatePermanentLockedAccount = this.CreatePermanentLockedAccount.bind(this); + this.CreatePeriodicVestingAccount = this.CreatePeriodicVestingAccount.bind(this); + } + CreateVestingAccount(request: MsgCreateVestingAccount): Promise { + const data = MsgCreateVestingAccount.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateVestingAccount", data); + return promise.then((data) => MsgCreateVestingAccountResponse.decode(new _m0.Reader(data))); + } + + CreatePermanentLockedAccount( + request: MsgCreatePermanentLockedAccount, + ): Promise { + const data = MsgCreatePermanentLockedAccount.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreatePermanentLockedAccount", data); + return promise.then((data) => MsgCreatePermanentLockedAccountResponse.decode(new _m0.Reader(data))); + } + + CreatePeriodicVestingAccount( + request: MsgCreatePeriodicVestingAccount, + ): Promise { + const data = MsgCreatePeriodicVestingAccount.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreatePeriodicVestingAccount", data); + return promise.then((data) => MsgCreatePeriodicVestingAccountResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos/vesting/v1beta1/vesting.ts b/common/types/src/client/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 00000000..bf2ce510 --- /dev/null +++ b/common/types/src/client/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,509 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { BaseAccount } from "../../auth/v1beta1/auth"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.vesting.v1beta1"; + +/** + * BaseVestingAccount implements the VestingAccount interface. It contains all + * the necessary fields needed for any vesting account implementation. + */ +export interface BaseVestingAccount { + base_account?: BaseAccount; + original_vesting: Coin[]; + delegated_free: Coin[]; + delegated_vesting: Coin[]; + end_time: string; +} + +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccount { + base_vesting_account?: BaseVestingAccount; + start_time: string; +} + +/** + * 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 { + base_vesting_account?: BaseVestingAccount; +} + +/** Period defines a length of time and amount of coins that will vest. */ +export interface Period { + length: string; + amount: Coin[]; +} + +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccount { + base_vesting_account?: BaseVestingAccount; + start_time: string; + vesting_periods: Period[]; +} + +/** + * 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 { + base_vesting_account?: BaseVestingAccount; +} + +function createBaseBaseVestingAccount(): BaseVestingAccount { + return { base_account: undefined, original_vesting: [], delegated_free: [], delegated_vesting: [], end_time: "0" }; +} + +export const BaseVestingAccount = { + encode(message: BaseVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_account !== undefined) { + BaseAccount.encode(message.base_account, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.original_vesting) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegated_free) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.delegated_vesting) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.end_time !== "0") { + writer.uint32(40).int64(message.end_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_account = BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.original_vesting.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.delegated_free.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.delegated_vesting.push(Coin.decode(reader, reader.uint32())); + break; + case 5: + message.end_time = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BaseVestingAccount { + return { + base_account: isSet(object.base_account) ? BaseAccount.fromJSON(object.base_account) : undefined, + original_vesting: Array.isArray(object?.original_vesting) + ? object.original_vesting.map((e: any) => Coin.fromJSON(e)) + : [], + delegated_free: Array.isArray(object?.delegated_free) + ? object.delegated_free.map((e: any) => Coin.fromJSON(e)) + : [], + delegated_vesting: Array.isArray(object?.delegated_vesting) + ? object.delegated_vesting.map((e: any) => Coin.fromJSON(e)) + : [], + end_time: isSet(object.end_time) ? String(object.end_time) : "0", + }; + }, + + toJSON(message: BaseVestingAccount): unknown { + const obj: any = {}; + message.base_account !== undefined && + (obj.base_account = message.base_account ? BaseAccount.toJSON(message.base_account) : undefined); + if (message.original_vesting) { + obj.original_vesting = message.original_vesting.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.original_vesting = []; + } + if (message.delegated_free) { + obj.delegated_free = message.delegated_free.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.delegated_free = []; + } + if (message.delegated_vesting) { + obj.delegated_vesting = message.delegated_vesting.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.delegated_vesting = []; + } + message.end_time !== undefined && (obj.end_time = message.end_time); + return obj; + }, + + fromPartial, I>>(object: I): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + message.base_account = (object.base_account !== undefined && object.base_account !== null) + ? BaseAccount.fromPartial(object.base_account) + : undefined; + message.original_vesting = object.original_vesting?.map((e) => Coin.fromPartial(e)) || []; + message.delegated_free = object.delegated_free?.map((e) => Coin.fromPartial(e)) || []; + message.delegated_vesting = object.delegated_vesting?.map((e) => Coin.fromPartial(e)) || []; + message.end_time = object.end_time ?? "0"; + return message; + }, +}; + +function createBaseContinuousVestingAccount(): ContinuousVestingAccount { + return { base_vesting_account: undefined, start_time: "0" }; +} + +export const ContinuousVestingAccount = { + encode(message: ContinuousVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).ldelim(); + } + if (message.start_time !== "0") { + writer.uint32(16).int64(message.start_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.start_time = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ContinuousVestingAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) + ? BaseVestingAccount.fromJSON(object.base_vesting_account) + : undefined, + start_time: isSet(object.start_time) ? String(object.start_time) : "0", + }; + }, + + toJSON(message: ContinuousVestingAccount): unknown { + const obj: any = {}; + message.base_vesting_account !== undefined && (obj.base_vesting_account = message.base_vesting_account + ? BaseVestingAccount.toJSON(message.base_vesting_account) + : undefined); + message.start_time !== undefined && (obj.start_time = message.start_time); + return obj; + }, + + fromPartial, I>>(object: I): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + message.base_vesting_account = (object.base_vesting_account !== undefined && object.base_vesting_account !== null) + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + message.start_time = object.start_time ?? "0"; + return message; + }, +}; + +function createBaseDelayedVestingAccount(): DelayedVestingAccount { + return { base_vesting_account: undefined }; +} + +export const DelayedVestingAccount = { + encode(message: DelayedVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelayedVestingAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) + ? BaseVestingAccount.fromJSON(object.base_vesting_account) + : undefined, + }; + }, + + toJSON(message: DelayedVestingAccount): unknown { + const obj: any = {}; + message.base_vesting_account !== undefined && (obj.base_vesting_account = message.base_vesting_account + ? BaseVestingAccount.toJSON(message.base_vesting_account) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + message.base_vesting_account = (object.base_vesting_account !== undefined && object.base_vesting_account !== null) + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + return message; + }, +}; + +function createBasePeriod(): Period { + return { length: "0", amount: [] }; +} + +export const Period = { + encode(message: Period, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.length !== "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: _m0.Reader | Uint8Array, length?: number): Period { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Period { + return { + length: isSet(object.length) ? String(object.length) : "0", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Period): unknown { + const obj: any = {}; + message.length !== undefined && (obj.length = message.length); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Period { + const message = createBasePeriod(); + message.length = object.length ?? "0"; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePeriodicVestingAccount(): PeriodicVestingAccount { + return { base_vesting_account: undefined, start_time: "0", vesting_periods: [] }; +} + +export const PeriodicVestingAccount = { + encode(message: PeriodicVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).ldelim(); + } + if (message.start_time !== "0") { + writer.uint32(16).int64(message.start_time); + } + for (const v of message.vesting_periods) { + Period.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.start_time = longToString(reader.int64() as Long); + break; + case 3: + message.vesting_periods.push(Period.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PeriodicVestingAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) + ? BaseVestingAccount.fromJSON(object.base_vesting_account) + : undefined, + start_time: isSet(object.start_time) ? String(object.start_time) : "0", + vesting_periods: Array.isArray(object?.vesting_periods) + ? object.vesting_periods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PeriodicVestingAccount): unknown { + const obj: any = {}; + message.base_vesting_account !== undefined && (obj.base_vesting_account = message.base_vesting_account + ? BaseVestingAccount.toJSON(message.base_vesting_account) + : undefined); + message.start_time !== undefined && (obj.start_time = message.start_time); + if (message.vesting_periods) { + obj.vesting_periods = message.vesting_periods.map((e) => e ? Period.toJSON(e) : undefined); + } else { + obj.vesting_periods = []; + } + return obj; + }, + + fromPartial, I>>(object: I): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + message.base_vesting_account = (object.base_vesting_account !== undefined && object.base_vesting_account !== null) + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + message.start_time = object.start_time ?? "0"; + message.vesting_periods = object.vesting_periods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePermanentLockedAccount(): PermanentLockedAccount { + return { base_vesting_account: undefined }; +} + +export const PermanentLockedAccount = { + encode(message: PermanentLockedAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PermanentLockedAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) + ? BaseVestingAccount.fromJSON(object.base_vesting_account) + : undefined, + }; + }, + + toJSON(message: PermanentLockedAccount): unknown { + const obj: any = {}; + message.base_vesting_account !== undefined && (obj.base_vesting_account = message.base_vesting_account + ? BaseVestingAccount.toJSON(message.base_vesting_account) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + message.base_vesting_account = (object.base_vesting_account !== undefined && object.base_vesting_account !== null) + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/cosmos_proto/cosmos.ts b/common/types/src/client/cosmos_proto/cosmos.ts new file mode 100644 index 00000000..0d4074af --- /dev/null +++ b/common/types/src/client/cosmos_proto/cosmos.ts @@ -0,0 +1,247 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos_proto"; + +export enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1, +} + +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; +} + +/** + * 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. + */ + field_type: ScalarType[]; +} + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { name: "", description: "" }; +} + +export const InterfaceDescriptor = { + encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseScalarDescriptor(): ScalarDescriptor { + return { name: "", description: "", field_type: [] }; +} + +export const ScalarDescriptor = { + encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.field_type) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.field_type.push(reader.int32() as any); + } + } else { + message.field_type.push(reader.int32() as any); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ScalarDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + field_type: Array.isArray(object?.field_type) ? object.field_type.map((e: any) => scalarTypeFromJSON(e)) : [], + }; + }, + + toJSON(message: ScalarDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && (obj.description = message.description); + if (message.field_type) { + obj.field_type = message.field_type.map((e) => scalarTypeToJSON(e)); + } else { + obj.field_type = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ScalarDescriptor { + const message = createBaseScalarDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.field_type = object.field_type?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/gogoproto/gogo.ts b/common/types/src/client/gogoproto/gogo.ts new file mode 100644 index 00000000..ecf800e0 --- /dev/null +++ b/common/types/src/client/gogoproto/gogo.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export const protobufPackage = "gogoproto"; diff --git a/common/types/src/client/google/api/annotations.ts b/common/types/src/client/google/api/annotations.ts new file mode 100644 index 00000000..c2161053 --- /dev/null +++ b/common/types/src/client/google/api/annotations.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export const protobufPackage = "google.api"; diff --git a/common/types/src/client/google/api/http.ts b/common/types/src/client/google/api/http.ts new file mode 100644 index 00000000..39f35c73 --- /dev/null +++ b/common/types/src/client/google/api/http.ts @@ -0,0 +1,655 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.api"; + +/** + * 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. + */ + fully_decode_reserved_expansion: boolean; +} + +/** + * # 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 + | undefined; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: + | string + | undefined; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: + | string + | undefined; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: + | string + | undefined; + /** Maps to HTTP PATCH. Used for updating a resource. */ + patch?: + | string + | undefined; + /** + * 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 + | undefined; + /** + * 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: HttpRule[]; +} + +/** 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; +} + +function createBaseHttp(): Http { + return { rules: [], fully_decode_reserved_expansion: false }; +} + +export const Http = { + encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.fully_decode_reserved_expansion === true) { + writer.uint32(16).bool(message.fully_decode_reserved_expansion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Http { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.fully_decode_reserved_expansion = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Http { + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], + fully_decode_reserved_expansion: isSet(object.fully_decode_reserved_expansion) + ? Boolean(object.fully_decode_reserved_expansion) + : false, + }; + }, + + toJSON(message: Http): unknown { + const obj: any = {}; + if (message.rules) { + obj.rules = message.rules.map((e) => e ? HttpRule.toJSON(e) : undefined); + } else { + obj.rules = []; + } + message.fully_decode_reserved_expansion !== undefined && + (obj.fully_decode_reserved_expansion = message.fully_decode_reserved_expansion); + return obj; + }, + + fromPartial, I>>(object: I): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; + message.fully_decode_reserved_expansion = object.fully_decode_reserved_expansion ?? false; + return message; + }, +}; + +function createBaseHttpRule(): HttpRule { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + response_body: "", + additional_bindings: [], + }; +} + +export const HttpRule = { + encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.response_body !== "") { + writer.uint32(98).string(message.response_body); + } + for (const v of message.additional_bindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.response_body = reader.string(); + break; + case 11: + message.additional_bindings.push(HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): HttpRule { + return { + selector: isSet(object.selector) ? String(object.selector) : "", + get: isSet(object.get) ? String(object.get) : undefined, + put: isSet(object.put) ? String(object.put) : undefined, + post: isSet(object.post) ? String(object.post) : undefined, + delete: isSet(object.delete) ? String(object.delete) : undefined, + patch: isSet(object.patch) ? String(object.patch) : undefined, + custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined, + body: isSet(object.body) ? String(object.body) : "", + response_body: isSet(object.response_body) ? String(object.response_body) : "", + additional_bindings: Array.isArray(object?.additional_bindings) + ? object.additional_bindings.map((e: any) => HttpRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HttpRule): unknown { + const obj: any = {}; + message.selector !== undefined && (obj.selector = message.selector); + message.get !== undefined && (obj.get = message.get); + message.put !== undefined && (obj.put = message.put); + message.post !== undefined && (obj.post = message.post); + message.delete !== undefined && (obj.delete = message.delete); + message.patch !== undefined && (obj.patch = message.patch); + message.custom !== undefined && + (obj.custom = message.custom ? CustomHttpPattern.toJSON(message.custom) : undefined); + message.body !== undefined && (obj.body = message.body); + message.response_body !== undefined && (obj.response_body = message.response_body); + if (message.additional_bindings) { + obj.additional_bindings = message.additional_bindings.map((e) => e ? HttpRule.toJSON(e) : undefined); + } else { + obj.additional_bindings = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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.response_body = object.response_body ?? ""; + message.additional_bindings = object.additional_bindings?.map((e) => HttpRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCustomHttpPattern(): CustomHttpPattern { + return { kind: "", path: "" }; +} + +export const CustomHttpPattern = { + encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): CustomHttpPattern { + return { kind: isSet(object.kind) ? String(object.kind) : "", path: isSet(object.path) ? String(object.path) : "" }; + }, + + toJSON(message: CustomHttpPattern): unknown { + const obj: any = {}; + message.kind !== undefined && (obj.kind = message.kind); + message.path !== undefined && (obj.path = message.path); + return obj; + }, + + fromPartial, I>>(object: I): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/google/protobuf/any.ts b/common/types/src/client/google/protobuf/any.ts new file mode 100644 index 00000000..38da266b --- /dev/null +++ b/common/types/src/client/google/protobuf/any.ts @@ -0,0 +1,237 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * `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); + * } + * + * 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 := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, 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. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + type_url: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} + +function createBaseAny(): Any { + return { type_url: "", value: new Uint8Array() }; +} + +export const Any = { + encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type_url !== "") { + writer.uint32(10).string(message.type_url); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Any { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.type_url = reader.string(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Any { + return { + type_url: isSet(object.type_url) ? String(object.type_url) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + }; + }, + + toJSON(message: Any): unknown { + const obj: any = {}; + message.type_url !== undefined && (obj.type_url = message.type_url); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): Any { + const message = createBaseAny(); + message.type_url = object.type_url ?? ""; + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/google/protobuf/descriptor.ts b/common/types/src/client/google/protobuf/descriptor.ts new file mode 100644 index 00000000..4df24d9d --- /dev/null +++ b/common/types/src/client/google/protobuf/descriptor.ts @@ -0,0 +1,3714 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} + +/** 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. */ + 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: DescriptorProto[]; + enum_type: 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. + */ + source_code_info?: SourceCodeInfo; + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + */ + syntax: string; +} + +/** Describes a message type. */ +export interface DescriptorProto { + name: string; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nested_type: DescriptorProto[]; + enum_type: EnumDescriptorProto[]; + extension_range: DescriptorProto_ExtensionRange[]; + oneof_decl: OneofDescriptorProto[]; + options?: MessageOptions; + reserved_range: DescriptorProto_ReservedRange[]; + /** + * 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 DescriptorProto_ExtensionRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; + options?: ExtensionRangeOptions; +} + +/** + * 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 ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +/** 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). + */ + 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. + * TODO(kenton): Base-64 encode? + */ + 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?: FieldOptions; +} + +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 in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. + */ + 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 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_REQUIRED = 2, + LABEL_REPEATED = 3, + UNRECOGNIZED = -1, +} + +export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + 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_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name: string; + options?: OneofOptions; +} + +/** 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. + */ + reserved_range: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reserved_name: string[]; +} + +/** + * 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; +} + +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name: string; + number: number; + options?: EnumValueOptions; +} + +/** Describes a service. */ +export interface ServiceDescriptorProto { + name: string; + method: MethodDescriptorProto[]; + options?: ServiceOptions; +} + +/** 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. + */ + input_type: string; + output_type: string; + options?: MethodOptions; + /** Identifies if client streams multiple client messages */ + client_streaming: boolean; + /** Identifies if server streams multiple server messages */ + server_streaming: boolean; +} + +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. + */ + java_package: string; + /** + * If set, all the classes from the .proto file are wrapped in a single + * outer class with the given name. This applies to both Proto1 + * (equivalent to the old "--one_java_file" option) and Proto2 (where + * a .proto always translates to a single class, but you may want to + * explicitly choose the class name). + */ + java_outer_classname: string; + /** + * If set true, 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 outer class + * named by java_outer_classname. However, the outer 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; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + */ + 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; + php_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; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpreted_option: UninterpretedOption[]; +} + +/** 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 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 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. + */ + 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; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +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 not yet implemented in the open source + * release -- sorry, we'll try to include it 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. + */ + 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 implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + */ + 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; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1, +} + +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 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"; + } +} + +export interface OneofOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface EnumOptions { + /** + * 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; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +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; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface ServiceOptions { + /** + * 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: UninterpretedOption[]; +} + +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; + idempotency_level: MethodOptions_IdempotencyLevel; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +/** + * 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 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"; + } +} + +/** + * 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. + */ + identifier_value: string; + positive_int_value: string; + negative_int_value: string; + double_value: number; + string_value: Uint8Array; + aggregate_value: string; +} + +/** + * 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], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePart { + name_part: string; + is_extension: boolean; +} + +/** + * 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 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. 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 qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to qux 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[]; +} + +/** + * 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 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. */ + 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 offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end: number; +} + +function createBaseFileDescriptorSet(): FileDescriptorSet { + return { file: [] }; +} + +export const FileDescriptorSet = { + encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): FileDescriptorSet { + return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + }, + + toJSON(message: FileDescriptorSet): unknown { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map((e) => e ? FileDescriptorProto.toJSON(e) : undefined); + } else { + obj.file = []; + } + return obj; + }, + + fromPartial, I>>(object: I): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFileDescriptorProto(): FileDescriptorProto { + return { + name: "", + package: "", + dependency: [], + public_dependency: [], + weak_dependency: [], + message_type: [], + enum_type: [], + service: [], + extension: [], + options: undefined, + source_code_info: undefined, + syntax: "", + }; +} + +export const FileDescriptorProto = { + encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.public_dependency) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(90).fork(); + for (const v of message.weak_dependency) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.message_type) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.enum_type) { + 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.source_code_info !== undefined) { + SourceCodeInfo.encode(message.source_code_info, writer.uint32(74).fork()).ldelim(); + } + if (message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.public_dependency.push(reader.int32()); + } + } else { + message.public_dependency.push(reader.int32()); + } + break; + case 11: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weak_dependency.push(reader.int32()); + } + } else { + message.weak_dependency.push(reader.int32()); + } + break; + case 4: + message.message_type.push(DescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + message.enum_type.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.source_code_info = SourceCodeInfo.decode(reader, reader.uint32()); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FileDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + package: isSet(object.package) ? String(object.package) : "", + dependency: Array.isArray(object?.dependency) ? object.dependency.map((e: any) => String(e)) : [], + public_dependency: Array.isArray(object?.public_dependency) + ? object.public_dependency.map((e: any) => Number(e)) + : [], + weak_dependency: Array.isArray(object?.weak_dependency) ? object.weak_dependency.map((e: any) => Number(e)) : [], + message_type: Array.isArray(object?.message_type) + ? object.message_type.map((e: any) => DescriptorProto.fromJSON(e)) + : [], + enum_type: Array.isArray(object?.enum_type) + ? object.enum_type.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, + source_code_info: isSet(object.source_code_info) ? SourceCodeInfo.fromJSON(object.source_code_info) : undefined, + syntax: isSet(object.syntax) ? String(object.syntax) : "", + }; + }, + + toJSON(message: FileDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.package !== undefined && (obj.package = message.package); + if (message.dependency) { + obj.dependency = message.dependency.map((e) => e); + } else { + obj.dependency = []; + } + if (message.public_dependency) { + obj.public_dependency = message.public_dependency.map((e) => Math.round(e)); + } else { + obj.public_dependency = []; + } + if (message.weak_dependency) { + obj.weak_dependency = message.weak_dependency.map((e) => Math.round(e)); + } else { + obj.weak_dependency = []; + } + if (message.message_type) { + obj.message_type = message.message_type.map((e) => e ? DescriptorProto.toJSON(e) : undefined); + } else { + obj.message_type = []; + } + if (message.enum_type) { + obj.enum_type = message.enum_type.map((e) => e ? EnumDescriptorProto.toJSON(e) : undefined); + } else { + obj.enum_type = []; + } + if (message.service) { + obj.service = message.service.map((e) => e ? ServiceDescriptorProto.toJSON(e) : undefined); + } else { + obj.service = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => e ? FieldDescriptorProto.toJSON(e) : undefined); + } else { + obj.extension = []; + } + message.options !== undefined && (obj.options = message.options ? FileOptions.toJSON(message.options) : undefined); + message.source_code_info !== undefined && + (obj.source_code_info = message.source_code_info ? SourceCodeInfo.toJSON(message.source_code_info) : undefined); + message.syntax !== undefined && (obj.syntax = message.syntax); + return obj; + }, + + fromPartial, I>>(object: I): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map((e) => e) || []; + message.public_dependency = object.public_dependency?.map((e) => e) || []; + message.weak_dependency = object.weak_dependency?.map((e) => e) || []; + message.message_type = object.message_type?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enum_type = object.enum_type?.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.source_code_info = (object.source_code_info !== undefined && object.source_code_info !== null) + ? SourceCodeInfo.fromPartial(object.source_code_info) + : undefined; + message.syntax = object.syntax ?? ""; + return message; + }, +}; + +function createBaseDescriptorProto(): DescriptorProto { + return { + name: "", + field: [], + extension: [], + nested_type: [], + enum_type: [], + extension_range: [], + oneof_decl: [], + options: undefined, + reserved_range: [], + reserved_name: [], + }; +} + +export const DescriptorProto = { + encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.nested_type) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.enum_type) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.extension_range) { + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.oneof_decl) { + 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.reserved_range) { + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.reserved_name) { + writer.uint32(82).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.nested_type.push(DescriptorProto.decode(reader, reader.uint32())); + break; + case 4: + message.enum_type.push(EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + message.extension_range.push(DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); + break; + case 8: + message.oneof_decl.push(OneofDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.options = MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + message.reserved_range.push(DescriptorProto_ReservedRange.decode(reader, reader.uint32())); + break; + case 10: + message.reserved_name.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + field: Array.isArray(object?.field) ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + nested_type: Array.isArray(object?.nested_type) + ? object.nested_type.map((e: any) => DescriptorProto.fromJSON(e)) + : [], + enum_type: Array.isArray(object?.enum_type) + ? object.enum_type.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extension_range: Array.isArray(object?.extension_range) + ? object.extension_range.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) + : [], + oneof_decl: Array.isArray(object?.oneof_decl) + ? object.oneof_decl.map((e: any) => OneofDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, + reserved_range: Array.isArray(object?.reserved_range) + ? object.reserved_range.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) + : [], + reserved_name: Array.isArray(object?.reserved_name) + ? object.reserved_name.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: DescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.field) { + obj.field = message.field.map((e) => e ? FieldDescriptorProto.toJSON(e) : undefined); + } else { + obj.field = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => e ? FieldDescriptorProto.toJSON(e) : undefined); + } else { + obj.extension = []; + } + if (message.nested_type) { + obj.nested_type = message.nested_type.map((e) => e ? DescriptorProto.toJSON(e) : undefined); + } else { + obj.nested_type = []; + } + if (message.enum_type) { + obj.enum_type = message.enum_type.map((e) => e ? EnumDescriptorProto.toJSON(e) : undefined); + } else { + obj.enum_type = []; + } + if (message.extension_range) { + obj.extension_range = message.extension_range.map((e) => + e ? DescriptorProto_ExtensionRange.toJSON(e) : undefined + ); + } else { + obj.extension_range = []; + } + if (message.oneof_decl) { + obj.oneof_decl = message.oneof_decl.map((e) => e ? OneofDescriptorProto.toJSON(e) : undefined); + } else { + obj.oneof_decl = []; + } + message.options !== undefined && + (obj.options = message.options ? MessageOptions.toJSON(message.options) : undefined); + if (message.reserved_range) { + obj.reserved_range = message.reserved_range.map((e) => e ? DescriptorProto_ReservedRange.toJSON(e) : undefined); + } else { + obj.reserved_range = []; + } + if (message.reserved_name) { + obj.reserved_name = message.reserved_name.map((e) => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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.nested_type = object.nested_type?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enum_type = object.enum_type?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.extension_range = object.extension_range?.map((e) => DescriptorProto_ExtensionRange.fromPartial(e)) || []; + message.oneof_decl = object.oneof_decl?.map((e) => OneofDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? MessageOptions.fromPartial(object.options) + : undefined; + message.reserved_range = object.reserved_range?.map((e) => DescriptorProto_ReservedRange.fromPartial(e)) || []; + message.reserved_name = object.reserved_name?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { + return { start: 0, end: 0, options: undefined }; +} + +export const DescriptorProto_ExtensionRange = { + encode(message: DescriptorProto_ExtensionRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DescriptorProto_ExtensionRange { + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: DescriptorProto_ExtensionRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + message.options !== undefined && + (obj.options = message.options ? ExtensionRangeOptions.toJSON(message.options) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): 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; + }, +}; + +function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { + return { start: 0, end: 0 }; +} + +export const DescriptorProto_ReservedRange = { + encode(message: DescriptorProto_ReservedRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DescriptorProto_ReservedRange { + return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + }, + + toJSON(message: DescriptorProto_ReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + fromPartial, I>>( + object: I, + ): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +function createBaseExtensionRangeOptions(): ExtensionRangeOptions { + return { uninterpreted_option: [] }; +} + +export const ExtensionRangeOptions = { + encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions { + return { + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ExtensionRangeOptions): unknown { + const obj: any = {}; + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + type_name: "", + extendee: "", + default_value: "", + oneof_index: 0, + json_name: "", + options: undefined, + }; +} + +export const FieldDescriptorProto = { + encode(message: FieldDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.type_name !== "") { + writer.uint32(50).string(message.type_name); + } + if (message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.default_value !== "") { + writer.uint32(58).string(message.default_value); + } + if (message.oneof_index !== 0) { + writer.uint32(72).int32(message.oneof_index); + } + if (message.json_name !== "") { + writer.uint32(82).string(message.json_name); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.type_name = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.default_value = reader.string(); + break; + case 9: + message.oneof_index = reader.int32(); + break; + case 10: + message.json_name = reader.string(); + break; + case 8: + message.options = FieldOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FieldDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, + type_name: isSet(object.type_name) ? String(object.type_name) : "", + extendee: isSet(object.extendee) ? String(object.extendee) : "", + default_value: isSet(object.default_value) ? String(object.default_value) : "", + oneof_index: isSet(object.oneof_index) ? Number(object.oneof_index) : 0, + json_name: isSet(object.json_name) ? String(object.json_name) : "", + options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: FieldDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.label !== undefined && (obj.label = fieldDescriptorProto_LabelToJSON(message.label)); + message.type !== undefined && (obj.type = fieldDescriptorProto_TypeToJSON(message.type)); + message.type_name !== undefined && (obj.type_name = message.type_name); + message.extendee !== undefined && (obj.extendee = message.extendee); + message.default_value !== undefined && (obj.default_value = message.default_value); + message.oneof_index !== undefined && (obj.oneof_index = Math.round(message.oneof_index)); + message.json_name !== undefined && (obj.json_name = message.json_name); + message.options !== undefined && (obj.options = message.options ? FieldOptions.toJSON(message.options) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? 1; + message.type = object.type ?? 1; + message.type_name = object.type_name ?? ""; + message.extendee = object.extendee ?? ""; + message.default_value = object.default_value ?? ""; + message.oneof_index = object.oneof_index ?? 0; + message.json_name = object.json_name ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? FieldOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseOneofDescriptorProto(): OneofDescriptorProto { + return { name: "", options: undefined }; +} + +export const OneofDescriptorProto = { + encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): OneofDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: OneofDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? OneofOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseEnumDescriptorProto(): EnumDescriptorProto { + return { name: "", value: [], options: undefined, reserved_range: [], reserved_name: [] }; +} + +export const EnumDescriptorProto = { + encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.reserved_range) { + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.reserved_name) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.reserved_range.push(EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); + break; + case 5: + message.reserved_name.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + value: Array.isArray(object?.value) ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, + reserved_range: Array.isArray(object?.reserved_range) + ? object.reserved_range.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) + : [], + reserved_name: Array.isArray(object?.reserved_name) ? object.reserved_name.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: EnumDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.value) { + obj.value = message.value.map((e) => e ? EnumValueDescriptorProto.toJSON(e) : undefined); + } else { + obj.value = []; + } + message.options !== undefined && (obj.options = message.options ? EnumOptions.toJSON(message.options) : undefined); + if (message.reserved_range) { + obj.reserved_range = message.reserved_range.map((e) => + e ? EnumDescriptorProto_EnumReservedRange.toJSON(e) : undefined + ); + } else { + obj.reserved_range = []; + } + if (message.reserved_name) { + obj.reserved_name = message.reserved_name.map((e) => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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.reserved_range = object.reserved_range?.map((e) => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || + []; + message.reserved_name = object.reserved_name?.map((e) => e) || []; + return message; + }, +}; + +function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { + return { start: 0, end: 0 }; +} + +export const EnumDescriptorProto_EnumReservedRange = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { + return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + }, + + toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + fromPartial, I>>( + object: I, + ): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { + return { name: "", number: 0, options: undefined }; +} + +export const EnumValueDescriptorProto = { + encode(message: EnumValueDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): EnumValueDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: EnumValueDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.options !== undefined && + (obj.options = message.options ? EnumValueOptions.toJSON(message.options) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseServiceDescriptorProto(): ServiceDescriptorProto { + return { name: "", method: [], options: undefined }; +} + +export const ServiceDescriptorProto = { + encode(message: ServiceDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ServiceDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + method: Array.isArray(object?.method) ? object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? ServiceOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: ServiceDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.method) { + obj.method = message.method.map((e) => e ? MethodDescriptorProto.toJSON(e) : undefined); + } else { + obj.method = []; + } + message.options !== undefined && + (obj.options = message.options ? ServiceOptions.toJSON(message.options) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseMethodDescriptorProto(): MethodDescriptorProto { + return { + name: "", + input_type: "", + output_type: "", + options: undefined, + client_streaming: false, + server_streaming: false, + }; +} + +export const MethodDescriptorProto = { + encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.input_type !== "") { + writer.uint32(18).string(message.input_type); + } + if (message.output_type !== "") { + writer.uint32(26).string(message.output_type); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + } + if (message.client_streaming === true) { + writer.uint32(40).bool(message.client_streaming); + } + if (message.server_streaming === true) { + writer.uint32(48).bool(message.server_streaming); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.input_type = reader.string(); + break; + case 3: + message.output_type = reader.string(); + break; + case 4: + message.options = MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.client_streaming = reader.bool(); + break; + case 6: + message.server_streaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MethodDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + input_type: isSet(object.input_type) ? String(object.input_type) : "", + output_type: isSet(object.output_type) ? String(object.output_type) : "", + options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, + client_streaming: isSet(object.client_streaming) ? Boolean(object.client_streaming) : false, + server_streaming: isSet(object.server_streaming) ? Boolean(object.server_streaming) : false, + }; + }, + + toJSON(message: MethodDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.input_type !== undefined && (obj.input_type = message.input_type); + message.output_type !== undefined && (obj.output_type = message.output_type); + message.options !== undefined && + (obj.options = message.options ? MethodOptions.toJSON(message.options) : undefined); + message.client_streaming !== undefined && (obj.client_streaming = message.client_streaming); + message.server_streaming !== undefined && (obj.server_streaming = message.server_streaming); + return obj; + }, + + fromPartial, I>>(object: I): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.input_type = object.input_type ?? ""; + message.output_type = object.output_type ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? MethodOptions.fromPartial(object.options) + : undefined; + message.client_streaming = object.client_streaming ?? false; + message.server_streaming = object.server_streaming ?? false; + return message; + }, +}; + +function createBaseFileOptions(): FileOptions { + return { + java_package: "", + java_outer_classname: "", + java_multiple_files: false, + java_generate_equals_and_hash: false, + java_string_check_utf8: false, + optimize_for: 1, + go_package: "", + cc_generic_services: false, + java_generic_services: false, + py_generic_services: false, + php_generic_services: false, + deprecated: false, + cc_enable_arenas: false, + objc_class_prefix: "", + csharp_namespace: "", + swift_prefix: "", + php_class_prefix: "", + php_namespace: "", + php_metadata_namespace: "", + ruby_package: "", + uninterpreted_option: [], + }; +} + +export const FileOptions = { + encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.java_package !== "") { + writer.uint32(10).string(message.java_package); + } + if (message.java_outer_classname !== "") { + writer.uint32(66).string(message.java_outer_classname); + } + if (message.java_multiple_files === true) { + writer.uint32(80).bool(message.java_multiple_files); + } + if (message.java_generate_equals_and_hash === true) { + writer.uint32(160).bool(message.java_generate_equals_and_hash); + } + if (message.java_string_check_utf8 === true) { + writer.uint32(216).bool(message.java_string_check_utf8); + } + if (message.optimize_for !== 1) { + writer.uint32(72).int32(message.optimize_for); + } + if (message.go_package !== "") { + writer.uint32(90).string(message.go_package); + } + if (message.cc_generic_services === true) { + writer.uint32(128).bool(message.cc_generic_services); + } + if (message.java_generic_services === true) { + writer.uint32(136).bool(message.java_generic_services); + } + if (message.py_generic_services === true) { + writer.uint32(144).bool(message.py_generic_services); + } + if (message.php_generic_services === true) { + writer.uint32(336).bool(message.php_generic_services); + } + if (message.deprecated === true) { + writer.uint32(184).bool(message.deprecated); + } + if (message.cc_enable_arenas === true) { + writer.uint32(248).bool(message.cc_enable_arenas); + } + if (message.objc_class_prefix !== "") { + writer.uint32(290).string(message.objc_class_prefix); + } + if (message.csharp_namespace !== "") { + writer.uint32(298).string(message.csharp_namespace); + } + if (message.swift_prefix !== "") { + writer.uint32(314).string(message.swift_prefix); + } + if (message.php_class_prefix !== "") { + writer.uint32(322).string(message.php_class_prefix); + } + if (message.php_namespace !== "") { + writer.uint32(330).string(message.php_namespace); + } + if (message.php_metadata_namespace !== "") { + writer.uint32(354).string(message.php_metadata_namespace); + } + if (message.ruby_package !== "") { + writer.uint32(362).string(message.ruby_package); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.java_package = reader.string(); + break; + case 8: + message.java_outer_classname = reader.string(); + break; + case 10: + message.java_multiple_files = reader.bool(); + break; + case 20: + message.java_generate_equals_and_hash = reader.bool(); + break; + case 27: + message.java_string_check_utf8 = reader.bool(); + break; + case 9: + message.optimize_for = reader.int32() as any; + break; + case 11: + message.go_package = reader.string(); + break; + case 16: + message.cc_generic_services = reader.bool(); + break; + case 17: + message.java_generic_services = reader.bool(); + break; + case 18: + message.py_generic_services = reader.bool(); + break; + case 42: + message.php_generic_services = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.cc_enable_arenas = reader.bool(); + break; + case 36: + message.objc_class_prefix = reader.string(); + break; + case 37: + message.csharp_namespace = reader.string(); + break; + case 39: + message.swift_prefix = reader.string(); + break; + case 40: + message.php_class_prefix = reader.string(); + break; + case 41: + message.php_namespace = reader.string(); + break; + case 44: + message.php_metadata_namespace = reader.string(); + break; + case 45: + message.ruby_package = reader.string(); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FileOptions { + return { + java_package: isSet(object.java_package) ? String(object.java_package) : "", + java_outer_classname: isSet(object.java_outer_classname) ? String(object.java_outer_classname) : "", + java_multiple_files: isSet(object.java_multiple_files) ? Boolean(object.java_multiple_files) : false, + java_generate_equals_and_hash: isSet(object.java_generate_equals_and_hash) + ? Boolean(object.java_generate_equals_and_hash) + : false, + java_string_check_utf8: isSet(object.java_string_check_utf8) ? Boolean(object.java_string_check_utf8) : false, + optimize_for: isSet(object.optimize_for) ? fileOptions_OptimizeModeFromJSON(object.optimize_for) : 1, + go_package: isSet(object.go_package) ? String(object.go_package) : "", + cc_generic_services: isSet(object.cc_generic_services) ? Boolean(object.cc_generic_services) : false, + java_generic_services: isSet(object.java_generic_services) ? Boolean(object.java_generic_services) : false, + py_generic_services: isSet(object.py_generic_services) ? Boolean(object.py_generic_services) : false, + php_generic_services: isSet(object.php_generic_services) ? Boolean(object.php_generic_services) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + cc_enable_arenas: isSet(object.cc_enable_arenas) ? Boolean(object.cc_enable_arenas) : false, + objc_class_prefix: isSet(object.objc_class_prefix) ? String(object.objc_class_prefix) : "", + csharp_namespace: isSet(object.csharp_namespace) ? String(object.csharp_namespace) : "", + swift_prefix: isSet(object.swift_prefix) ? String(object.swift_prefix) : "", + php_class_prefix: isSet(object.php_class_prefix) ? String(object.php_class_prefix) : "", + php_namespace: isSet(object.php_namespace) ? String(object.php_namespace) : "", + php_metadata_namespace: isSet(object.php_metadata_namespace) ? String(object.php_metadata_namespace) : "", + ruby_package: isSet(object.ruby_package) ? String(object.ruby_package) : "", + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileOptions): unknown { + const obj: any = {}; + message.java_package !== undefined && (obj.java_package = message.java_package); + message.java_outer_classname !== undefined && (obj.java_outer_classname = message.java_outer_classname); + message.java_multiple_files !== undefined && (obj.java_multiple_files = message.java_multiple_files); + message.java_generate_equals_and_hash !== undefined && + (obj.java_generate_equals_and_hash = message.java_generate_equals_and_hash); + message.java_string_check_utf8 !== undefined && (obj.java_string_check_utf8 = message.java_string_check_utf8); + message.optimize_for !== undefined && (obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimize_for)); + message.go_package !== undefined && (obj.go_package = message.go_package); + message.cc_generic_services !== undefined && (obj.cc_generic_services = message.cc_generic_services); + message.java_generic_services !== undefined && (obj.java_generic_services = message.java_generic_services); + message.py_generic_services !== undefined && (obj.py_generic_services = message.py_generic_services); + message.php_generic_services !== undefined && (obj.php_generic_services = message.php_generic_services); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.cc_enable_arenas !== undefined && (obj.cc_enable_arenas = message.cc_enable_arenas); + message.objc_class_prefix !== undefined && (obj.objc_class_prefix = message.objc_class_prefix); + message.csharp_namespace !== undefined && (obj.csharp_namespace = message.csharp_namespace); + message.swift_prefix !== undefined && (obj.swift_prefix = message.swift_prefix); + message.php_class_prefix !== undefined && (obj.php_class_prefix = message.php_class_prefix); + message.php_namespace !== undefined && (obj.php_namespace = message.php_namespace); + message.php_metadata_namespace !== undefined && (obj.php_metadata_namespace = message.php_metadata_namespace); + message.ruby_package !== undefined && (obj.ruby_package = message.ruby_package); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): FileOptions { + const message = createBaseFileOptions(); + message.java_package = object.java_package ?? ""; + message.java_outer_classname = object.java_outer_classname ?? ""; + message.java_multiple_files = object.java_multiple_files ?? false; + message.java_generate_equals_and_hash = object.java_generate_equals_and_hash ?? false; + message.java_string_check_utf8 = object.java_string_check_utf8 ?? false; + message.optimize_for = object.optimize_for ?? 1; + message.go_package = object.go_package ?? ""; + message.cc_generic_services = object.cc_generic_services ?? false; + message.java_generic_services = object.java_generic_services ?? false; + message.py_generic_services = object.py_generic_services ?? false; + message.php_generic_services = object.php_generic_services ?? false; + message.deprecated = object.deprecated ?? false; + message.cc_enable_arenas = object.cc_enable_arenas ?? false; + message.objc_class_prefix = object.objc_class_prefix ?? ""; + message.csharp_namespace = object.csharp_namespace ?? ""; + message.swift_prefix = object.swift_prefix ?? ""; + message.php_class_prefix = object.php_class_prefix ?? ""; + message.php_namespace = object.php_namespace ?? ""; + message.php_metadata_namespace = object.php_metadata_namespace ?? ""; + message.ruby_package = object.ruby_package ?? ""; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMessageOptions(): MessageOptions { + return { + message_set_wire_format: false, + no_standard_descriptor_accessor: false, + deprecated: false, + map_entry: false, + uninterpreted_option: [], + }; +} + +export const MessageOptions = { + encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.message_set_wire_format === true) { + writer.uint32(8).bool(message.message_set_wire_format); + } + if (message.no_standard_descriptor_accessor === true) { + writer.uint32(16).bool(message.no_standard_descriptor_accessor); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.map_entry === true) { + writer.uint32(56).bool(message.map_entry); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.message_set_wire_format = reader.bool(); + break; + case 2: + message.no_standard_descriptor_accessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.map_entry = reader.bool(); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MessageOptions { + return { + message_set_wire_format: isSet(object.message_set_wire_format) ? Boolean(object.message_set_wire_format) : false, + no_standard_descriptor_accessor: isSet(object.no_standard_descriptor_accessor) + ? Boolean(object.no_standard_descriptor_accessor) + : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + map_entry: isSet(object.map_entry) ? Boolean(object.map_entry) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MessageOptions): unknown { + const obj: any = {}; + message.message_set_wire_format !== undefined && (obj.message_set_wire_format = message.message_set_wire_format); + message.no_standard_descriptor_accessor !== undefined && + (obj.no_standard_descriptor_accessor = message.no_standard_descriptor_accessor); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.map_entry !== undefined && (obj.map_entry = message.map_entry); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MessageOptions { + const message = createBaseMessageOptions(); + message.message_set_wire_format = object.message_set_wire_format ?? false; + message.no_standard_descriptor_accessor = object.no_standard_descriptor_accessor ?? false; + message.deprecated = object.deprecated ?? false; + message.map_entry = object.map_entry ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFieldOptions(): FieldOptions { + return { ctype: 0, packed: false, jstype: 0, lazy: false, deprecated: false, weak: false, uninterpreted_option: [] }; +} + +export const FieldOptions = { + encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.ctype !== 0) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed === true) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== 0) { + writer.uint32(48).int32(message.jstype); + } + if (message.lazy === true) { + writer.uint32(40).bool(message.lazy); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak === true) { + writer.uint32(80).bool(message.weak); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FieldOptions { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + packed: isSet(object.packed) ? Boolean(object.packed) : false, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, + lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? Boolean(object.weak) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FieldOptions): unknown { + const obj: any = {}; + message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); + message.packed !== undefined && (obj.packed = message.packed); + message.jstype !== undefined && (obj.jstype = fieldOptions_JSTypeToJSON(message.jstype)); + message.lazy !== undefined && (obj.lazy = message.lazy); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.weak !== undefined && (obj.weak = message.weak); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): FieldOptions { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? 0; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? 0; + message.lazy = object.lazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { uninterpreted_option: [] }; +} + +export const OneofOptions = { + encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { allow_alias: false, deprecated: false, uninterpreted_option: [] }; +} + +export const EnumOptions = { + encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.allow_alias === true) { + writer.uint32(16).bool(message.allow_alias); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.allow_alias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allow_alias: isSet(object.allow_alias) ? Boolean(object.allow_alias) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + message.allow_alias !== undefined && (obj.allow_alias = message.allow_alias); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): EnumOptions { + const message = createBaseEnumOptions(); + message.allow_alias = object.allow_alias ?? false; + message.deprecated = object.deprecated ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumValueOptions(): EnumValueOptions { + return { deprecated: false, uninterpreted_option: [] }; +} + +export const EnumValueOptions = { + encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(8).bool(message.deprecated); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumValueOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumValueOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): EnumValueOptions { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseServiceOptions(): ServiceOptions { + return { deprecated: false, uninterpreted_option: [] }; +} + +export const ServiceOptions = { + encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 33: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ServiceOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ServiceOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ServiceOptions { + const message = createBaseServiceOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMethodOptions(): MethodOptions { + return { deprecated: false, idempotency_level: 0, uninterpreted_option: [] }; +} + +export const MethodOptions = { + encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotency_level !== 0) { + writer.uint32(272).int32(message.idempotency_level); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.idempotency_level = reader.int32() as any; + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MethodOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + idempotency_level: isSet(object.idempotency_level) + ? methodOptions_IdempotencyLevelFromJSON(object.idempotency_level) + : 0, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MethodOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.idempotency_level !== undefined && + (obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotency_level)); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MethodOptions { + const message = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotency_level = object.idempotency_level ?? 0; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUninterpretedOption(): UninterpretedOption { + return { + name: [], + identifier_value: "", + positive_int_value: "0", + negative_int_value: "0", + double_value: 0, + string_value: new Uint8Array(), + aggregate_value: "", + }; +} + +export const UninterpretedOption = { + encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.name) { + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.identifier_value !== "") { + writer.uint32(26).string(message.identifier_value); + } + if (message.positive_int_value !== "0") { + writer.uint32(32).uint64(message.positive_int_value); + } + if (message.negative_int_value !== "0") { + writer.uint32(40).int64(message.negative_int_value); + } + if (message.double_value !== 0) { + writer.uint32(49).double(message.double_value); + } + if (message.string_value.length !== 0) { + writer.uint32(58).bytes(message.string_value); + } + if (message.aggregate_value !== "") { + writer.uint32(66).string(message.aggregate_value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.identifier_value = reader.string(); + break; + case 4: + message.positive_int_value = longToString(reader.uint64() as Long); + break; + case 5: + message.negative_int_value = longToString(reader.int64() as Long); + break; + case 6: + message.double_value = reader.double(); + break; + case 7: + message.string_value = reader.bytes(); + break; + case 8: + message.aggregate_value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UninterpretedOption { + return { + name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], + identifier_value: isSet(object.identifier_value) ? String(object.identifier_value) : "", + positive_int_value: isSet(object.positive_int_value) ? String(object.positive_int_value) : "0", + negative_int_value: isSet(object.negative_int_value) ? String(object.negative_int_value) : "0", + double_value: isSet(object.double_value) ? Number(object.double_value) : 0, + string_value: isSet(object.string_value) ? bytesFromBase64(object.string_value) : new Uint8Array(), + aggregate_value: isSet(object.aggregate_value) ? String(object.aggregate_value) : "", + }; + }, + + toJSON(message: UninterpretedOption): unknown { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map((e) => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); + } else { + obj.name = []; + } + message.identifier_value !== undefined && (obj.identifier_value = message.identifier_value); + message.positive_int_value !== undefined && (obj.positive_int_value = message.positive_int_value); + message.negative_int_value !== undefined && (obj.negative_int_value = message.negative_int_value); + message.double_value !== undefined && (obj.double_value = message.double_value); + message.string_value !== undefined && + (obj.string_value = base64FromBytes( + message.string_value !== undefined ? message.string_value : new Uint8Array(), + )); + message.aggregate_value !== undefined && (obj.aggregate_value = message.aggregate_value); + return obj; + }, + + fromPartial, I>>(object: I): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map((e) => UninterpretedOption_NamePart.fromPartial(e)) || []; + message.identifier_value = object.identifier_value ?? ""; + message.positive_int_value = object.positive_int_value ?? "0"; + message.negative_int_value = object.negative_int_value ?? "0"; + message.double_value = object.double_value ?? 0; + message.string_value = object.string_value ?? new Uint8Array(); + message.aggregate_value = object.aggregate_value ?? ""; + return message; + }, +}; + +function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { + return { name_part: "", is_extension: false }; +} + +export const UninterpretedOption_NamePart = { + encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name_part !== "") { + writer.uint32(10).string(message.name_part); + } + if (message.is_extension === true) { + writer.uint32(16).bool(message.is_extension); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.name_part = reader.string(); + break; + case 2: + message.is_extension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UninterpretedOption_NamePart { + return { + name_part: isSet(object.name_part) ? String(object.name_part) : "", + is_extension: isSet(object.is_extension) ? Boolean(object.is_extension) : false, + }; + }, + + toJSON(message: UninterpretedOption_NamePart): unknown { + const obj: any = {}; + message.name_part !== undefined && (obj.name_part = message.name_part); + message.is_extension !== undefined && (obj.is_extension = message.is_extension); + return obj; + }, + + fromPartial, I>>(object: I): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + message.name_part = object.name_part ?? ""; + message.is_extension = object.is_extension ?? false; + return message; + }, +}; + +function createBaseSourceCodeInfo(): SourceCodeInfo { + return { location: [] }; +} + +export const SourceCodeInfo = { + encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SourceCodeInfo { + return { + location: Array.isArray(object?.location) + ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfo): unknown { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map((e) => e ? SourceCodeInfo_Location.toJSON(e) : undefined); + } else { + obj.location = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map((e) => SourceCodeInfo_Location.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { + return { path: [], span: [], leading_comments: "", trailing_comments: "", leading_detached_comments: [] }; +} + +export const SourceCodeInfo_Location = { + encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.leading_comments !== "") { + writer.uint32(26).string(message.leading_comments); + } + if (message.trailing_comments !== "") { + writer.uint32(34).string(message.trailing_comments); + } + for (const v of message.leading_detached_comments) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.leading_comments = reader.string(); + break; + case 4: + message.trailing_comments = reader.string(); + break; + case 6: + message.leading_detached_comments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SourceCodeInfo_Location { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], + span: Array.isArray(object?.span) ? object.span.map((e: any) => Number(e)) : [], + leading_comments: isSet(object.leading_comments) ? String(object.leading_comments) : "", + trailing_comments: isSet(object.trailing_comments) ? String(object.trailing_comments) : "", + leading_detached_comments: Array.isArray(object?.leading_detached_comments) + ? object.leading_detached_comments.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfo_Location): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } else { + obj.path = []; + } + if (message.span) { + obj.span = message.span.map((e) => Math.round(e)); + } else { + obj.span = []; + } + message.leading_comments !== undefined && (obj.leading_comments = message.leading_comments); + message.trailing_comments !== undefined && (obj.trailing_comments = message.trailing_comments); + if (message.leading_detached_comments) { + obj.leading_detached_comments = message.leading_detached_comments.map((e) => e); + } else { + obj.leading_detached_comments = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map((e) => e) || []; + message.span = object.span?.map((e) => e) || []; + message.leading_comments = object.leading_comments ?? ""; + message.trailing_comments = object.trailing_comments ?? ""; + message.leading_detached_comments = object.leading_detached_comments?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { + return { annotation: [] }; +} + +export const GeneratedCodeInfo = { + encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): GeneratedCodeInfo { + return { + annotation: Array.isArray(object?.annotation) + ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneratedCodeInfo): unknown { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map((e) => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); + } else { + obj.annotation = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map((e) => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { + return { path: [], source_file: "", begin: 0, end: 0 }; +} + +export const GeneratedCodeInfo_Annotation = { + encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + if (message.source_file !== "") { + writer.uint32(18).string(message.source_file); + } + if (message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== 0) { + writer.uint32(32).int32(message.end); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.source_file = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GeneratedCodeInfo_Annotation { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], + source_file: isSet(object.source_file) ? String(object.source_file) : "", + begin: isSet(object.begin) ? Number(object.begin) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + }; + }, + + toJSON(message: GeneratedCodeInfo_Annotation): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } else { + obj.path = []; + } + message.source_file !== undefined && (obj.source_file = message.source_file); + message.begin !== undefined && (obj.begin = Math.round(message.begin)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + fromPartial, I>>(object: I): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map((e) => e) || []; + message.source_file = object.source_file ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/google/protobuf/duration.ts b/common/types/src/client/google/protobuf/duration.ts new file mode 100644 index 00000000..8ea1d106 --- /dev/null +++ b/common/types/src/client/google/protobuf/duration.ts @@ -0,0 +1,165 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * 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 (durations.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: string; + /** + * 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; +} + +function createBaseDuration(): Duration { + return { seconds: "0", nanos: 0 }; +} + +export const Duration = { + encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.seconds !== "0") { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Duration { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? String(object.seconds) : "0", + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = message.seconds); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + fromPartial, I>>(object: I): Duration { + const message = createBaseDuration(); + message.seconds = object.seconds ?? "0"; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/google/protobuf/empty.ts b/common/types/src/client/google/protobuf/empty.ts new file mode 100644 index 00000000..58ef8256 --- /dev/null +++ b/common/types/src/client/google/protobuf/empty.ts @@ -0,0 +1,68 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + * + * The JSON representation for `Empty` is empty JSON object `{}`. + */ +export interface Empty { +} + +function createBaseEmpty(): Empty { + return {}; +} + +export const Empty = { + encode(_: Empty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Empty { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmpty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): Empty { + return {}; + }, + + toJSON(_: Empty): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Empty { + const message = createBaseEmpty(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/client/google/protobuf/timestamp.ts b/common/types/src/client/google/protobuf/timestamp.ts new file mode 100644 index 00000000..8e3ff86f --- /dev/null +++ b/common/types/src/client/google/protobuf/timestamp.ts @@ -0,0 +1,186 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * 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 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://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) 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: string; + /** + * 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; +} + +function createBaseTimestamp(): Timestamp { + return { seconds: "0", nanos: 0 }; +} + +export const Timestamp = { + encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.seconds !== "0") { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) ? String(object.seconds) : "0", + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = message.seconds); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + fromPartial, I>>(object: I): Timestamp { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? "0"; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/bundles/v1beta1/bundles.ts b/common/types/src/client/kyve/bundles/v1beta1/bundles.ts new file mode 100644 index 00000000..119a15db --- /dev/null +++ b/common/types/src/client/kyve/bundles/v1beta1/bundles.ts @@ -0,0 +1,545 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** + * BundleStatus represents the status of an evaluated bundle + * proposal. + */ +export enum BundleStatus { + /** BUNDLE_STATUS_UNSPECIFIED - BUNDLE_STATUS_UNSPECIFIED ... */ + BUNDLE_STATUS_UNSPECIFIED = 0, + /** BUNDLE_STATUS_VALID - BUNDLE_STATUS_VALID ... */ + BUNDLE_STATUS_VALID = 1, + /** BUNDLE_STATUS_INVALID - BUNDLE_STATUS_INVALID ... */ + BUNDLE_STATUS_INVALID = 2, + /** BUNDLE_STATUS_NO_FUNDS - BUNDLE_STATUS_NO_FUNDS ... */ + BUNDLE_STATUS_NO_FUNDS = 3, + /** BUNDLE_STATUS_NO_QUORUM - BUNDLE_STATUS_NO_QUORUM ... */ + BUNDLE_STATUS_NO_QUORUM = 4, + UNRECOGNIZED = -1, +} + +export function bundleStatusFromJSON(object: any): BundleStatus { + switch (object) { + case 0: + case "BUNDLE_STATUS_UNSPECIFIED": + return BundleStatus.BUNDLE_STATUS_UNSPECIFIED; + case 1: + case "BUNDLE_STATUS_VALID": + return BundleStatus.BUNDLE_STATUS_VALID; + case 2: + case "BUNDLE_STATUS_INVALID": + return BundleStatus.BUNDLE_STATUS_INVALID; + case 3: + case "BUNDLE_STATUS_NO_FUNDS": + return BundleStatus.BUNDLE_STATUS_NO_FUNDS; + case 4: + case "BUNDLE_STATUS_NO_QUORUM": + return BundleStatus.BUNDLE_STATUS_NO_QUORUM; + case -1: + case "UNRECOGNIZED": + default: + return BundleStatus.UNRECOGNIZED; + } +} + +export function bundleStatusToJSON(object: BundleStatus): string { + switch (object) { + case BundleStatus.BUNDLE_STATUS_UNSPECIFIED: + return "BUNDLE_STATUS_UNSPECIFIED"; + case BundleStatus.BUNDLE_STATUS_VALID: + return "BUNDLE_STATUS_VALID"; + case BundleStatus.BUNDLE_STATUS_INVALID: + return "BUNDLE_STATUS_INVALID"; + case BundleStatus.BUNDLE_STATUS_NO_FUNDS: + return "BUNDLE_STATUS_NO_FUNDS"; + case BundleStatus.BUNDLE_STATUS_NO_QUORUM: + return "BUNDLE_STATUS_NO_QUORUM"; + case BundleStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * BundleProposal represents the current bundle proposal + * of a storage pool + */ +export interface BundleProposal { + /** pool_id is the id of the pool for which this proposal is for */ + pool_id: string; + /** storage_id is the id with which the data can be retrieved from */ + storage_id: string; + /** uploader is the address of the staker who submitted the current proposal */ + uploader: string; + /** next_uploader is the address of the staker who should upload the next proposal */ + next_uploader: string; + /** data_size the size of the data in bytes */ + data_size: string; + /** bundle_size the size of the bundle (amount of data items) */ + bundle_size: string; + /** to_key the key of the last data item in the bundle proposal */ + to_key: string; + /** bundle_summary a string summary of the current proposal */ + bundle_summary: string; + /** data_hash a sha256 hash of the raw compressed data */ + data_hash: string; + /** updated_at the last time this proposal was edited */ + updated_at: string; + /** voters_valid list of all stakers who voted in favor for current proposal */ + voters_valid: string[]; + /** voters_invalid list of all stakers who voted against for current proposal */ + voters_invalid: string[]; + /** voters_abstain list of all stakers who voted abstain for current proposal */ + voters_abstain: string[]; + /** from_key the key of the first data item in the bundle proposal */ + from_key: string; + /** storage_provider_id the id of the storage provider where the bundle is stored */ + storage_provider_id: number; + /** compression_id the id of the compression type with which the data was compressed */ + compression_id: number; +} + +/** + * FinalizedBundle represents a bundle proposal where the majority + * agreed on its validity + */ +export interface FinalizedBundle { + /** pool_id is the id of the pool for which this proposal is for */ + pool_id: string; + /** id is a unique identifier for each finalized bundle in a pool */ + id: string; + /** storage_id is the id with which the data can be retrieved from */ + storage_id: string; + /** uploader is the address of the staker who submitted this bundle */ + uploader: string; + /** from_index is the index from where the bundle starts (inclusive) */ + from_index: string; + /** to_index is the index to which the bundle goes (exclusive) */ + to_index: string; + /** to_key the key of the last data item in the bundle proposal */ + to_key: string; + /** bundle_summary a string summary of the current proposal */ + bundle_summary: string; + /** data_hash a sha256 hash of the raw compressed data */ + data_hash: string; + /** finalized_at is the block height at which this bundle got finalized */ + finalized_at: string; + /** from_key the key of the first data item in the bundle proposal */ + from_key: string; + /** storage_provider_id the id of the storage provider where the bundle is stored */ + storage_provider_id: number; + /** compression_id the id of the compression type with which the data was compressed */ + compression_id: number; +} + +function createBaseBundleProposal(): BundleProposal { + return { + pool_id: "0", + storage_id: "", + uploader: "", + next_uploader: "", + data_size: "0", + bundle_size: "0", + to_key: "", + bundle_summary: "", + data_hash: "", + updated_at: "0", + voters_valid: [], + voters_invalid: [], + voters_abstain: [], + from_key: "", + storage_provider_id: 0, + compression_id: 0, + }; +} + +export const BundleProposal = { + encode(message: BundleProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.storage_id !== "") { + writer.uint32(18).string(message.storage_id); + } + if (message.uploader !== "") { + writer.uint32(26).string(message.uploader); + } + if (message.next_uploader !== "") { + writer.uint32(34).string(message.next_uploader); + } + if (message.data_size !== "0") { + writer.uint32(40).uint64(message.data_size); + } + if (message.bundle_size !== "0") { + writer.uint32(48).uint64(message.bundle_size); + } + if (message.to_key !== "") { + writer.uint32(58).string(message.to_key); + } + if (message.bundle_summary !== "") { + writer.uint32(66).string(message.bundle_summary); + } + if (message.data_hash !== "") { + writer.uint32(74).string(message.data_hash); + } + if (message.updated_at !== "0") { + writer.uint32(80).uint64(message.updated_at); + } + for (const v of message.voters_valid) { + writer.uint32(90).string(v!); + } + for (const v of message.voters_invalid) { + writer.uint32(98).string(v!); + } + for (const v of message.voters_abstain) { + writer.uint32(106).string(v!); + } + if (message.from_key !== "") { + writer.uint32(114).string(message.from_key); + } + if (message.storage_provider_id !== 0) { + writer.uint32(120).uint32(message.storage_provider_id); + } + if (message.compression_id !== 0) { + writer.uint32(128).uint32(message.compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BundleProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBundleProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.storage_id = reader.string(); + break; + case 3: + message.uploader = reader.string(); + break; + case 4: + message.next_uploader = reader.string(); + break; + case 5: + message.data_size = longToString(reader.uint64() as Long); + break; + case 6: + message.bundle_size = longToString(reader.uint64() as Long); + break; + case 7: + message.to_key = reader.string(); + break; + case 8: + message.bundle_summary = reader.string(); + break; + case 9: + message.data_hash = reader.string(); + break; + case 10: + message.updated_at = longToString(reader.uint64() as Long); + break; + case 11: + message.voters_valid.push(reader.string()); + break; + case 12: + message.voters_invalid.push(reader.string()); + break; + case 13: + message.voters_abstain.push(reader.string()); + break; + case 14: + message.from_key = reader.string(); + break; + case 15: + message.storage_provider_id = reader.uint32(); + break; + case 16: + message.compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BundleProposal { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + uploader: isSet(object.uploader) ? String(object.uploader) : "", + next_uploader: isSet(object.next_uploader) ? String(object.next_uploader) : "", + data_size: isSet(object.data_size) ? String(object.data_size) : "0", + bundle_size: isSet(object.bundle_size) ? String(object.bundle_size) : "0", + to_key: isSet(object.to_key) ? String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? String(object.data_hash) : "", + updated_at: isSet(object.updated_at) ? String(object.updated_at) : "0", + voters_valid: Array.isArray(object?.voters_valid) ? object.voters_valid.map((e: any) => String(e)) : [], + voters_invalid: Array.isArray(object?.voters_invalid) ? object.voters_invalid.map((e: any) => String(e)) : [], + voters_abstain: Array.isArray(object?.voters_abstain) ? object.voters_abstain.map((e: any) => String(e)) : [], + from_key: isSet(object.from_key) ? String(object.from_key) : "", + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? Number(object.compression_id) : 0, + }; + }, + + toJSON(message: BundleProposal): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.uploader !== undefined && (obj.uploader = message.uploader); + message.next_uploader !== undefined && (obj.next_uploader = message.next_uploader); + message.data_size !== undefined && (obj.data_size = message.data_size); + message.bundle_size !== undefined && (obj.bundle_size = message.bundle_size); + message.to_key !== undefined && (obj.to_key = message.to_key); + message.bundle_summary !== undefined && (obj.bundle_summary = message.bundle_summary); + message.data_hash !== undefined && (obj.data_hash = message.data_hash); + message.updated_at !== undefined && (obj.updated_at = message.updated_at); + if (message.voters_valid) { + obj.voters_valid = message.voters_valid.map((e) => e); + } else { + obj.voters_valid = []; + } + if (message.voters_invalid) { + obj.voters_invalid = message.voters_invalid.map((e) => e); + } else { + obj.voters_invalid = []; + } + if (message.voters_abstain) { + obj.voters_abstain = message.voters_abstain.map((e) => e); + } else { + obj.voters_abstain = []; + } + message.from_key !== undefined && (obj.from_key = message.from_key); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + message.compression_id !== undefined && (obj.compression_id = Math.round(message.compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): BundleProposal { + const message = createBaseBundleProposal(); + message.pool_id = object.pool_id ?? "0"; + message.storage_id = object.storage_id ?? ""; + message.uploader = object.uploader ?? ""; + message.next_uploader = object.next_uploader ?? ""; + message.data_size = object.data_size ?? "0"; + message.bundle_size = object.bundle_size ?? "0"; + message.to_key = object.to_key ?? ""; + message.bundle_summary = object.bundle_summary ?? ""; + message.data_hash = object.data_hash ?? ""; + message.updated_at = object.updated_at ?? "0"; + message.voters_valid = object.voters_valid?.map((e) => e) || []; + message.voters_invalid = object.voters_invalid?.map((e) => e) || []; + message.voters_abstain = object.voters_abstain?.map((e) => e) || []; + message.from_key = object.from_key ?? ""; + message.storage_provider_id = object.storage_provider_id ?? 0; + message.compression_id = object.compression_id ?? 0; + return message; + }, +}; + +function createBaseFinalizedBundle(): FinalizedBundle { + return { + pool_id: "0", + id: "0", + storage_id: "", + uploader: "", + from_index: "0", + to_index: "0", + to_key: "", + bundle_summary: "", + data_hash: "", + finalized_at: "0", + from_key: "", + storage_provider_id: 0, + compression_id: 0, + }; +} + +export const FinalizedBundle = { + encode(message: FinalizedBundle, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.storage_id !== "") { + writer.uint32(26).string(message.storage_id); + } + if (message.uploader !== "") { + writer.uint32(34).string(message.uploader); + } + if (message.from_index !== "0") { + writer.uint32(40).uint64(message.from_index); + } + if (message.to_index !== "0") { + writer.uint32(48).uint64(message.to_index); + } + if (message.to_key !== "") { + writer.uint32(58).string(message.to_key); + } + if (message.bundle_summary !== "") { + writer.uint32(66).string(message.bundle_summary); + } + if (message.data_hash !== "") { + writer.uint32(74).string(message.data_hash); + } + if (message.finalized_at !== "0") { + writer.uint32(80).uint64(message.finalized_at); + } + if (message.from_key !== "") { + writer.uint32(90).string(message.from_key); + } + if (message.storage_provider_id !== 0) { + writer.uint32(96).uint32(message.storage_provider_id); + } + if (message.compression_id !== 0) { + writer.uint32(104).uint32(message.compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FinalizedBundle { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFinalizedBundle(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.storage_id = reader.string(); + break; + case 4: + message.uploader = reader.string(); + break; + case 5: + message.from_index = longToString(reader.uint64() as Long); + break; + case 6: + message.to_index = longToString(reader.uint64() as Long); + break; + case 7: + message.to_key = reader.string(); + break; + case 8: + message.bundle_summary = reader.string(); + break; + case 9: + message.data_hash = reader.string(); + break; + case 10: + message.finalized_at = longToString(reader.uint64() as Long); + break; + case 11: + message.from_key = reader.string(); + break; + case 12: + message.storage_provider_id = reader.uint32(); + break; + case 13: + message.compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FinalizedBundle { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + uploader: isSet(object.uploader) ? String(object.uploader) : "", + from_index: isSet(object.from_index) ? String(object.from_index) : "0", + to_index: isSet(object.to_index) ? String(object.to_index) : "0", + to_key: isSet(object.to_key) ? String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? String(object.data_hash) : "", + finalized_at: isSet(object.finalized_at) ? String(object.finalized_at) : "0", + from_key: isSet(object.from_key) ? String(object.from_key) : "", + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? Number(object.compression_id) : 0, + }; + }, + + toJSON(message: FinalizedBundle): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.uploader !== undefined && (obj.uploader = message.uploader); + message.from_index !== undefined && (obj.from_index = message.from_index); + message.to_index !== undefined && (obj.to_index = message.to_index); + message.to_key !== undefined && (obj.to_key = message.to_key); + message.bundle_summary !== undefined && (obj.bundle_summary = message.bundle_summary); + message.data_hash !== undefined && (obj.data_hash = message.data_hash); + message.finalized_at !== undefined && (obj.finalized_at = message.finalized_at); + message.from_key !== undefined && (obj.from_key = message.from_key); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + message.compression_id !== undefined && (obj.compression_id = Math.round(message.compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): FinalizedBundle { + const message = createBaseFinalizedBundle(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + message.storage_id = object.storage_id ?? ""; + message.uploader = object.uploader ?? ""; + message.from_index = object.from_index ?? "0"; + message.to_index = object.to_index ?? "0"; + message.to_key = object.to_key ?? ""; + message.bundle_summary = object.bundle_summary ?? ""; + message.data_hash = object.data_hash ?? ""; + message.finalized_at = object.finalized_at ?? "0"; + message.from_key = object.from_key ?? ""; + message.storage_provider_id = object.storage_provider_id ?? 0; + message.compression_id = object.compression_id ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/bundles/v1beta1/events.ts b/common/types/src/client/kyve/bundles/v1beta1/events.ts new file mode 100644 index 00000000..bd3e510f --- /dev/null +++ b/common/types/src/client/kyve/bundles/v1beta1/events.ts @@ -0,0 +1,889 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { BundleStatus, bundleStatusFromJSON, bundleStatusToJSON } from "./bundles"; +import { VoteType, voteTypeFromJSON, voteTypeToJSON } from "./tx"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** + * EventBundleVote is an event emitted when a protocol node votes on a bundle. + * emitted_by: MsgVoteBundleProposal + */ +export interface EventBundleVote { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** staker is the account staker of the protocol node. */ + staker: string; + /** storage_id is the unique ID of the bundle. */ + storage_id: string; + /** vote is for what the validator voted with */ + vote: VoteType; +} + +/** + * EventBundleProposed is submitted by the MsgSubmitBundleProposal message + * emitted_by: MsgSubmitBundleProposal + */ +export interface EventBundleProposed { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** internal id for the KYVE-bundle */ + id: string; + /** + * storage_id is the ID to retrieve to data item from the configured storage provider + * e.g. the ARWEAVE-id + */ + storage_id: string; + /** Address of the uploader/proposer of the bundle */ + uploader: string; + /** data_size size in bytes of the data */ + data_size: string; + /** from_index starting index of the bundle (inclusive) */ + from_index: string; + /** bundle_size amount of data items in the bundle */ + bundle_size: string; + /** from_key the key of the first data item in the bundle */ + from_key: string; + /** to_key the key of the last data item in the bundle */ + to_key: string; + /** + * bundle_summary is a short string holding some useful information of + * the bundle which will get stored on-chain + */ + bundle_summary: string; + /** data_hash is a sha256 hash of the raw compressed data */ + data_hash: string; + /** proposed_at the unix time when the bundle was proposed */ + proposed_at: string; + /** + * storage_provider_id the unique id of the storage provider where + * the data of the bundle is tored + */ + storage_provider_id: number; + /** + * compression_id the unique id of the compression type the data + * of the bundle was compressed with + */ + compression_id: number; +} + +/** + * EventBundleFinalized is an event emitted when a bundle is finalised. + * emitted_by: MsgSubmitBundleProposal, EndBlock + */ +export interface EventBundleFinalized { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** internal id for the KYVE-bundle */ + id: string; + /** total voting power which voted for valid */ + valid: string; + /** total voting power which voted for invalid */ + invalid: string; + /** total voting power which voted for abstain */ + abstain: string; + /** total voting power of the pool */ + total: string; + /** status of the finalized bundle */ + status: BundleStatus; + /** rewards transferred to treasury (in ukyve) */ + reward_treasury: string; + /** rewardUploader rewards directly transferred to uploader (in ukyve) */ + reward_uploader: string; + /** rewardDelegation rewards distributed among all delegators (in ukyve) */ + reward_delegation: string; + /** rewardTotal the total bundle reward */ + reward_total: string; + /** finalized_at the block height where the bundle got finalized */ + finalized_at: string; + /** uploader the address of the uploader of this bundle */ + uploader: string; + /** next_uploader the address of the next uploader after this bundle */ + next_uploader: string; +} + +/** + * EventClaimedUploaderRole is an event emitted when an uploader claims the uploader role + * emitted_by: MsgClaimUploaderRole + */ +export interface EventClaimedUploaderRole { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** id internal id for the KYVE-bundle */ + id: string; + /** + * new_uploader the address of the participant who claimed + * the free uploader role + */ + new_uploader: string; +} + +/** + * EventSkippedUploaderRole is an event emitted when an uploader skips the upload + * emitted_by: MsgSkipUploaderRole + */ +export interface EventSkippedUploaderRole { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** id internal id for the KYVE-bundle */ + id: string; + /** previous_uploader is the address of the staker who skipped his uploader role */ + previous_uploader: string; + /** new_uploader is the address of the new uploader who got automatically selected */ + new_uploader: string; +} + +/** + * EventPointIncreased is an event emitted when a staker receives a point + * emitted_by: MsgSubmitBundleProposal, EndBlock + */ +export interface EventPointIncreased { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** staker is the address of the staker who received the point */ + staker: string; + /** current_points is the amount of points the staker has now */ + current_points: string; +} + +/** + * EventPointIncreased is an event emitted when a staker receives a point + * emitted_by: MsgSubmitBundleProposal, EndBlock + */ +export interface EventPointsReset { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** staker is the address of the staker who has zero points now */ + staker: string; +} + +function createBaseEventBundleVote(): EventBundleVote { + return { pool_id: "0", staker: "", storage_id: "", vote: 0 }; +} + +export const EventBundleVote = { + encode(message: EventBundleVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.storage_id !== "") { + writer.uint32(26).string(message.storage_id); + } + if (message.vote !== 0) { + writer.uint32(32).int32(message.vote); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBundleVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.storage_id = reader.string(); + break; + case 4: + message.vote = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventBundleVote { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + vote: isSet(object.vote) ? voteTypeFromJSON(object.vote) : 0, + }; + }, + + toJSON(message: EventBundleVote): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.vote !== undefined && (obj.vote = voteTypeToJSON(message.vote)); + return obj; + }, + + fromPartial, I>>(object: I): EventBundleVote { + const message = createBaseEventBundleVote(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.storage_id = object.storage_id ?? ""; + message.vote = object.vote ?? 0; + return message; + }, +}; + +function createBaseEventBundleProposed(): EventBundleProposed { + return { + pool_id: "0", + id: "0", + storage_id: "", + uploader: "", + data_size: "0", + from_index: "0", + bundle_size: "0", + from_key: "", + to_key: "", + bundle_summary: "", + data_hash: "", + proposed_at: "0", + storage_provider_id: 0, + compression_id: 0, + }; +} + +export const EventBundleProposed = { + encode(message: EventBundleProposed, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.storage_id !== "") { + writer.uint32(26).string(message.storage_id); + } + if (message.uploader !== "") { + writer.uint32(34).string(message.uploader); + } + if (message.data_size !== "0") { + writer.uint32(40).uint64(message.data_size); + } + if (message.from_index !== "0") { + writer.uint32(48).uint64(message.from_index); + } + if (message.bundle_size !== "0") { + writer.uint32(56).uint64(message.bundle_size); + } + if (message.from_key !== "") { + writer.uint32(66).string(message.from_key); + } + if (message.to_key !== "") { + writer.uint32(74).string(message.to_key); + } + if (message.bundle_summary !== "") { + writer.uint32(82).string(message.bundle_summary); + } + if (message.data_hash !== "") { + writer.uint32(90).string(message.data_hash); + } + if (message.proposed_at !== "0") { + writer.uint32(96).uint64(message.proposed_at); + } + if (message.storage_provider_id !== 0) { + writer.uint32(104).uint32(message.storage_provider_id); + } + if (message.compression_id !== 0) { + writer.uint32(112).uint32(message.compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleProposed { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBundleProposed(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.storage_id = reader.string(); + break; + case 4: + message.uploader = reader.string(); + break; + case 5: + message.data_size = longToString(reader.uint64() as Long); + break; + case 6: + message.from_index = longToString(reader.uint64() as Long); + break; + case 7: + message.bundle_size = longToString(reader.uint64() as Long); + break; + case 8: + message.from_key = reader.string(); + break; + case 9: + message.to_key = reader.string(); + break; + case 10: + message.bundle_summary = reader.string(); + break; + case 11: + message.data_hash = reader.string(); + break; + case 12: + message.proposed_at = longToString(reader.uint64() as Long); + break; + case 13: + message.storage_provider_id = reader.uint32(); + break; + case 14: + message.compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventBundleProposed { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + uploader: isSet(object.uploader) ? String(object.uploader) : "", + data_size: isSet(object.data_size) ? String(object.data_size) : "0", + from_index: isSet(object.from_index) ? String(object.from_index) : "0", + bundle_size: isSet(object.bundle_size) ? String(object.bundle_size) : "0", + from_key: isSet(object.from_key) ? String(object.from_key) : "", + to_key: isSet(object.to_key) ? String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? String(object.data_hash) : "", + proposed_at: isSet(object.proposed_at) ? String(object.proposed_at) : "0", + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? Number(object.compression_id) : 0, + }; + }, + + toJSON(message: EventBundleProposed): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.uploader !== undefined && (obj.uploader = message.uploader); + message.data_size !== undefined && (obj.data_size = message.data_size); + message.from_index !== undefined && (obj.from_index = message.from_index); + message.bundle_size !== undefined && (obj.bundle_size = message.bundle_size); + message.from_key !== undefined && (obj.from_key = message.from_key); + message.to_key !== undefined && (obj.to_key = message.to_key); + message.bundle_summary !== undefined && (obj.bundle_summary = message.bundle_summary); + message.data_hash !== undefined && (obj.data_hash = message.data_hash); + message.proposed_at !== undefined && (obj.proposed_at = message.proposed_at); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + message.compression_id !== undefined && (obj.compression_id = Math.round(message.compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): EventBundleProposed { + const message = createBaseEventBundleProposed(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + message.storage_id = object.storage_id ?? ""; + message.uploader = object.uploader ?? ""; + message.data_size = object.data_size ?? "0"; + message.from_index = object.from_index ?? "0"; + message.bundle_size = object.bundle_size ?? "0"; + message.from_key = object.from_key ?? ""; + message.to_key = object.to_key ?? ""; + message.bundle_summary = object.bundle_summary ?? ""; + message.data_hash = object.data_hash ?? ""; + message.proposed_at = object.proposed_at ?? "0"; + message.storage_provider_id = object.storage_provider_id ?? 0; + message.compression_id = object.compression_id ?? 0; + return message; + }, +}; + +function createBaseEventBundleFinalized(): EventBundleFinalized { + return { + pool_id: "0", + id: "0", + valid: "0", + invalid: "0", + abstain: "0", + total: "0", + status: 0, + reward_treasury: "0", + reward_uploader: "0", + reward_delegation: "0", + reward_total: "0", + finalized_at: "0", + uploader: "", + next_uploader: "", + }; +} + +export const EventBundleFinalized = { + encode(message: EventBundleFinalized, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.valid !== "0") { + writer.uint32(24).uint64(message.valid); + } + if (message.invalid !== "0") { + writer.uint32(32).uint64(message.invalid); + } + if (message.abstain !== "0") { + writer.uint32(40).uint64(message.abstain); + } + if (message.total !== "0") { + writer.uint32(48).uint64(message.total); + } + if (message.status !== 0) { + writer.uint32(56).int32(message.status); + } + if (message.reward_treasury !== "0") { + writer.uint32(64).uint64(message.reward_treasury); + } + if (message.reward_uploader !== "0") { + writer.uint32(72).uint64(message.reward_uploader); + } + if (message.reward_delegation !== "0") { + writer.uint32(80).uint64(message.reward_delegation); + } + if (message.reward_total !== "0") { + writer.uint32(88).uint64(message.reward_total); + } + if (message.finalized_at !== "0") { + writer.uint32(96).uint64(message.finalized_at); + } + if (message.uploader !== "") { + writer.uint32(106).string(message.uploader); + } + if (message.next_uploader !== "") { + writer.uint32(114).string(message.next_uploader); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleFinalized { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBundleFinalized(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.valid = longToString(reader.uint64() as Long); + break; + case 4: + message.invalid = longToString(reader.uint64() as Long); + break; + case 5: + message.abstain = longToString(reader.uint64() as Long); + break; + case 6: + message.total = longToString(reader.uint64() as Long); + break; + case 7: + message.status = reader.int32() as any; + break; + case 8: + message.reward_treasury = longToString(reader.uint64() as Long); + break; + case 9: + message.reward_uploader = longToString(reader.uint64() as Long); + break; + case 10: + message.reward_delegation = longToString(reader.uint64() as Long); + break; + case 11: + message.reward_total = longToString(reader.uint64() as Long); + break; + case 12: + message.finalized_at = longToString(reader.uint64() as Long); + break; + case 13: + message.uploader = reader.string(); + break; + case 14: + message.next_uploader = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventBundleFinalized { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + valid: isSet(object.valid) ? String(object.valid) : "0", + invalid: isSet(object.invalid) ? String(object.invalid) : "0", + abstain: isSet(object.abstain) ? String(object.abstain) : "0", + total: isSet(object.total) ? String(object.total) : "0", + status: isSet(object.status) ? bundleStatusFromJSON(object.status) : 0, + reward_treasury: isSet(object.reward_treasury) ? String(object.reward_treasury) : "0", + reward_uploader: isSet(object.reward_uploader) ? String(object.reward_uploader) : "0", + reward_delegation: isSet(object.reward_delegation) ? String(object.reward_delegation) : "0", + reward_total: isSet(object.reward_total) ? String(object.reward_total) : "0", + finalized_at: isSet(object.finalized_at) ? String(object.finalized_at) : "0", + uploader: isSet(object.uploader) ? String(object.uploader) : "", + next_uploader: isSet(object.next_uploader) ? String(object.next_uploader) : "", + }; + }, + + toJSON(message: EventBundleFinalized): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + message.valid !== undefined && (obj.valid = message.valid); + message.invalid !== undefined && (obj.invalid = message.invalid); + message.abstain !== undefined && (obj.abstain = message.abstain); + message.total !== undefined && (obj.total = message.total); + message.status !== undefined && (obj.status = bundleStatusToJSON(message.status)); + message.reward_treasury !== undefined && (obj.reward_treasury = message.reward_treasury); + message.reward_uploader !== undefined && (obj.reward_uploader = message.reward_uploader); + message.reward_delegation !== undefined && (obj.reward_delegation = message.reward_delegation); + message.reward_total !== undefined && (obj.reward_total = message.reward_total); + message.finalized_at !== undefined && (obj.finalized_at = message.finalized_at); + message.uploader !== undefined && (obj.uploader = message.uploader); + message.next_uploader !== undefined && (obj.next_uploader = message.next_uploader); + return obj; + }, + + fromPartial, I>>(object: I): EventBundleFinalized { + const message = createBaseEventBundleFinalized(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + message.valid = object.valid ?? "0"; + message.invalid = object.invalid ?? "0"; + message.abstain = object.abstain ?? "0"; + message.total = object.total ?? "0"; + message.status = object.status ?? 0; + message.reward_treasury = object.reward_treasury ?? "0"; + message.reward_uploader = object.reward_uploader ?? "0"; + message.reward_delegation = object.reward_delegation ?? "0"; + message.reward_total = object.reward_total ?? "0"; + message.finalized_at = object.finalized_at ?? "0"; + message.uploader = object.uploader ?? ""; + message.next_uploader = object.next_uploader ?? ""; + return message; + }, +}; + +function createBaseEventClaimedUploaderRole(): EventClaimedUploaderRole { + return { pool_id: "0", id: "0", new_uploader: "" }; +} + +export const EventClaimedUploaderRole = { + encode(message: EventClaimedUploaderRole, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.new_uploader !== "") { + writer.uint32(26).string(message.new_uploader); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimedUploaderRole { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventClaimedUploaderRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.new_uploader = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventClaimedUploaderRole { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + new_uploader: isSet(object.new_uploader) ? String(object.new_uploader) : "", + }; + }, + + toJSON(message: EventClaimedUploaderRole): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + message.new_uploader !== undefined && (obj.new_uploader = message.new_uploader); + return obj; + }, + + fromPartial, I>>(object: I): EventClaimedUploaderRole { + const message = createBaseEventClaimedUploaderRole(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + message.new_uploader = object.new_uploader ?? ""; + return message; + }, +}; + +function createBaseEventSkippedUploaderRole(): EventSkippedUploaderRole { + return { pool_id: "0", id: "0", previous_uploader: "", new_uploader: "" }; +} + +export const EventSkippedUploaderRole = { + encode(message: EventSkippedUploaderRole, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.previous_uploader !== "") { + writer.uint32(26).string(message.previous_uploader); + } + if (message.new_uploader !== "") { + writer.uint32(34).string(message.new_uploader); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventSkippedUploaderRole { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSkippedUploaderRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.previous_uploader = reader.string(); + break; + case 4: + message.new_uploader = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventSkippedUploaderRole { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + previous_uploader: isSet(object.previous_uploader) ? String(object.previous_uploader) : "", + new_uploader: isSet(object.new_uploader) ? String(object.new_uploader) : "", + }; + }, + + toJSON(message: EventSkippedUploaderRole): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + message.previous_uploader !== undefined && (obj.previous_uploader = message.previous_uploader); + message.new_uploader !== undefined && (obj.new_uploader = message.new_uploader); + return obj; + }, + + fromPartial, I>>(object: I): EventSkippedUploaderRole { + const message = createBaseEventSkippedUploaderRole(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + message.previous_uploader = object.previous_uploader ?? ""; + message.new_uploader = object.new_uploader ?? ""; + return message; + }, +}; + +function createBaseEventPointIncreased(): EventPointIncreased { + return { pool_id: "0", staker: "", current_points: "0" }; +} + +export const EventPointIncreased = { + encode(message: EventPointIncreased, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.current_points !== "0") { + writer.uint32(24).uint64(message.current_points); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventPointIncreased { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventPointIncreased(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.current_points = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventPointIncreased { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + current_points: isSet(object.current_points) ? String(object.current_points) : "0", + }; + }, + + toJSON(message: EventPointIncreased): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.current_points !== undefined && (obj.current_points = message.current_points); + return obj; + }, + + fromPartial, I>>(object: I): EventPointIncreased { + const message = createBaseEventPointIncreased(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.current_points = object.current_points ?? "0"; + return message; + }, +}; + +function createBaseEventPointsReset(): EventPointsReset { + return { pool_id: "0", staker: "" }; +} + +export const EventPointsReset = { + encode(message: EventPointsReset, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventPointsReset { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventPointsReset(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventPointsReset { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + }; + }, + + toJSON(message: EventPointsReset): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + return obj; + }, + + fromPartial, I>>(object: I): EventPointsReset { + const message = createBaseEventPointsReset(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/bundles/v1beta1/genesis.ts b/common/types/src/client/kyve/bundles/v1beta1/genesis.ts new file mode 100644 index 00000000..1257e971 --- /dev/null +++ b/common/types/src/client/kyve/bundles/v1beta1/genesis.ts @@ -0,0 +1,112 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { BundleProposal, FinalizedBundle } from "./bundles"; +import { Params } from "./params"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** GenesisState defines the bundles module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params?: Params; + /** bundle_proposal_list ... */ + bundle_proposal_list: BundleProposal[]; + /** finalized_bundle_list ... */ + finalized_bundle_list: FinalizedBundle[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, bundle_proposal_list: [], finalized_bundle_list: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.bundle_proposal_list) { + BundleProposal.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.finalized_bundle_list) { + FinalizedBundle.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.bundle_proposal_list.push(BundleProposal.decode(reader, reader.uint32())); + break; + case 3: + message.finalized_bundle_list.push(FinalizedBundle.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + bundle_proposal_list: Array.isArray(object?.bundle_proposal_list) + ? object.bundle_proposal_list.map((e: any) => BundleProposal.fromJSON(e)) + : [], + finalized_bundle_list: Array.isArray(object?.finalized_bundle_list) + ? object.finalized_bundle_list.map((e: any) => FinalizedBundle.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.bundle_proposal_list) { + obj.bundle_proposal_list = message.bundle_proposal_list.map((e) => e ? BundleProposal.toJSON(e) : undefined); + } else { + obj.bundle_proposal_list = []; + } + if (message.finalized_bundle_list) { + obj.finalized_bundle_list = message.finalized_bundle_list.map((e) => e ? FinalizedBundle.toJSON(e) : undefined); + } else { + obj.finalized_bundle_list = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.bundle_proposal_list = object.bundle_proposal_list?.map((e) => BundleProposal.fromPartial(e)) || []; + message.finalized_bundle_list = object.finalized_bundle_list?.map((e) => FinalizedBundle.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/bundles/v1beta1/params.ts b/common/types/src/client/kyve/bundles/v1beta1/params.ts new file mode 100644 index 00000000..f45fa651 --- /dev/null +++ b/common/types/src/client/kyve/bundles/v1beta1/params.ts @@ -0,0 +1,117 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** Params defines the bundles module parameters. */ +export interface Params { + /** upload_timeout ... */ + upload_timeout: string; + /** storage_cost ... */ + storage_cost: string; + /** network_fee ... */ + network_fee: string; + /** max_points ... */ + max_points: string; +} + +function createBaseParams(): Params { + return { upload_timeout: "0", storage_cost: "0", network_fee: "", max_points: "0" }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.upload_timeout !== "0") { + writer.uint32(8).uint64(message.upload_timeout); + } + if (message.storage_cost !== "0") { + writer.uint32(16).uint64(message.storage_cost); + } + if (message.network_fee !== "") { + writer.uint32(26).string(message.network_fee); + } + if (message.max_points !== "0") { + writer.uint32(32).uint64(message.max_points); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.upload_timeout = longToString(reader.uint64() as Long); + break; + case 2: + message.storage_cost = longToString(reader.uint64() as Long); + break; + case 3: + message.network_fee = reader.string(); + break; + case 4: + message.max_points = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + upload_timeout: isSet(object.upload_timeout) ? String(object.upload_timeout) : "0", + storage_cost: isSet(object.storage_cost) ? String(object.storage_cost) : "0", + network_fee: isSet(object.network_fee) ? String(object.network_fee) : "", + max_points: isSet(object.max_points) ? String(object.max_points) : "0", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.upload_timeout !== undefined && (obj.upload_timeout = message.upload_timeout); + message.storage_cost !== undefined && (obj.storage_cost = message.storage_cost); + message.network_fee !== undefined && (obj.network_fee = message.network_fee); + message.max_points !== undefined && (obj.max_points = message.max_points); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.upload_timeout = object.upload_timeout ?? "0"; + message.storage_cost = object.storage_cost ?? "0"; + message.network_fee = object.network_fee ?? ""; + message.max_points = object.max_points ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/bundles/v1beta1/query.ts b/common/types/src/client/kyve/bundles/v1beta1/query.ts new file mode 100644 index 00000000..e66091c3 --- /dev/null +++ b/common/types/src/client/kyve/bundles/v1beta1/query.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./params"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.bundles.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/bundles/v1beta1/tx.ts b/common/types/src/client/kyve/bundles/v1beta1/tx.ts new file mode 100644 index 00000000..d15964e1 --- /dev/null +++ b/common/types/src/client/kyve/bundles/v1beta1/tx.ts @@ -0,0 +1,865 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** VoteType ... */ +export enum VoteType { + /** VOTE_TYPE_UNSPECIFIED - VOTE_TYPE_UNSPECIFIED ... */ + VOTE_TYPE_UNSPECIFIED = 0, + /** VOTE_TYPE_VALID - VOTE_TYPE_VALID ... */ + VOTE_TYPE_VALID = 1, + /** VOTE_TYPE_INVALID - VOTE_TYPE_INVALID ... */ + VOTE_TYPE_INVALID = 2, + /** VOTE_TYPE_ABSTAIN - VOTE_TYPE_ABSTAIN ... */ + VOTE_TYPE_ABSTAIN = 3, + UNRECOGNIZED = -1, +} + +export function voteTypeFromJSON(object: any): VoteType { + switch (object) { + case 0: + case "VOTE_TYPE_UNSPECIFIED": + return VoteType.VOTE_TYPE_UNSPECIFIED; + case 1: + case "VOTE_TYPE_VALID": + return VoteType.VOTE_TYPE_VALID; + case 2: + case "VOTE_TYPE_INVALID": + return VoteType.VOTE_TYPE_INVALID; + case 3: + case "VOTE_TYPE_ABSTAIN": + return VoteType.VOTE_TYPE_ABSTAIN; + case -1: + case "UNRECOGNIZED": + default: + return VoteType.UNRECOGNIZED; + } +} + +export function voteTypeToJSON(object: VoteType): string { + switch (object) { + case VoteType.VOTE_TYPE_UNSPECIFIED: + return "VOTE_TYPE_UNSPECIFIED"; + case VoteType.VOTE_TYPE_VALID: + return "VOTE_TYPE_VALID"; + case VoteType.VOTE_TYPE_INVALID: + return "VOTE_TYPE_INVALID"; + case VoteType.VOTE_TYPE_ABSTAIN: + return "VOTE_TYPE_ABSTAIN"; + case VoteType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** MsgSubmitBundleProposal defines a SDK message for submitting a bundle proposal. */ +export interface MsgSubmitBundleProposal { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** storage_id ... */ + storage_id: string; + /** data_size ... */ + data_size: string; + /** data_hash ... */ + data_hash: string; + /** from_index ... */ + from_index: string; + /** bundle_size ... */ + bundle_size: string; + /** from_key */ + from_key: string; + /** to_key ... */ + to_key: string; + /** bundle_summary ... */ + bundle_summary: string; +} + +/** MsgSubmitBundleProposalResponse defines the Msg/SubmitBundleProposal response type. */ +export interface MsgSubmitBundleProposalResponse { +} + +/** MsgVoteBundleProposal defines a SDK message for voting on a bundle proposal. */ +export interface MsgVoteBundleProposal { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** id ... */ + pool_id: string; + /** storage_id ... */ + storage_id: string; + /** vote ... */ + vote: VoteType; +} + +/** MsgVoteBundleProposalResponse defines the Msg/VoteBundleProposal response type. */ +export interface MsgVoteBundleProposalResponse { +} + +/** MsgClaimUploaderRole defines a SDK message for claiming the uploader role. */ +export interface MsgClaimUploaderRole { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** id ... */ + pool_id: string; +} + +/** MsgClaimUploaderRoleResponse defines the Msg/ClaimUploaderRole response type. */ +export interface MsgClaimUploaderRoleResponse { +} + +/** MsgSubmitBundleProposal defines a SDK message for submitting a bundle proposal. */ +export interface MsgSkipUploaderRole { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** from_index ... */ + from_index: string; +} + +/** MsgSubmitBundleProposalResponse defines the Msg/SubmitBundleProposal response type. */ +export interface MsgSkipUploaderRoleResponse { +} + +/** MsgUpdateParams defines a SDK message for updating the module parameters. */ +export interface MsgUpdateParams { + /** authority is the address of the governance account. */ + authority: string; + /** payload defines the x/bundles parameters to update. */ + payload: string; +} + +/** MsgUpdateParamsResponse defines the Msg/UpdateParams response type. */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgSubmitBundleProposal(): MsgSubmitBundleProposal { + return { + creator: "", + staker: "", + pool_id: "0", + storage_id: "", + data_size: "0", + data_hash: "", + from_index: "0", + bundle_size: "0", + from_key: "", + to_key: "", + bundle_summary: "", + }; +} + +export const MsgSubmitBundleProposal = { + encode(message: MsgSubmitBundleProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.storage_id !== "") { + writer.uint32(34).string(message.storage_id); + } + if (message.data_size !== "0") { + writer.uint32(40).uint64(message.data_size); + } + if (message.data_hash !== "") { + writer.uint32(50).string(message.data_hash); + } + if (message.from_index !== "0") { + writer.uint32(56).uint64(message.from_index); + } + if (message.bundle_size !== "0") { + writer.uint32(64).uint64(message.bundle_size); + } + if (message.from_key !== "") { + writer.uint32(74).string(message.from_key); + } + if (message.to_key !== "") { + writer.uint32(82).string(message.to_key); + } + if (message.bundle_summary !== "") { + writer.uint32(90).string(message.bundle_summary); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitBundleProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitBundleProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.storage_id = reader.string(); + break; + case 5: + message.data_size = longToString(reader.uint64() as Long); + break; + case 6: + message.data_hash = reader.string(); + break; + case 7: + message.from_index = longToString(reader.uint64() as Long); + break; + case 8: + message.bundle_size = longToString(reader.uint64() as Long); + break; + case 9: + message.from_key = reader.string(); + break; + case 10: + message.to_key = reader.string(); + break; + case 11: + message.bundle_summary = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitBundleProposal { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + data_size: isSet(object.data_size) ? String(object.data_size) : "0", + data_hash: isSet(object.data_hash) ? String(object.data_hash) : "", + from_index: isSet(object.from_index) ? String(object.from_index) : "0", + bundle_size: isSet(object.bundle_size) ? String(object.bundle_size) : "0", + from_key: isSet(object.from_key) ? String(object.from_key) : "", + to_key: isSet(object.to_key) ? String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? String(object.bundle_summary) : "", + }; + }, + + toJSON(message: MsgSubmitBundleProposal): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.data_size !== undefined && (obj.data_size = message.data_size); + message.data_hash !== undefined && (obj.data_hash = message.data_hash); + message.from_index !== undefined && (obj.from_index = message.from_index); + message.bundle_size !== undefined && (obj.bundle_size = message.bundle_size); + message.from_key !== undefined && (obj.from_key = message.from_key); + message.to_key !== undefined && (obj.to_key = message.to_key); + message.bundle_summary !== undefined && (obj.bundle_summary = message.bundle_summary); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitBundleProposal { + const message = createBaseMsgSubmitBundleProposal(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.storage_id = object.storage_id ?? ""; + message.data_size = object.data_size ?? "0"; + message.data_hash = object.data_hash ?? ""; + message.from_index = object.from_index ?? "0"; + message.bundle_size = object.bundle_size ?? "0"; + message.from_key = object.from_key ?? ""; + message.to_key = object.to_key ?? ""; + message.bundle_summary = object.bundle_summary ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitBundleProposalResponse(): MsgSubmitBundleProposalResponse { + return {}; +} + +export const MsgSubmitBundleProposalResponse = { + encode(_: MsgSubmitBundleProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitBundleProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitBundleProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgSubmitBundleProposalResponse { + return {}; + }, + + toJSON(_: MsgSubmitBundleProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSubmitBundleProposalResponse { + const message = createBaseMsgSubmitBundleProposalResponse(); + return message; + }, +}; + +function createBaseMsgVoteBundleProposal(): MsgVoteBundleProposal { + return { creator: "", staker: "", pool_id: "0", storage_id: "", vote: 0 }; +} + +export const MsgVoteBundleProposal = { + encode(message: MsgVoteBundleProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.storage_id !== "") { + writer.uint32(34).string(message.storage_id); + } + if (message.vote !== 0) { + writer.uint32(40).int32(message.vote); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteBundleProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteBundleProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.storage_id = reader.string(); + break; + case 5: + message.vote = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgVoteBundleProposal { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + vote: isSet(object.vote) ? voteTypeFromJSON(object.vote) : 0, + }; + }, + + toJSON(message: MsgVoteBundleProposal): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.vote !== undefined && (obj.vote = voteTypeToJSON(message.vote)); + return obj; + }, + + fromPartial, I>>(object: I): MsgVoteBundleProposal { + const message = createBaseMsgVoteBundleProposal(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.storage_id = object.storage_id ?? ""; + message.vote = object.vote ?? 0; + return message; + }, +}; + +function createBaseMsgVoteBundleProposalResponse(): MsgVoteBundleProposalResponse { + return {}; +} + +export const MsgVoteBundleProposalResponse = { + encode(_: MsgVoteBundleProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteBundleProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteBundleProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgVoteBundleProposalResponse { + return {}; + }, + + toJSON(_: MsgVoteBundleProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteBundleProposalResponse { + const message = createBaseMsgVoteBundleProposalResponse(); + return message; + }, +}; + +function createBaseMsgClaimUploaderRole(): MsgClaimUploaderRole { + return { creator: "", staker: "", pool_id: "0" }; +} + +export const MsgClaimUploaderRole = { + encode(message: MsgClaimUploaderRole, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUploaderRole { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClaimUploaderRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgClaimUploaderRole { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + }; + }, + + toJSON(message: MsgClaimUploaderRole): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgClaimUploaderRole { + const message = createBaseMsgClaimUploaderRole(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +function createBaseMsgClaimUploaderRoleResponse(): MsgClaimUploaderRoleResponse { + return {}; +} + +export const MsgClaimUploaderRoleResponse = { + encode(_: MsgClaimUploaderRoleResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUploaderRoleResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClaimUploaderRoleResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgClaimUploaderRoleResponse { + return {}; + }, + + toJSON(_: MsgClaimUploaderRoleResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgClaimUploaderRoleResponse { + const message = createBaseMsgClaimUploaderRoleResponse(); + return message; + }, +}; + +function createBaseMsgSkipUploaderRole(): MsgSkipUploaderRole { + return { creator: "", staker: "", pool_id: "0", from_index: "0" }; +} + +export const MsgSkipUploaderRole = { + encode(message: MsgSkipUploaderRole, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.from_index !== "0") { + writer.uint32(32).uint64(message.from_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSkipUploaderRole { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSkipUploaderRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.from_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSkipUploaderRole { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + from_index: isSet(object.from_index) ? String(object.from_index) : "0", + }; + }, + + toJSON(message: MsgSkipUploaderRole): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.from_index !== undefined && (obj.from_index = message.from_index); + return obj; + }, + + fromPartial, I>>(object: I): MsgSkipUploaderRole { + const message = createBaseMsgSkipUploaderRole(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.from_index = object.from_index ?? "0"; + return message; + }, +}; + +function createBaseMsgSkipUploaderRoleResponse(): MsgSkipUploaderRoleResponse { + return {}; +} + +export const MsgSkipUploaderRoleResponse = { + encode(_: MsgSkipUploaderRoleResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSkipUploaderRoleResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSkipUploaderRoleResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgSkipUploaderRoleResponse { + return {}; + }, + + toJSON(_: MsgSkipUploaderRoleResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSkipUploaderRoleResponse { + const message = createBaseMsgSkipUploaderRoleResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", payload: "" }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.payload !== "") { + writer.uint32(18).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** SubmitBundleProposal ... */ + SubmitBundleProposal(request: MsgSubmitBundleProposal): Promise; + /** VoteBundleProposal ... */ + VoteBundleProposal(request: MsgVoteBundleProposal): Promise; + /** ClaimUploaderRole ... */ + ClaimUploaderRole(request: MsgClaimUploaderRole): Promise; + /** SkipUploaderRole ... */ + SkipUploaderRole(request: MsgSkipUploaderRole): Promise; + /** + * UpdateParams defines a governance operation for updating the x/bundles module + * parameters. The authority is hard-coded to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.bundles.v1beta1.Msg"; + this.rpc = rpc; + this.SubmitBundleProposal = this.SubmitBundleProposal.bind(this); + this.VoteBundleProposal = this.VoteBundleProposal.bind(this); + this.ClaimUploaderRole = this.ClaimUploaderRole.bind(this); + this.SkipUploaderRole = this.SkipUploaderRole.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + } + SubmitBundleProposal(request: MsgSubmitBundleProposal): Promise { + const data = MsgSubmitBundleProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitBundleProposal", data); + return promise.then((data) => MsgSubmitBundleProposalResponse.decode(new _m0.Reader(data))); + } + + VoteBundleProposal(request: MsgVoteBundleProposal): Promise { + const data = MsgVoteBundleProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteBundleProposal", data); + return promise.then((data) => MsgVoteBundleProposalResponse.decode(new _m0.Reader(data))); + } + + ClaimUploaderRole(request: MsgClaimUploaderRole): Promise { + const data = MsgClaimUploaderRole.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClaimUploaderRole", data); + return promise.then((data) => MsgClaimUploaderRoleResponse.decode(new _m0.Reader(data))); + } + + SkipUploaderRole(request: MsgSkipUploaderRole): Promise { + const data = MsgSkipUploaderRole.encode(request).finish(); + const promise = this.rpc.request(this.service, "SkipUploaderRole", data); + return promise.then((data) => MsgSkipUploaderRoleResponse.decode(new _m0.Reader(data))); + } + + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/delegation/v1beta1/delegation.ts b/common/types/src/client/kyve/delegation/v1beta1/delegation.ts new file mode 100644 index 00000000..4bdab179 --- /dev/null +++ b/common/types/src/client/kyve/delegation/v1beta1/delegation.ts @@ -0,0 +1,688 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** SlashType ... */ +export enum SlashType { + /** SLASH_TYPE_UNSPECIFIED - SLASH_TYPE_UNSPECIFIED ... */ + SLASH_TYPE_UNSPECIFIED = 0, + /** SLASH_TYPE_TIMEOUT - SLASH_TYPE_TIMEOUT ... */ + SLASH_TYPE_TIMEOUT = 1, + /** SLASH_TYPE_VOTE - SLASH_TYPE_VOTE ... */ + SLASH_TYPE_VOTE = 2, + /** SLASH_TYPE_UPLOAD - SLASH_TYPE_UPLOAD ... */ + SLASH_TYPE_UPLOAD = 3, + UNRECOGNIZED = -1, +} + +export function slashTypeFromJSON(object: any): SlashType { + switch (object) { + case 0: + case "SLASH_TYPE_UNSPECIFIED": + return SlashType.SLASH_TYPE_UNSPECIFIED; + case 1: + case "SLASH_TYPE_TIMEOUT": + return SlashType.SLASH_TYPE_TIMEOUT; + case 2: + case "SLASH_TYPE_VOTE": + return SlashType.SLASH_TYPE_VOTE; + case 3: + case "SLASH_TYPE_UPLOAD": + return SlashType.SLASH_TYPE_UPLOAD; + case -1: + case "UNRECOGNIZED": + default: + return SlashType.UNRECOGNIZED; + } +} + +export function slashTypeToJSON(object: SlashType): string { + switch (object) { + case SlashType.SLASH_TYPE_UNSPECIFIED: + return "SLASH_TYPE_UNSPECIFIED"; + case SlashType.SLASH_TYPE_TIMEOUT: + return "SLASH_TYPE_TIMEOUT"; + case SlashType.SLASH_TYPE_VOTE: + return "SLASH_TYPE_VOTE"; + case SlashType.SLASH_TYPE_UPLOAD: + return "SLASH_TYPE_UPLOAD"; + case SlashType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * Delegator stores the information that one address has delegated to another address + * It stores important information for the F1-Fee distribution algorithm + */ +export interface Delegator { + /** staker corresponds to a KYVE-staker on the protocol-side */ + staker: string; + /** + * delegator the user who delegate to the staker. + * If staker and delegator are the same we call it: self-delegation + */ + delegator: string; + /** k_index is an internal index for the f1-distribution algorithm */ + k_index: string; + /** + * initial_amount of stake the user had when it delegated. + * slashes can cause that the actual stake is lower. + */ + initial_amount: string; +} + +/** + * DelegationEntry represents an entry according to the F1-Fee-Distribution algorithm. + * Take a look at x/delegation/keeper/logic_f1distribution.go for more details + */ +export interface DelegationEntry { + /** staker on protocol level */ + staker: string; + /** k_index is the of the period this entry ends */ + k_index: string; + /** value is the quotient of collected rewards and total stake according to F1-distribution */ + value: string; +} + +/** DelegationPoolData stores general delegation information for every staker */ +export interface DelegationData { + /** Every staker has one DelegationData */ + staker: string; + /** current_rewards ... */ + current_rewards: string; + /** total_delegation ... */ + total_delegation: string; + /** latest_index_k ... */ + latest_index_k: string; + /** delegator_count the amount of different addresses delegating to the staker */ + delegator_count: string; + /** latest_index_was_undelegation helps indicates when an entry can be deleted */ + latest_index_was_undelegation: boolean; +} + +/** + * DelegationSlash represents an f1-slash + * these entries needs to be iterated to obtain the current amount of the actual stake + * Every staker can have n slash-entries + */ +export interface DelegationSlash { + /** staker who got slashed */ + staker: string; + /** k_index for f1-algorithm */ + k_index: string; + /** fraction that got slashed */ + fraction: string; +} + +/** UndelegationQueueEntry ... */ +export interface UndelegationQueueEntry { + /** index ... */ + index: string; + /** staker ... */ + staker: string; + /** delegator ... */ + delegator: string; + /** amount ... */ + amount: string; + /** creation_time ... */ + creation_time: string; +} + +/** QueueState ... */ +export interface QueueState { + /** low_index ... */ + low_index: string; + /** high_index ... */ + high_index: string; +} + +/** RedelegationCooldown ... */ +export interface RedelegationCooldown { + /** low_index ... */ + address: string; + /** high_index ... */ + creation_date: string; +} + +function createBaseDelegator(): Delegator { + return { staker: "", delegator: "", k_index: "0", initial_amount: "0" }; +} + +export const Delegator = { + encode(message: Delegator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.delegator !== "") { + writer.uint32(18).string(message.delegator); + } + if (message.k_index !== "0") { + writer.uint32(24).uint64(message.k_index); + } + if (message.initial_amount !== "0") { + writer.uint32(32).uint64(message.initial_amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Delegator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.delegator = reader.string(); + break; + case 3: + message.k_index = longToString(reader.uint64() as Long); + break; + case 4: + message.initial_amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Delegator { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + delegator: isSet(object.delegator) ? String(object.delegator) : "", + k_index: isSet(object.k_index) ? String(object.k_index) : "0", + initial_amount: isSet(object.initial_amount) ? String(object.initial_amount) : "0", + }; + }, + + toJSON(message: Delegator): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.delegator !== undefined && (obj.delegator = message.delegator); + message.k_index !== undefined && (obj.k_index = message.k_index); + message.initial_amount !== undefined && (obj.initial_amount = message.initial_amount); + return obj; + }, + + fromPartial, I>>(object: I): Delegator { + const message = createBaseDelegator(); + message.staker = object.staker ?? ""; + message.delegator = object.delegator ?? ""; + message.k_index = object.k_index ?? "0"; + message.initial_amount = object.initial_amount ?? "0"; + return message; + }, +}; + +function createBaseDelegationEntry(): DelegationEntry { + return { staker: "", k_index: "0", value: "" }; +} + +export const DelegationEntry = { + encode(message: DelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.k_index !== "0") { + writer.uint32(16).uint64(message.k_index); + } + if (message.value !== "") { + writer.uint32(26).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.k_index = longToString(reader.uint64() as Long); + break; + case 3: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationEntry { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + k_index: isSet(object.k_index) ? String(object.k_index) : "0", + value: isSet(object.value) ? String(object.value) : "", + }; + }, + + toJSON(message: DelegationEntry): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.k_index !== undefined && (obj.k_index = message.k_index); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + fromPartial, I>>(object: I): DelegationEntry { + const message = createBaseDelegationEntry(); + message.staker = object.staker ?? ""; + message.k_index = object.k_index ?? "0"; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseDelegationData(): DelegationData { + return { + staker: "", + current_rewards: "0", + total_delegation: "0", + latest_index_k: "0", + delegator_count: "0", + latest_index_was_undelegation: false, + }; +} + +export const DelegationData = { + encode(message: DelegationData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.current_rewards !== "0") { + writer.uint32(16).uint64(message.current_rewards); + } + if (message.total_delegation !== "0") { + writer.uint32(24).uint64(message.total_delegation); + } + if (message.latest_index_k !== "0") { + writer.uint32(32).uint64(message.latest_index_k); + } + if (message.delegator_count !== "0") { + writer.uint32(40).uint64(message.delegator_count); + } + if (message.latest_index_was_undelegation === true) { + writer.uint32(48).bool(message.latest_index_was_undelegation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.current_rewards = longToString(reader.uint64() as Long); + break; + case 3: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 4: + message.latest_index_k = longToString(reader.uint64() as Long); + break; + case 5: + message.delegator_count = longToString(reader.uint64() as Long); + break; + case 6: + message.latest_index_was_undelegation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationData { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + current_rewards: isSet(object.current_rewards) ? String(object.current_rewards) : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + latest_index_k: isSet(object.latest_index_k) ? String(object.latest_index_k) : "0", + delegator_count: isSet(object.delegator_count) ? String(object.delegator_count) : "0", + latest_index_was_undelegation: isSet(object.latest_index_was_undelegation) + ? Boolean(object.latest_index_was_undelegation) + : false, + }; + }, + + toJSON(message: DelegationData): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.current_rewards !== undefined && (obj.current_rewards = message.current_rewards); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.latest_index_k !== undefined && (obj.latest_index_k = message.latest_index_k); + message.delegator_count !== undefined && (obj.delegator_count = message.delegator_count); + message.latest_index_was_undelegation !== undefined && + (obj.latest_index_was_undelegation = message.latest_index_was_undelegation); + return obj; + }, + + fromPartial, I>>(object: I): DelegationData { + const message = createBaseDelegationData(); + message.staker = object.staker ?? ""; + message.current_rewards = object.current_rewards ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.latest_index_k = object.latest_index_k ?? "0"; + message.delegator_count = object.delegator_count ?? "0"; + message.latest_index_was_undelegation = object.latest_index_was_undelegation ?? false; + return message; + }, +}; + +function createBaseDelegationSlash(): DelegationSlash { + return { staker: "", k_index: "0", fraction: "" }; +} + +export const DelegationSlash = { + encode(message: DelegationSlash, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.k_index !== "0") { + writer.uint32(16).uint64(message.k_index); + } + if (message.fraction !== "") { + writer.uint32(26).string(message.fraction); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationSlash { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationSlash(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.k_index = longToString(reader.uint64() as Long); + break; + case 3: + message.fraction = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationSlash { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + k_index: isSet(object.k_index) ? String(object.k_index) : "0", + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: DelegationSlash): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.k_index !== undefined && (obj.k_index = message.k_index); + message.fraction !== undefined && (obj.fraction = message.fraction); + return obj; + }, + + fromPartial, I>>(object: I): DelegationSlash { + const message = createBaseDelegationSlash(); + message.staker = object.staker ?? ""; + message.k_index = object.k_index ?? "0"; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseUndelegationQueueEntry(): UndelegationQueueEntry { + return { index: "0", staker: "", delegator: "", amount: "0", creation_time: "0" }; +} + +export const UndelegationQueueEntry = { + encode(message: UndelegationQueueEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.delegator !== "") { + writer.uint32(26).string(message.delegator); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + if (message.creation_time !== "0") { + writer.uint32(40).uint64(message.creation_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UndelegationQueueEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUndelegationQueueEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.delegator = reader.string(); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + case 5: + message.creation_time = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UndelegationQueueEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + delegator: isSet(object.delegator) ? String(object.delegator) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? String(object.creation_time) : "0", + }; + }, + + toJSON(message: UndelegationQueueEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.delegator !== undefined && (obj.delegator = message.delegator); + message.amount !== undefined && (obj.amount = message.amount); + message.creation_time !== undefined && (obj.creation_time = message.creation_time); + return obj; + }, + + fromPartial, I>>(object: I): UndelegationQueueEntry { + const message = createBaseUndelegationQueueEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.delegator = object.delegator ?? ""; + message.amount = object.amount ?? "0"; + message.creation_time = object.creation_time ?? "0"; + return message; + }, +}; + +function createBaseQueueState(): QueueState { + return { low_index: "0", high_index: "0" }; +} + +export const QueueState = { + encode(message: QueueState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.low_index !== "0") { + writer.uint32(8).uint64(message.low_index); + } + if (message.high_index !== "0") { + writer.uint32(16).uint64(message.high_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueueState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.low_index = longToString(reader.uint64() as Long); + break; + case 2: + message.high_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueueState { + return { + low_index: isSet(object.low_index) ? String(object.low_index) : "0", + high_index: isSet(object.high_index) ? String(object.high_index) : "0", + }; + }, + + toJSON(message: QueueState): unknown { + const obj: any = {}; + message.low_index !== undefined && (obj.low_index = message.low_index); + message.high_index !== undefined && (obj.high_index = message.high_index); + return obj; + }, + + fromPartial, I>>(object: I): QueueState { + const message = createBaseQueueState(); + message.low_index = object.low_index ?? "0"; + message.high_index = object.high_index ?? "0"; + return message; + }, +}; + +function createBaseRedelegationCooldown(): RedelegationCooldown { + return { address: "", creation_date: "0" }; +} + +export const RedelegationCooldown = { + encode(message: RedelegationCooldown, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.creation_date !== "0") { + writer.uint32(16).uint64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationCooldown { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationCooldown(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.creation_date = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RedelegationCooldown { + return { + address: isSet(object.address) ? String(object.address) : "", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: RedelegationCooldown): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): RedelegationCooldown { + const message = createBaseRedelegationCooldown(); + message.address = object.address ?? ""; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/delegation/v1beta1/events.ts b/common/types/src/client/kyve/delegation/v1beta1/events.ts new file mode 100644 index 00000000..8665ed22 --- /dev/null +++ b/common/types/src/client/kyve/delegation/v1beta1/events.ts @@ -0,0 +1,452 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { SlashType, slashTypeFromJSON, slashTypeToJSON } from "./delegation"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** + * EventDelegate is an event emitted when someone delegates to a protocol node. + * emitted_by: MsgDelegate + */ +export interface EventDelegate { + /** address is the account address of the delegator. */ + address: string; + /** staker is the account address of the protocol node. */ + staker: string; + /** amount ... */ + amount: string; +} + +/** + * EventUndelegate is an event emitted when someone undelegates from a protocol node. + * emitted_by: EndBlock + */ +export interface EventUndelegate { + /** address is the account address of the delegator. */ + address: string; + /** staker is the account address of the protocol node. */ + staker: string; + /** amount ... */ + amount: string; +} + +/** + * EventRedelegate is an event emitted when someone redelegates from one protocol node to another. + * emitted_by: MsgRedelegate + */ +export interface EventRedelegate { + /** address is the account address of the delegator. */ + address: string; + /** from_staker ... */ + from_staker: string; + /** to_staker is the account address of the new staker in the the pool */ + to_staker: string; + /** amount ... */ + amount: string; +} + +/** + * EventWithdrawRewards ... + * emitted_by: MsgRedelegate, MsgDelegate, MsgWithdrawRewards, EndBlock + */ +export interface EventWithdrawRewards { + /** address is the account address of the delegator. */ + address: string; + /** staker is the account address of the protocol node the users withdraws from. */ + staker: string; + /** amount ... */ + amount: string; +} + +/** + * EventSlash is an event emitted when a protocol node is slashed. + * emitted_by: MsgSubmitBundleProposal, EndBlock + */ +export interface EventSlash { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** staker is the account address of the protocol node. */ + staker: string; + /** amount ... */ + amount: string; + /** slash_type */ + slash_type: SlashType; +} + +function createBaseEventDelegate(): EventDelegate { + return { address: "", staker: "", amount: "0" }; +} + +export const EventDelegate = { + encode(message: EventDelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventDelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventDelegate { + return { + address: isSet(object.address) ? String(object.address) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventDelegate): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventDelegate { + const message = createBaseEventDelegate(); + message.address = object.address ?? ""; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventUndelegate(): EventUndelegate { + return { address: "", staker: "", amount: "0" }; +} + +export const EventUndelegate = { + encode(message: EventUndelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUndelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventUndelegate { + return { + address: isSet(object.address) ? String(object.address) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventUndelegate): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventUndelegate { + const message = createBaseEventUndelegate(); + message.address = object.address ?? ""; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventRedelegate(): EventRedelegate { + return { address: "", from_staker: "", to_staker: "", amount: "0" }; +} + +export const EventRedelegate = { + encode(message: EventRedelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.from_staker !== "") { + writer.uint32(18).string(message.from_staker); + } + if (message.to_staker !== "") { + writer.uint32(26).string(message.to_staker); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventRedelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.from_staker = reader.string(); + break; + case 3: + message.to_staker = reader.string(); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventRedelegate { + return { + address: isSet(object.address) ? String(object.address) : "", + from_staker: isSet(object.from_staker) ? String(object.from_staker) : "", + to_staker: isSet(object.to_staker) ? String(object.to_staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventRedelegate): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.from_staker !== undefined && (obj.from_staker = message.from_staker); + message.to_staker !== undefined && (obj.to_staker = message.to_staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventRedelegate { + const message = createBaseEventRedelegate(); + message.address = object.address ?? ""; + message.from_staker = object.from_staker ?? ""; + message.to_staker = object.to_staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventWithdrawRewards(): EventWithdrawRewards { + return { address: "", staker: "", amount: "0" }; +} + +export const EventWithdrawRewards = { + encode(message: EventWithdrawRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventWithdrawRewards { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventWithdrawRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventWithdrawRewards { + return { + address: isSet(object.address) ? String(object.address) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventWithdrawRewards): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventWithdrawRewards { + const message = createBaseEventWithdrawRewards(); + message.address = object.address ?? ""; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventSlash(): EventSlash { + return { pool_id: "0", staker: "", amount: "0", slash_type: 0 }; +} + +export const EventSlash = { + encode(message: EventSlash, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + if (message.slash_type !== 0) { + writer.uint32(32).int32(message.slash_type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventSlash { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSlash(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + case 4: + message.slash_type = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventSlash { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + slash_type: isSet(object.slash_type) ? slashTypeFromJSON(object.slash_type) : 0, + }; + }, + + toJSON(message: EventSlash): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + message.slash_type !== undefined && (obj.slash_type = slashTypeToJSON(message.slash_type)); + return obj; + }, + + fromPartial, I>>(object: I): EventSlash { + const message = createBaseEventSlash(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + message.slash_type = object.slash_type ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/delegation/v1beta1/genesis.ts b/common/types/src/client/kyve/delegation/v1beta1/genesis.ts new file mode 100644 index 00000000..a94db103 --- /dev/null +++ b/common/types/src/client/kyve/delegation/v1beta1/genesis.ts @@ -0,0 +1,221 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { + DelegationData, + DelegationEntry, + DelegationSlash, + Delegator, + QueueState, + RedelegationCooldown, + UndelegationQueueEntry, +} from "./delegation"; +import { Params } from "./params"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** GenesisState defines the delegation module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params?: Params; + /** delegator_list ... */ + delegator_list: Delegator[]; + /** delegation_entry_list ... */ + delegation_entry_list: DelegationEntry[]; + /** delegation_data_list ... */ + delegation_data_list: DelegationData[]; + /** delegation_slash_list ... */ + delegation_slash_list: DelegationSlash[]; + /** undelegation_queue_entry_list ... */ + undelegation_queue_entry_list: UndelegationQueueEntry[]; + /** queue_state_undelegation ... */ + queue_state_undelegation?: QueueState; + /** redelegation_cooldown_list ... */ + redelegation_cooldown_list: RedelegationCooldown[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + delegator_list: [], + delegation_entry_list: [], + delegation_data_list: [], + delegation_slash_list: [], + undelegation_queue_entry_list: [], + queue_state_undelegation: undefined, + redelegation_cooldown_list: [], + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.delegator_list) { + Delegator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegation_entry_list) { + DelegationEntry.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.delegation_data_list) { + DelegationData.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.delegation_slash_list) { + DelegationSlash.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.undelegation_queue_entry_list) { + UndelegationQueueEntry.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.queue_state_undelegation !== undefined) { + QueueState.encode(message.queue_state_undelegation, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.redelegation_cooldown_list) { + RedelegationCooldown.encode(v!, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.delegator_list.push(Delegator.decode(reader, reader.uint32())); + break; + case 3: + message.delegation_entry_list.push(DelegationEntry.decode(reader, reader.uint32())); + break; + case 4: + message.delegation_data_list.push(DelegationData.decode(reader, reader.uint32())); + break; + case 5: + message.delegation_slash_list.push(DelegationSlash.decode(reader, reader.uint32())); + break; + case 6: + message.undelegation_queue_entry_list.push(UndelegationQueueEntry.decode(reader, reader.uint32())); + break; + case 7: + message.queue_state_undelegation = QueueState.decode(reader, reader.uint32()); + break; + case 8: + message.redelegation_cooldown_list.push(RedelegationCooldown.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + delegator_list: Array.isArray(object?.delegator_list) + ? object.delegator_list.map((e: any) => Delegator.fromJSON(e)) + : [], + delegation_entry_list: Array.isArray(object?.delegation_entry_list) + ? object.delegation_entry_list.map((e: any) => DelegationEntry.fromJSON(e)) + : [], + delegation_data_list: Array.isArray(object?.delegation_data_list) + ? object.delegation_data_list.map((e: any) => DelegationData.fromJSON(e)) + : [], + delegation_slash_list: Array.isArray(object?.delegation_slash_list) + ? object.delegation_slash_list.map((e: any) => DelegationSlash.fromJSON(e)) + : [], + undelegation_queue_entry_list: Array.isArray(object?.undelegation_queue_entry_list) + ? object.undelegation_queue_entry_list.map((e: any) => UndelegationQueueEntry.fromJSON(e)) + : [], + queue_state_undelegation: isSet(object.queue_state_undelegation) + ? QueueState.fromJSON(object.queue_state_undelegation) + : undefined, + redelegation_cooldown_list: Array.isArray(object?.redelegation_cooldown_list) + ? object.redelegation_cooldown_list.map((e: any) => RedelegationCooldown.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.delegator_list) { + obj.delegator_list = message.delegator_list.map((e) => e ? Delegator.toJSON(e) : undefined); + } else { + obj.delegator_list = []; + } + if (message.delegation_entry_list) { + obj.delegation_entry_list = message.delegation_entry_list.map((e) => e ? DelegationEntry.toJSON(e) : undefined); + } else { + obj.delegation_entry_list = []; + } + if (message.delegation_data_list) { + obj.delegation_data_list = message.delegation_data_list.map((e) => e ? DelegationData.toJSON(e) : undefined); + } else { + obj.delegation_data_list = []; + } + if (message.delegation_slash_list) { + obj.delegation_slash_list = message.delegation_slash_list.map((e) => e ? DelegationSlash.toJSON(e) : undefined); + } else { + obj.delegation_slash_list = []; + } + if (message.undelegation_queue_entry_list) { + obj.undelegation_queue_entry_list = message.undelegation_queue_entry_list.map((e) => + e ? UndelegationQueueEntry.toJSON(e) : undefined + ); + } else { + obj.undelegation_queue_entry_list = []; + } + message.queue_state_undelegation !== undefined && (obj.queue_state_undelegation = message.queue_state_undelegation + ? QueueState.toJSON(message.queue_state_undelegation) + : undefined); + if (message.redelegation_cooldown_list) { + obj.redelegation_cooldown_list = message.redelegation_cooldown_list.map((e) => + e ? RedelegationCooldown.toJSON(e) : undefined + ); + } else { + obj.redelegation_cooldown_list = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.delegator_list = object.delegator_list?.map((e) => Delegator.fromPartial(e)) || []; + message.delegation_entry_list = object.delegation_entry_list?.map((e) => DelegationEntry.fromPartial(e)) || []; + message.delegation_data_list = object.delegation_data_list?.map((e) => DelegationData.fromPartial(e)) || []; + message.delegation_slash_list = object.delegation_slash_list?.map((e) => DelegationSlash.fromPartial(e)) || []; + message.undelegation_queue_entry_list = + object.undelegation_queue_entry_list?.map((e) => UndelegationQueueEntry.fromPartial(e)) || []; + message.queue_state_undelegation = + (object.queue_state_undelegation !== undefined && object.queue_state_undelegation !== null) + ? QueueState.fromPartial(object.queue_state_undelegation) + : undefined; + message.redelegation_cooldown_list = + object.redelegation_cooldown_list?.map((e) => RedelegationCooldown.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/delegation/v1beta1/params.ts b/common/types/src/client/kyve/delegation/v1beta1/params.ts new file mode 100644 index 00000000..5e5d02f5 --- /dev/null +++ b/common/types/src/client/kyve/delegation/v1beta1/params.ts @@ -0,0 +1,149 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** Params defines the delegation module parameters. */ +export interface Params { + /** unbonding_delegation_time ... */ + unbonding_delegation_time: string; + /** unbonding_delegation_time ... */ + redelegation_cooldown: string; + /** unbonding_delegation_time ... */ + redelegation_max_amount: string; + /** vote_slash ... */ + vote_slash: string; + /** upload_slash ... */ + upload_slash: string; + /** timeout_slash ... */ + timeout_slash: string; +} + +function createBaseParams(): Params { + return { + unbonding_delegation_time: "0", + redelegation_cooldown: "0", + redelegation_max_amount: "0", + vote_slash: "", + upload_slash: "", + timeout_slash: "", + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.unbonding_delegation_time !== "0") { + writer.uint32(8).uint64(message.unbonding_delegation_time); + } + if (message.redelegation_cooldown !== "0") { + writer.uint32(16).uint64(message.redelegation_cooldown); + } + if (message.redelegation_max_amount !== "0") { + writer.uint32(24).uint64(message.redelegation_max_amount); + } + if (message.vote_slash !== "") { + writer.uint32(34).string(message.vote_slash); + } + if (message.upload_slash !== "") { + writer.uint32(42).string(message.upload_slash); + } + if (message.timeout_slash !== "") { + writer.uint32(50).string(message.timeout_slash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.unbonding_delegation_time = longToString(reader.uint64() as Long); + break; + case 2: + message.redelegation_cooldown = longToString(reader.uint64() as Long); + break; + case 3: + message.redelegation_max_amount = longToString(reader.uint64() as Long); + break; + case 4: + message.vote_slash = reader.string(); + break; + case 5: + message.upload_slash = reader.string(); + break; + case 6: + message.timeout_slash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + unbonding_delegation_time: isSet(object.unbonding_delegation_time) + ? String(object.unbonding_delegation_time) + : "0", + redelegation_cooldown: isSet(object.redelegation_cooldown) ? String(object.redelegation_cooldown) : "0", + redelegation_max_amount: isSet(object.redelegation_max_amount) ? String(object.redelegation_max_amount) : "0", + vote_slash: isSet(object.vote_slash) ? String(object.vote_slash) : "", + upload_slash: isSet(object.upload_slash) ? String(object.upload_slash) : "", + timeout_slash: isSet(object.timeout_slash) ? String(object.timeout_slash) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.unbonding_delegation_time !== undefined && + (obj.unbonding_delegation_time = message.unbonding_delegation_time); + message.redelegation_cooldown !== undefined && (obj.redelegation_cooldown = message.redelegation_cooldown); + message.redelegation_max_amount !== undefined && (obj.redelegation_max_amount = message.redelegation_max_amount); + message.vote_slash !== undefined && (obj.vote_slash = message.vote_slash); + message.upload_slash !== undefined && (obj.upload_slash = message.upload_slash); + message.timeout_slash !== undefined && (obj.timeout_slash = message.timeout_slash); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.unbonding_delegation_time = object.unbonding_delegation_time ?? "0"; + message.redelegation_cooldown = object.redelegation_cooldown ?? "0"; + message.redelegation_max_amount = object.redelegation_max_amount ?? "0"; + message.vote_slash = object.vote_slash ?? ""; + message.upload_slash = object.upload_slash ?? ""; + message.timeout_slash = object.timeout_slash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/delegation/v1beta1/query.ts b/common/types/src/client/kyve/delegation/v1beta1/query.ts new file mode 100644 index 00000000..b1b5f625 --- /dev/null +++ b/common/types/src/client/kyve/delegation/v1beta1/query.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./params"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.delegation.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/delegation/v1beta1/tx.ts b/common/types/src/client/kyve/delegation/v1beta1/tx.ts new file mode 100644 index 00000000..257ba0c5 --- /dev/null +++ b/common/types/src/client/kyve/delegation/v1beta1/tx.ts @@ -0,0 +1,685 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** MsgDelegate ... */ +export interface MsgDelegate { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** amount ... */ + amount: string; +} + +/** MsgDelegatePoolResponse defines the Msg/DelegatePool response type. */ +export interface MsgDelegateResponse { +} + +/** MsgWithdrawPool defines a SDK message for withdrawing delegation rewards from a specific pool. */ +export interface MsgWithdrawRewards { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; +} + +/** MsgWithdrawPoolResponse defines the Msg/WithdrawPool response type. */ +export interface MsgWithdrawRewardsResponse { +} + +/** MsgUndelegatePool defines a SDK message for undelegating from a specific pool. */ +export interface MsgUndelegate { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** amount ... */ + amount: string; +} + +/** MsgUndelegatePoolResponse defines the Msg/UndelegatePool response type. */ +export interface MsgUndelegateResponse { +} + +/** + * MsgRedelegatePool defines a SDK message for redelegating from a + * staker in a pool to another staker in the same or another pool + */ +export interface MsgRedelegate { + /** creator ... */ + creator: string; + /** staker ... */ + from_staker: string; + /** staker ... */ + to_staker: string; + /** amount ... */ + amount: string; +} + +/** MsgUndelegatePoolResponse defines the Msg/UndelegatePool response type. */ +export interface MsgRedelegateResponse { +} + +/** MsgUpdateParams defines a SDK message for updating the module parameters. */ +export interface MsgUpdateParams { + /** authority is the address of the governance account. */ + authority: string; + /** payload defines the x/delegation parameters to update. */ + payload: string; +} + +/** MsgUpdateParamsResponse defines the Msg/UpdateParams response type. */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgDelegate(): MsgDelegate { + return { creator: "", staker: "", amount: "0" }; +} + +export const MsgDelegate = { + encode(message: MsgDelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDelegate { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgDelegate { + const message = createBaseMsgDelegate(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} + +export const MsgDelegateResponse = { + encode(_: MsgDelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgDelegateResponse { + return {}; + }, + + toJSON(_: MsgDelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawRewards(): MsgWithdrawRewards { + return { creator: "", staker: "" }; +} + +export const MsgWithdrawRewards = { + encode(message: MsgWithdrawRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawRewards { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgWithdrawRewards { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + }; + }, + + toJSON(message: MsgWithdrawRewards): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + return obj; + }, + + fromPartial, I>>(object: I): MsgWithdrawRewards { + const message = createBaseMsgWithdrawRewards(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawRewardsResponse(): MsgWithdrawRewardsResponse { + return {}; +} + +export const MsgWithdrawRewardsResponse = { + encode(_: MsgWithdrawRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawRewardsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgWithdrawRewardsResponse { + return {}; + }, + + toJSON(_: MsgWithdrawRewardsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgWithdrawRewardsResponse { + const message = createBaseMsgWithdrawRewardsResponse(); + return message; + }, +}; + +function createBaseMsgUndelegate(): MsgUndelegate { + return { creator: "", staker: "", amount: "0" }; +} + +export const MsgUndelegate = { + encode(message: MsgUndelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUndelegate { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return {}; +} + +export const MsgUndelegateResponse = { + encode(_: MsgUndelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUndelegateResponse { + return {}; + }, + + toJSON(_: MsgUndelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + return message; + }, +}; + +function createBaseMsgRedelegate(): MsgRedelegate { + return { creator: "", from_staker: "", to_staker: "", amount: "0" }; +} + +export const MsgRedelegate = { + encode(message: MsgRedelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.from_staker !== "") { + writer.uint32(18).string(message.from_staker); + } + if (message.to_staker !== "") { + writer.uint32(26).string(message.to_staker); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRedelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.from_staker = reader.string(); + break; + case 3: + message.to_staker = reader.string(); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgRedelegate { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + from_staker: isSet(object.from_staker) ? String(object.from_staker) : "", + to_staker: isSet(object.to_staker) ? String(object.to_staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgRedelegate): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.from_staker !== undefined && (obj.from_staker = message.from_staker); + message.to_staker !== undefined && (obj.to_staker = message.to_staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgRedelegate { + const message = createBaseMsgRedelegate(); + message.creator = object.creator ?? ""; + message.from_staker = object.from_staker ?? ""; + message.to_staker = object.to_staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgRedelegateResponse(): MsgRedelegateResponse { + return {}; +} + +export const MsgRedelegateResponse = { + encode(_: MsgRedelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRedelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgRedelegateResponse { + return {}; + }, + + toJSON(_: MsgRedelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgRedelegateResponse { + const message = createBaseMsgRedelegateResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", payload: "" }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.payload !== "") { + writer.uint32(18).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** Delegate ... */ + Delegate(request: MsgDelegate): Promise; + /** Withdraw ... */ + WithdrawRewards(request: MsgWithdrawRewards): Promise; + /** Undelegate ... */ + Undelegate(request: MsgUndelegate): Promise; + /** Redelegate ... */ + Redelegate(request: MsgRedelegate): Promise; + /** + * UpdateParams defines a governance operation for updating the x/delegation module + * parameters. The authority is hard-coded to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.delegation.v1beta1.Msg"; + this.rpc = rpc; + this.Delegate = this.Delegate.bind(this); + this.WithdrawRewards = this.WithdrawRewards.bind(this); + this.Undelegate = this.Undelegate.bind(this); + this.Redelegate = this.Redelegate.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + } + Delegate(request: MsgDelegate): Promise { + const data = MsgDelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "Delegate", data); + return promise.then((data) => MsgDelegateResponse.decode(new _m0.Reader(data))); + } + + WithdrawRewards(request: MsgWithdrawRewards): Promise { + const data = MsgWithdrawRewards.encode(request).finish(); + const promise = this.rpc.request(this.service, "WithdrawRewards", data); + return promise.then((data) => MsgWithdrawRewardsResponse.decode(new _m0.Reader(data))); + } + + Undelegate(request: MsgUndelegate): Promise { + const data = MsgUndelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "Undelegate", data); + return promise.then((data) => MsgUndelegateResponse.decode(new _m0.Reader(data))); + } + + Redelegate(request: MsgRedelegate): Promise { + const data = MsgRedelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "Redelegate", data); + return promise.then((data) => MsgRedelegateResponse.decode(new _m0.Reader(data))); + } + + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/fees/v1beta1/fees.ts b/common/types/src/client/kyve/fees/v1beta1/fees.ts new file mode 100644 index 00000000..bae73d97 --- /dev/null +++ b/common/types/src/client/kyve/fees/v1beta1/fees.ts @@ -0,0 +1,273 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.fees.v1beta1"; + +/** Params defines the fees module parameters. */ +export interface Params { + /** min_gas_price defines the minimum gas price value for all transactions. */ + min_gas_price: string; + /** burn_ratio defines the ratio of transaction fees burnt. */ + burn_ratio: string; + /** gas_adjustments ... */ + gas_adjustments: GasAdjustment[]; + /** gas_refunds ... */ + gas_refunds: GasRefund[]; + /** min_initial_deposit_ratio ... */ + min_initial_deposit_ratio: string; +} + +/** GasAdjustment ... */ +export interface GasAdjustment { + /** type ... */ + type: string; + /** amount ... */ + amount: string; +} + +/** GasRefund ... */ +export interface GasRefund { + /** type ... */ + type: string; + /** fraction ... */ + fraction: string; +} + +function createBaseParams(): Params { + return { min_gas_price: "", burn_ratio: "", gas_adjustments: [], gas_refunds: [], min_initial_deposit_ratio: "" }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.min_gas_price !== "") { + writer.uint32(10).string(message.min_gas_price); + } + if (message.burn_ratio !== "") { + writer.uint32(18).string(message.burn_ratio); + } + for (const v of message.gas_adjustments) { + GasAdjustment.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.gas_refunds) { + GasRefund.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.min_initial_deposit_ratio !== "") { + writer.uint32(42).string(message.min_initial_deposit_ratio); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.min_gas_price = reader.string(); + break; + case 2: + message.burn_ratio = reader.string(); + break; + case 3: + message.gas_adjustments.push(GasAdjustment.decode(reader, reader.uint32())); + break; + case 4: + message.gas_refunds.push(GasRefund.decode(reader, reader.uint32())); + break; + case 5: + message.min_initial_deposit_ratio = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + min_gas_price: isSet(object.min_gas_price) ? String(object.min_gas_price) : "", + burn_ratio: isSet(object.burn_ratio) ? String(object.burn_ratio) : "", + gas_adjustments: Array.isArray(object?.gas_adjustments) + ? object.gas_adjustments.map((e: any) => GasAdjustment.fromJSON(e)) + : [], + gas_refunds: Array.isArray(object?.gas_refunds) ? object.gas_refunds.map((e: any) => GasRefund.fromJSON(e)) : [], + min_initial_deposit_ratio: isSet(object.min_initial_deposit_ratio) + ? String(object.min_initial_deposit_ratio) + : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.min_gas_price !== undefined && (obj.min_gas_price = message.min_gas_price); + message.burn_ratio !== undefined && (obj.burn_ratio = message.burn_ratio); + if (message.gas_adjustments) { + obj.gas_adjustments = message.gas_adjustments.map((e) => e ? GasAdjustment.toJSON(e) : undefined); + } else { + obj.gas_adjustments = []; + } + if (message.gas_refunds) { + obj.gas_refunds = message.gas_refunds.map((e) => e ? GasRefund.toJSON(e) : undefined); + } else { + obj.gas_refunds = []; + } + message.min_initial_deposit_ratio !== undefined && + (obj.min_initial_deposit_ratio = message.min_initial_deposit_ratio); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.min_gas_price = object.min_gas_price ?? ""; + message.burn_ratio = object.burn_ratio ?? ""; + message.gas_adjustments = object.gas_adjustments?.map((e) => GasAdjustment.fromPartial(e)) || []; + message.gas_refunds = object.gas_refunds?.map((e) => GasRefund.fromPartial(e)) || []; + message.min_initial_deposit_ratio = object.min_initial_deposit_ratio ?? ""; + return message; + }, +}; + +function createBaseGasAdjustment(): GasAdjustment { + return { type: "", amount: "0" }; +} + +export const GasAdjustment = { + encode(message: GasAdjustment, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.amount !== "0") { + writer.uint32(16).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GasAdjustment { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasAdjustment(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GasAdjustment { + return { + type: isSet(object.type) ? String(object.type) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: GasAdjustment): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): GasAdjustment { + const message = createBaseGasAdjustment(); + message.type = object.type ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseGasRefund(): GasRefund { + return { type: "", fraction: "" }; +} + +export const GasRefund = { + encode(message: GasRefund, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GasRefund { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasRefund(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.fraction = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GasRefund { + return { + type: isSet(object.type) ? String(object.type) : "", + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: GasRefund): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + message.fraction !== undefined && (obj.fraction = message.fraction); + return obj; + }, + + fromPartial, I>>(object: I): GasRefund { + const message = createBaseGasRefund(); + message.type = object.type ?? ""; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/fees/v1beta1/genesis.ts b/common/types/src/client/kyve/fees/v1beta1/genesis.ts new file mode 100644 index 00000000..2f88a030 --- /dev/null +++ b/common/types/src/client/kyve/fees/v1beta1/genesis.ts @@ -0,0 +1,75 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./fees"; + +export const protobufPackage = "kyve.fees.v1beta1"; + +/** GenesisState defines the fees module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params?: Params; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + 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; + }, + + fromJSON(object: any): GenesisState { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/fees/v1beta1/query.ts b/common/types/src/client/kyve/fees/v1beta1/query.ts new file mode 100644 index 00000000..323d2704 --- /dev/null +++ b/common/types/src/client/kyve/fees/v1beta1/query.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./fees"; + +export const protobufPackage = "kyve.fees.v1beta1"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.fees.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/fees/v1beta1/tx.ts b/common/types/src/client/kyve/fees/v1beta1/tx.ts new file mode 100644 index 00000000..13875dce --- /dev/null +++ b/common/types/src/client/kyve/fees/v1beta1/tx.ts @@ -0,0 +1,156 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.fees.v1beta1"; + +/** MsgUpdateParams defines a SDK message for updating the module parameters. */ +export interface MsgUpdateParams { + /** authority is the address of the governance account. */ + authority: string; + /** payload defines the x/fees parameters to update. */ + payload: string; +} + +/** MsgUpdateParamsResponse defines the Msg/UpdateParams response type. */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", payload: "" }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.payload !== "") { + writer.uint32(18).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/fees module + * parameters. The authority is hard-coded to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.fees.v1beta1.Msg"; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + } + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/pool/v1beta1/events.ts b/common/types/src/client/kyve/pool/v1beta1/events.ts new file mode 100644 index 00000000..faa36114 --- /dev/null +++ b/common/types/src/client/kyve/pool/v1beta1/events.ts @@ -0,0 +1,541 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.pool.v1beta1"; + +/** + * EventCreatePool ... + * emitted_by: EndBlock(gov) + */ +export interface EventCreatePool { + /** id ... */ + id: string; + /** name ... */ + name: string; + /** runtime ... */ + runtime: string; + /** logo ... */ + logo: string; + /** config ... */ + config: string; + /** start_key ... */ + start_key: string; + /** upload_interval ... */ + upload_interval: string; + /** operating_cost ... */ + operating_cost: string; + /** min_delegation ... */ + min_delegation: string; + /** max_bundle_size ... */ + max_bundle_size: string; + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** storage_provider_id ... */ + storage_provider_id: number; + /** compression_id ... */ + compression_id: number; +} + +/** + * EventFundPool is an event emitted when a pool is funded. + * emitted_by: MsgFundPool + */ +export interface EventFundPool { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** address is the account address of the pool funder. */ + address: string; + /** amount ... */ + amount: string; +} + +/** + * EventDefundPool is an event emitted when a pool is defunded. + * emitted_by: MsgDefundPool + */ +export interface EventDefundPool { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** address is the account address of the pool funder. */ + address: string; + /** amount ... */ + amount: string; +} + +/** + * EventDefundPool is an event emitted when a pool is defunded. + * emitted_by: MsgSubmitBundleProposal + */ +export interface EventPoolFundsSlashed { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** address is the account address of the pool funder. */ + address: string; + /** amount ... */ + amount: string; +} + +/** + * EventPoolOutOfFunds is an event emitted when a pool has run out of funds + * emitted_by: MsgSubmitBundleProposal + */ +export interface EventPoolOutOfFunds { + /** pool_id is the unique ID of the pool. */ + pool_id: string; +} + +function createBaseEventCreatePool(): EventCreatePool { + return { + id: "0", + name: "", + runtime: "", + logo: "", + config: "", + start_key: "", + upload_interval: "0", + operating_cost: "0", + min_delegation: "0", + max_bundle_size: "0", + version: "", + binaries: "", + storage_provider_id: 0, + compression_id: 0, + }; +} + +export const EventCreatePool = { + encode(message: EventCreatePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + if (message.config !== "") { + writer.uint32(42).string(message.config); + } + if (message.start_key !== "") { + writer.uint32(50).string(message.start_key); + } + if (message.upload_interval !== "0") { + writer.uint32(56).uint64(message.upload_interval); + } + if (message.operating_cost !== "0") { + writer.uint32(64).uint64(message.operating_cost); + } + if (message.min_delegation !== "0") { + writer.uint32(72).uint64(message.min_delegation); + } + if (message.max_bundle_size !== "0") { + writer.uint32(80).uint64(message.max_bundle_size); + } + if (message.version !== "") { + writer.uint32(90).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(98).string(message.binaries); + } + if (message.storage_provider_id !== 0) { + writer.uint32(104).uint32(message.storage_provider_id); + } + if (message.compression_id !== 0) { + writer.uint32(112).uint32(message.compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventCreatePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreatePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.runtime = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + case 5: + message.config = reader.string(); + break; + case 6: + message.start_key = reader.string(); + break; + case 7: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 8: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 9: + message.min_delegation = longToString(reader.uint64() as Long); + break; + case 10: + message.max_bundle_size = longToString(reader.uint64() as Long); + break; + case 11: + message.version = reader.string(); + break; + case 12: + message.binaries = reader.string(); + break; + case 13: + message.storage_provider_id = reader.uint32(); + break; + case 14: + message.compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventCreatePool { + return { + id: isSet(object.id) ? String(object.id) : "0", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + config: isSet(object.config) ? String(object.config) : "", + start_key: isSet(object.start_key) ? String(object.start_key) : "", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? String(object.max_bundle_size) : "0", + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? Number(object.compression_id) : 0, + }; + }, + + toJSON(message: EventCreatePool): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.config !== undefined && (obj.config = message.config); + message.start_key !== undefined && (obj.start_key = message.start_key); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.min_delegation !== undefined && (obj.min_delegation = message.min_delegation); + message.max_bundle_size !== undefined && (obj.max_bundle_size = message.max_bundle_size); + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + message.compression_id !== undefined && (obj.compression_id = Math.round(message.compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): EventCreatePool { + const message = createBaseEventCreatePool(); + message.id = object.id ?? "0"; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.config = object.config ?? ""; + message.start_key = object.start_key ?? ""; + message.upload_interval = object.upload_interval ?? "0"; + message.operating_cost = object.operating_cost ?? "0"; + message.min_delegation = object.min_delegation ?? "0"; + message.max_bundle_size = object.max_bundle_size ?? "0"; + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.storage_provider_id = object.storage_provider_id ?? 0; + message.compression_id = object.compression_id ?? 0; + return message; + }, +}; + +function createBaseEventFundPool(): EventFundPool { + return { pool_id: "0", address: "", amount: "0" }; +} + +export const EventFundPool = { + encode(message: EventFundPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventFundPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventFundPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventFundPool { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + address: isSet(object.address) ? String(object.address) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventFundPool): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.address !== undefined && (obj.address = message.address); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventFundPool { + const message = createBaseEventFundPool(); + message.pool_id = object.pool_id ?? "0"; + message.address = object.address ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventDefundPool(): EventDefundPool { + return { pool_id: "0", address: "", amount: "0" }; +} + +export const EventDefundPool = { + encode(message: EventDefundPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventDefundPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDefundPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventDefundPool { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + address: isSet(object.address) ? String(object.address) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventDefundPool): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.address !== undefined && (obj.address = message.address); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventDefundPool { + const message = createBaseEventDefundPool(); + message.pool_id = object.pool_id ?? "0"; + message.address = object.address ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventPoolFundsSlashed(): EventPoolFundsSlashed { + return { pool_id: "0", address: "", amount: "0" }; +} + +export const EventPoolFundsSlashed = { + encode(message: EventPoolFundsSlashed, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolFundsSlashed { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventPoolFundsSlashed(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventPoolFundsSlashed { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + address: isSet(object.address) ? String(object.address) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventPoolFundsSlashed): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.address !== undefined && (obj.address = message.address); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventPoolFundsSlashed { + const message = createBaseEventPoolFundsSlashed(); + message.pool_id = object.pool_id ?? "0"; + message.address = object.address ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventPoolOutOfFunds(): EventPoolOutOfFunds { + return { pool_id: "0" }; +} + +export const EventPoolOutOfFunds = { + encode(message: EventPoolOutOfFunds, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolOutOfFunds { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventPoolOutOfFunds(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventPoolOutOfFunds { + return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + }, + + toJSON(message: EventPoolOutOfFunds): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>(object: I): EventPoolOutOfFunds { + const message = createBaseEventPoolOutOfFunds(); + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/pool/v1beta1/genesis.ts b/common/types/src/client/kyve/pool/v1beta1/genesis.ts new file mode 100644 index 00000000..86bfc818 --- /dev/null +++ b/common/types/src/client/kyve/pool/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Pool } from "./pool"; + +export const protobufPackage = "kyve.pool.v1beta1"; + +/** GenesisState defines the pool module's genesis state. */ +export interface GenesisState { + /** pool_list ... */ + pool_list: Pool[]; + /** pool_count ... */ + pool_count: string; +} + +function createBaseGenesisState(): GenesisState { + return { pool_list: [], pool_count: "0" }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pool_list) { + Pool.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pool_count !== "0") { + writer.uint32(24).uint64(message.pool_count); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.pool_list.push(Pool.decode(reader, reader.uint32())); + break; + case 3: + message.pool_count = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + pool_list: Array.isArray(object?.pool_list) ? object.pool_list.map((e: any) => Pool.fromJSON(e)) : [], + pool_count: isSet(object.pool_count) ? String(object.pool_count) : "0", + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.pool_list) { + obj.pool_list = message.pool_list.map((e) => e ? Pool.toJSON(e) : undefined); + } else { + obj.pool_list = []; + } + message.pool_count !== undefined && (obj.pool_count = message.pool_count); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.pool_list = object.pool_list?.map((e) => Pool.fromPartial(e)) || []; + message.pool_count = object.pool_count ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/pool/v1beta1/pool.ts b/common/types/src/client/kyve/pool/v1beta1/pool.ts new file mode 100644 index 00000000..07cdc27e --- /dev/null +++ b/common/types/src/client/kyve/pool/v1beta1/pool.ts @@ -0,0 +1,634 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.pool.v1beta1"; + +/** PoolStatus ... */ +export enum PoolStatus { + /** POOL_STATUS_UNSPECIFIED - POOL_STATUS_UNSPECIFIED ... */ + POOL_STATUS_UNSPECIFIED = 0, + /** POOL_STATUS_ACTIVE - POOL_STATUS_ACTIVE ... */ + POOL_STATUS_ACTIVE = 1, + /** POOL_STATUS_PAUSED - POOL_STATUS_PAUSED ... */ + POOL_STATUS_PAUSED = 2, + /** POOL_STATUS_NO_FUNDS - POOL_STATUS_NO_FUNDS ... */ + POOL_STATUS_NO_FUNDS = 3, + /** POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_NOT_ENOUGH_DELEGATION ... */ + POOL_STATUS_NOT_ENOUGH_DELEGATION = 4, + /** POOL_STATUS_UPGRADING - POOL_STATUS_UPGRADING ... */ + POOL_STATUS_UPGRADING = 5, + UNRECOGNIZED = -1, +} + +export function poolStatusFromJSON(object: any): PoolStatus { + switch (object) { + case 0: + case "POOL_STATUS_UNSPECIFIED": + return PoolStatus.POOL_STATUS_UNSPECIFIED; + case 1: + case "POOL_STATUS_ACTIVE": + return PoolStatus.POOL_STATUS_ACTIVE; + case 2: + case "POOL_STATUS_PAUSED": + return PoolStatus.POOL_STATUS_PAUSED; + case 3: + case "POOL_STATUS_NO_FUNDS": + return PoolStatus.POOL_STATUS_NO_FUNDS; + case 4: + case "POOL_STATUS_NOT_ENOUGH_DELEGATION": + return PoolStatus.POOL_STATUS_NOT_ENOUGH_DELEGATION; + case 5: + case "POOL_STATUS_UPGRADING": + return PoolStatus.POOL_STATUS_UPGRADING; + case -1: + case "UNRECOGNIZED": + default: + return PoolStatus.UNRECOGNIZED; + } +} + +export function poolStatusToJSON(object: PoolStatus): string { + switch (object) { + case PoolStatus.POOL_STATUS_UNSPECIFIED: + return "POOL_STATUS_UNSPECIFIED"; + case PoolStatus.POOL_STATUS_ACTIVE: + return "POOL_STATUS_ACTIVE"; + case PoolStatus.POOL_STATUS_PAUSED: + return "POOL_STATUS_PAUSED"; + case PoolStatus.POOL_STATUS_NO_FUNDS: + return "POOL_STATUS_NO_FUNDS"; + case PoolStatus.POOL_STATUS_NOT_ENOUGH_DELEGATION: + return "POOL_STATUS_NOT_ENOUGH_DELEGATION"; + case PoolStatus.POOL_STATUS_UPGRADING: + return "POOL_STATUS_UPGRADING"; + case PoolStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** Protocol ... */ +export interface Protocol { + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** last_upgrade ... */ + last_upgrade: string; +} + +/** Upgrade ... */ +export interface UpgradePlan { + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** scheduled_at ... */ + scheduled_at: string; + /** duration ... */ + duration: string; +} + +/** Funder ... */ +export interface Funder { + /** address ... */ + address: string; + /** amount ... */ + amount: string; +} + +/** Pool ... */ +export interface Pool { + /** id ... */ + id: string; + /** name ... */ + name: string; + /** runtime ... */ + runtime: string; + /** logo ... */ + logo: string; + /** config ... */ + config: string; + /** start_key ... */ + start_key: string; + /** current_key ... */ + current_key: string; + /** current_summary ... */ + current_summary: string; + /** current_index ... */ + current_index: string; + /** total_bundles ... */ + total_bundles: string; + /** upload_interval ... */ + upload_interval: string; + /** operating_cost ... */ + operating_cost: string; + /** min_delegation ... */ + min_delegation: string; + /** max_bundle_size ... */ + max_bundle_size: string; + /** paused ... */ + paused: boolean; + /** funders ... */ + funders: Funder[]; + /** total_funds ... */ + total_funds: string; + /** protocol ... */ + protocol?: Protocol; + /** upgrade_plan ... */ + upgrade_plan?: UpgradePlan; + /** storage_provider_id ... */ + current_storage_provider_id: number; + /** compression_id ... */ + current_compression_id: number; +} + +function createBaseProtocol(): Protocol { + return { version: "", binaries: "", last_upgrade: "0" }; +} + +export const Protocol = { + encode(message: Protocol, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(18).string(message.binaries); + } + if (message.last_upgrade !== "0") { + writer.uint32(24).uint64(message.last_upgrade); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Protocol { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProtocol(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.binaries = reader.string(); + break; + case 3: + message.last_upgrade = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Protocol { + return { + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + last_upgrade: isSet(object.last_upgrade) ? String(object.last_upgrade) : "0", + }; + }, + + toJSON(message: Protocol): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.last_upgrade !== undefined && (obj.last_upgrade = message.last_upgrade); + return obj; + }, + + fromPartial, I>>(object: I): Protocol { + const message = createBaseProtocol(); + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.last_upgrade = object.last_upgrade ?? "0"; + return message; + }, +}; + +function createBaseUpgradePlan(): UpgradePlan { + return { version: "", binaries: "", scheduled_at: "0", duration: "0" }; +} + +export const UpgradePlan = { + encode(message: UpgradePlan, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(18).string(message.binaries); + } + if (message.scheduled_at !== "0") { + writer.uint32(24).uint64(message.scheduled_at); + } + if (message.duration !== "0") { + writer.uint32(32).uint64(message.duration); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpgradePlan { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpgradePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.binaries = reader.string(); + break; + case 3: + message.scheduled_at = longToString(reader.uint64() as Long); + break; + case 4: + message.duration = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UpgradePlan { + return { + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + scheduled_at: isSet(object.scheduled_at) ? String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? String(object.duration) : "0", + }; + }, + + toJSON(message: UpgradePlan): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.scheduled_at !== undefined && (obj.scheduled_at = message.scheduled_at); + message.duration !== undefined && (obj.duration = message.duration); + return obj; + }, + + fromPartial, I>>(object: I): UpgradePlan { + const message = createBaseUpgradePlan(); + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.scheduled_at = object.scheduled_at ?? "0"; + message.duration = object.duration ?? "0"; + return message; + }, +}; + +function createBaseFunder(): Funder { + return { address: "", amount: "0" }; +} + +export const Funder = { + encode(message: Funder, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.amount !== "0") { + writer.uint32(16).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Funder { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Funder { + return { + address: isSet(object.address) ? String(object.address) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: Funder): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): Funder { + const message = createBaseFunder(); + message.address = object.address ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBasePool(): Pool { + return { + id: "0", + name: "", + runtime: "", + logo: "", + config: "", + start_key: "", + current_key: "", + current_summary: "", + current_index: "0", + total_bundles: "0", + upload_interval: "0", + operating_cost: "0", + min_delegation: "0", + max_bundle_size: "0", + paused: false, + funders: [], + total_funds: "0", + protocol: undefined, + upgrade_plan: undefined, + current_storage_provider_id: 0, + current_compression_id: 0, + }; +} + +export const Pool = { + encode(message: Pool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + if (message.config !== "") { + writer.uint32(42).string(message.config); + } + if (message.start_key !== "") { + writer.uint32(50).string(message.start_key); + } + if (message.current_key !== "") { + writer.uint32(58).string(message.current_key); + } + if (message.current_summary !== "") { + writer.uint32(66).string(message.current_summary); + } + if (message.current_index !== "0") { + writer.uint32(72).uint64(message.current_index); + } + if (message.total_bundles !== "0") { + writer.uint32(80).uint64(message.total_bundles); + } + if (message.upload_interval !== "0") { + writer.uint32(88).uint64(message.upload_interval); + } + if (message.operating_cost !== "0") { + writer.uint32(96).uint64(message.operating_cost); + } + if (message.min_delegation !== "0") { + writer.uint32(104).uint64(message.min_delegation); + } + if (message.max_bundle_size !== "0") { + writer.uint32(112).uint64(message.max_bundle_size); + } + if (message.paused === true) { + writer.uint32(120).bool(message.paused); + } + for (const v of message.funders) { + Funder.encode(v!, writer.uint32(130).fork()).ldelim(); + } + if (message.total_funds !== "0") { + writer.uint32(136).uint64(message.total_funds); + } + if (message.protocol !== undefined) { + Protocol.encode(message.protocol, writer.uint32(146).fork()).ldelim(); + } + if (message.upgrade_plan !== undefined) { + UpgradePlan.encode(message.upgrade_plan, writer.uint32(154).fork()).ldelim(); + } + if (message.current_storage_provider_id !== 0) { + writer.uint32(160).uint32(message.current_storage_provider_id); + } + if (message.current_compression_id !== 0) { + writer.uint32(168).uint32(message.current_compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Pool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.id = longToString(reader.uint64() as Long); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.runtime = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + case 5: + message.config = reader.string(); + break; + case 6: + message.start_key = reader.string(); + break; + case 7: + message.current_key = reader.string(); + break; + case 8: + message.current_summary = reader.string(); + break; + case 9: + message.current_index = longToString(reader.uint64() as Long); + break; + case 10: + message.total_bundles = longToString(reader.uint64() as Long); + break; + case 11: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 12: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 13: + message.min_delegation = longToString(reader.uint64() as Long); + break; + case 14: + message.max_bundle_size = longToString(reader.uint64() as Long); + break; + case 15: + message.paused = reader.bool(); + break; + case 16: + message.funders.push(Funder.decode(reader, reader.uint32())); + break; + case 17: + message.total_funds = longToString(reader.uint64() as Long); + break; + case 18: + message.protocol = Protocol.decode(reader, reader.uint32()); + break; + case 19: + message.upgrade_plan = UpgradePlan.decode(reader, reader.uint32()); + break; + case 20: + message.current_storage_provider_id = reader.uint32(); + break; + case 21: + message.current_compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Pool { + return { + id: isSet(object.id) ? String(object.id) : "0", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + config: isSet(object.config) ? String(object.config) : "", + start_key: isSet(object.start_key) ? String(object.start_key) : "", + current_key: isSet(object.current_key) ? String(object.current_key) : "", + current_summary: isSet(object.current_summary) ? String(object.current_summary) : "", + current_index: isSet(object.current_index) ? String(object.current_index) : "0", + total_bundles: isSet(object.total_bundles) ? String(object.total_bundles) : "0", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? String(object.max_bundle_size) : "0", + paused: isSet(object.paused) ? Boolean(object.paused) : false, + funders: Array.isArray(object?.funders) ? object.funders.map((e: any) => Funder.fromJSON(e)) : [], + total_funds: isSet(object.total_funds) ? String(object.total_funds) : "0", + protocol: isSet(object.protocol) ? Protocol.fromJSON(object.protocol) : undefined, + upgrade_plan: isSet(object.upgrade_plan) ? UpgradePlan.fromJSON(object.upgrade_plan) : undefined, + current_storage_provider_id: isSet(object.current_storage_provider_id) + ? Number(object.current_storage_provider_id) + : 0, + current_compression_id: isSet(object.current_compression_id) ? Number(object.current_compression_id) : 0, + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.config !== undefined && (obj.config = message.config); + message.start_key !== undefined && (obj.start_key = message.start_key); + message.current_key !== undefined && (obj.current_key = message.current_key); + message.current_summary !== undefined && (obj.current_summary = message.current_summary); + message.current_index !== undefined && (obj.current_index = message.current_index); + message.total_bundles !== undefined && (obj.total_bundles = message.total_bundles); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.min_delegation !== undefined && (obj.min_delegation = message.min_delegation); + message.max_bundle_size !== undefined && (obj.max_bundle_size = message.max_bundle_size); + message.paused !== undefined && (obj.paused = message.paused); + if (message.funders) { + obj.funders = message.funders.map((e) => e ? Funder.toJSON(e) : undefined); + } else { + obj.funders = []; + } + message.total_funds !== undefined && (obj.total_funds = message.total_funds); + message.protocol !== undefined && (obj.protocol = message.protocol ? Protocol.toJSON(message.protocol) : undefined); + message.upgrade_plan !== undefined && + (obj.upgrade_plan = message.upgrade_plan ? UpgradePlan.toJSON(message.upgrade_plan) : undefined); + message.current_storage_provider_id !== undefined && + (obj.current_storage_provider_id = Math.round(message.current_storage_provider_id)); + message.current_compression_id !== undefined && + (obj.current_compression_id = Math.round(message.current_compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.id = object.id ?? "0"; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.config = object.config ?? ""; + message.start_key = object.start_key ?? ""; + message.current_key = object.current_key ?? ""; + message.current_summary = object.current_summary ?? ""; + message.current_index = object.current_index ?? "0"; + message.total_bundles = object.total_bundles ?? "0"; + message.upload_interval = object.upload_interval ?? "0"; + message.operating_cost = object.operating_cost ?? "0"; + message.min_delegation = object.min_delegation ?? "0"; + message.max_bundle_size = object.max_bundle_size ?? "0"; + message.paused = object.paused ?? false; + message.funders = object.funders?.map((e) => Funder.fromPartial(e)) || []; + message.total_funds = object.total_funds ?? "0"; + message.protocol = (object.protocol !== undefined && object.protocol !== null) + ? Protocol.fromPartial(object.protocol) + : undefined; + message.upgrade_plan = (object.upgrade_plan !== undefined && object.upgrade_plan !== null) + ? UpgradePlan.fromPartial(object.upgrade_plan) + : undefined; + message.current_storage_provider_id = object.current_storage_provider_id ?? 0; + message.current_compression_id = object.current_compression_id ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/pool/v1beta1/tx.ts b/common/types/src/client/kyve/pool/v1beta1/tx.ts new file mode 100644 index 00000000..885fad21 --- /dev/null +++ b/common/types/src/client/kyve/pool/v1beta1/tx.ts @@ -0,0 +1,1233 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.pool.v1beta1"; + +/** MsgFundPool defines a SDK message for funding a pool. */ +export interface MsgFundPool { + /** creator ... */ + creator: string; + /** id ... */ + id: string; + /** amount ... */ + amount: string; +} + +/** MsgFundPoolResponse defines the Msg/DefundPool response type. */ +export interface MsgFundPoolResponse { +} + +/** MsgDefundPool defines a SDK message for defunding a pool. */ +export interface MsgDefundPool { + /** creator ... */ + creator: string; + /** id ... */ + id: string; + /** amount ... */ + amount: string; +} + +/** MsgDefundPoolResponse defines the Msg/DefundPool response type. */ +export interface MsgDefundPoolResponse { +} + +/** MsgCreatePool defines a SDK message for creating a new pool. */ +export interface MsgCreatePool { + /** authority is the address of the governance account. */ + authority: string; + /** name ... */ + name: string; + /** runtime ... */ + runtime: string; + /** logo ... */ + logo: string; + /** config ... */ + config: string; + /** start_key ... */ + start_key: string; + /** upload_interval ... */ + upload_interval: string; + /** operating_cost ... */ + operating_cost: string; + /** min_delegation ... */ + min_delegation: string; + /** max_bundle_size ... */ + max_bundle_size: string; + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** storage_provider_id ... */ + storage_provider_id: number; + /** compression_id ... */ + compression_id: number; +} + +/** MsgCreatePoolResponse defines the Msg/CreatePool response type. */ +export interface MsgCreatePoolResponse { +} + +/** MsgUpdatePool defines a SDK message for updating an existing pool. */ +export interface MsgUpdatePool { + /** authority is the address of the governance account. */ + authority: string; + /** id ... */ + id: string; + /** payload ... */ + payload: string; +} + +/** MsgUpdatePoolResponse defines the Msg/UpdatePool response type. */ +export interface MsgUpdatePoolResponse { +} + +/** MsgPausePool defines a SDK message for pausing an existing pool. */ +export interface MsgPausePool { + /** authority is the address of the governance account. */ + authority: string; + /** id ... */ + id: string; +} + +/** MsgPausePoolResponse defines the Msg/PausePool response type. */ +export interface MsgPausePoolResponse { +} + +/** MsgUnpausePool defines a SDK message for unpausing an existing pool. */ +export interface MsgUnpausePool { + /** authority is the address of the governance account. */ + authority: string; + /** id ... */ + id: string; +} + +/** MsgUnpausePoolResponse defines the Msg/UnpausePool response type. */ +export interface MsgUnpausePoolResponse { +} + +/** MsgScheduleRuntimeUpgrade defines a SDK message for scheduling a runtime upgrade. */ +export interface MsgScheduleRuntimeUpgrade { + /** authority is the address of the governance account. */ + authority: string; + /** runtime ... */ + runtime: string; + /** version ... */ + version: string; + /** scheduled_at ... */ + scheduled_at: string; + /** duration ... */ + duration: string; + /** binaries ... */ + binaries: string; +} + +/** MsgScheduleRuntimeUpgradeResponse defines the Msg/ScheduleRuntimeUpgrade response type. */ +export interface MsgScheduleRuntimeUpgradeResponse { +} + +/** MsgCancelRuntimeUpgrade defines a SDK message for cancelling a runtime upgrade. */ +export interface MsgCancelRuntimeUpgrade { + /** authority is the address of the governance account. */ + authority: string; + /** runtime ... */ + runtime: string; +} + +/** MsgCancelRuntimeUpgradeResponse defines the Msg/CancelRuntimeUpgrade response type. */ +export interface MsgCancelRuntimeUpgradeResponse { +} + +function createBaseMsgFundPool(): MsgFundPool { + return { creator: "", id: "0", amount: "0" }; +} + +export const MsgFundPool = { + encode(message: MsgFundPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgFundPool { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + id: isSet(object.id) ? String(object.id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgFundPool): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.id !== undefined && (obj.id = message.id); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgFundPool { + const message = createBaseMsgFundPool(); + message.creator = object.creator ?? ""; + message.id = object.id ?? "0"; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgFundPoolResponse(): MsgFundPoolResponse { + return {}; +} + +export const MsgFundPoolResponse = { + encode(_: MsgFundPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgFundPoolResponse { + return {}; + }, + + toJSON(_: MsgFundPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgFundPoolResponse { + const message = createBaseMsgFundPoolResponse(); + return message; + }, +}; + +function createBaseMsgDefundPool(): MsgDefundPool { + return { creator: "", id: "0", amount: "0" }; +} + +export const MsgDefundPool = { + encode(message: MsgDefundPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDefundPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDefundPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDefundPool { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + id: isSet(object.id) ? String(object.id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgDefundPool): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.id !== undefined && (obj.id = message.id); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgDefundPool { + const message = createBaseMsgDefundPool(); + message.creator = object.creator ?? ""; + message.id = object.id ?? "0"; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgDefundPoolResponse(): MsgDefundPoolResponse { + return {}; +} + +export const MsgDefundPoolResponse = { + encode(_: MsgDefundPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDefundPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDefundPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgDefundPoolResponse { + return {}; + }, + + toJSON(_: MsgDefundPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgDefundPoolResponse { + const message = createBaseMsgDefundPoolResponse(); + return message; + }, +}; + +function createBaseMsgCreatePool(): MsgCreatePool { + return { + authority: "", + name: "", + runtime: "", + logo: "", + config: "", + start_key: "", + upload_interval: "0", + operating_cost: "0", + min_delegation: "0", + max_bundle_size: "0", + version: "", + binaries: "", + storage_provider_id: 0, + compression_id: 0, + }; +} + +export const MsgCreatePool = { + encode(message: MsgCreatePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + if (message.config !== "") { + writer.uint32(42).string(message.config); + } + if (message.start_key !== "") { + writer.uint32(50).string(message.start_key); + } + if (message.upload_interval !== "0") { + writer.uint32(56).uint64(message.upload_interval); + } + if (message.operating_cost !== "0") { + writer.uint32(64).uint64(message.operating_cost); + } + if (message.min_delegation !== "0") { + writer.uint32(72).uint64(message.min_delegation); + } + if (message.max_bundle_size !== "0") { + writer.uint32(80).uint64(message.max_bundle_size); + } + if (message.version !== "") { + writer.uint32(90).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(98).string(message.binaries); + } + if (message.storage_provider_id !== 0) { + writer.uint32(104).uint32(message.storage_provider_id); + } + if (message.compression_id !== 0) { + writer.uint32(112).uint32(message.compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.runtime = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + case 5: + message.config = reader.string(); + break; + case 6: + message.start_key = reader.string(); + break; + case 7: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 8: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 9: + message.min_delegation = longToString(reader.uint64() as Long); + break; + case 10: + message.max_bundle_size = longToString(reader.uint64() as Long); + break; + case 11: + message.version = reader.string(); + break; + case 12: + message.binaries = reader.string(); + break; + case 13: + message.storage_provider_id = reader.uint32(); + break; + case 14: + message.compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreatePool { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + config: isSet(object.config) ? String(object.config) : "", + start_key: isSet(object.start_key) ? String(object.start_key) : "", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? String(object.max_bundle_size) : "0", + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? Number(object.compression_id) : 0, + }; + }, + + toJSON(message: MsgCreatePool): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.config !== undefined && (obj.config = message.config); + message.start_key !== undefined && (obj.start_key = message.start_key); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.min_delegation !== undefined && (obj.min_delegation = message.min_delegation); + message.max_bundle_size !== undefined && (obj.max_bundle_size = message.max_bundle_size); + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + message.compression_id !== undefined && (obj.compression_id = Math.round(message.compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreatePool { + const message = createBaseMsgCreatePool(); + message.authority = object.authority ?? ""; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.config = object.config ?? ""; + message.start_key = object.start_key ?? ""; + message.upload_interval = object.upload_interval ?? "0"; + message.operating_cost = object.operating_cost ?? "0"; + message.min_delegation = object.min_delegation ?? "0"; + message.max_bundle_size = object.max_bundle_size ?? "0"; + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.storage_provider_id = object.storage_provider_id ?? 0; + message.compression_id = object.compression_id ?? 0; + return message; + }, +}; + +function createBaseMsgCreatePoolResponse(): MsgCreatePoolResponse { + return {}; +} + +export const MsgCreatePoolResponse = { + encode(_: MsgCreatePoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCreatePoolResponse { + return {}; + }, + + toJSON(_: MsgCreatePoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCreatePoolResponse { + const message = createBaseMsgCreatePoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdatePool(): MsgUpdatePool { + return { authority: "", id: "0", payload: "" }; +} + +export const MsgUpdatePool = { + encode(message: MsgUpdatePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.payload !== "") { + writer.uint32(26).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdatePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdatePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdatePool { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + id: isSet(object.id) ? String(object.id) : "0", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: MsgUpdatePool): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.id !== undefined && (obj.id = message.id); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdatePool { + const message = createBaseMsgUpdatePool(); + message.authority = object.authority ?? ""; + message.id = object.id ?? "0"; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBaseMsgUpdatePoolResponse(): MsgUpdatePoolResponse { + return {}; +} + +export const MsgUpdatePoolResponse = { + encode(_: MsgUpdatePoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdatePoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdatePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUpdatePoolResponse { + return {}; + }, + + toJSON(_: MsgUpdatePoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdatePoolResponse { + const message = createBaseMsgUpdatePoolResponse(); + return message; + }, +}; + +function createBaseMsgPausePool(): MsgPausePool { + return { authority: "", id: "0" }; +} + +export const MsgPausePool = { + encode(message: MsgPausePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgPausePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPausePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgPausePool { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + id: isSet(object.id) ? String(object.id) : "0", + }; + }, + + toJSON(message: MsgPausePool): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): MsgPausePool { + const message = createBaseMsgPausePool(); + message.authority = object.authority ?? ""; + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseMsgPausePoolResponse(): MsgPausePoolResponse { + return {}; +} + +export const MsgPausePoolResponse = { + encode(_: MsgPausePoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgPausePoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPausePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgPausePoolResponse { + return {}; + }, + + toJSON(_: MsgPausePoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgPausePoolResponse { + const message = createBaseMsgPausePoolResponse(); + return message; + }, +}; + +function createBaseMsgUnpausePool(): MsgUnpausePool { + return { authority: "", id: "0" }; +} + +export const MsgUnpausePool = { + encode(message: MsgUnpausePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUnpausePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpausePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUnpausePool { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + id: isSet(object.id) ? String(object.id) : "0", + }; + }, + + toJSON(message: MsgUnpausePool): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): MsgUnpausePool { + const message = createBaseMsgUnpausePool(); + message.authority = object.authority ?? ""; + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseMsgUnpausePoolResponse(): MsgUnpausePoolResponse { + return {}; +} + +export const MsgUnpausePoolResponse = { + encode(_: MsgUnpausePoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUnpausePoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpausePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUnpausePoolResponse { + return {}; + }, + + toJSON(_: MsgUnpausePoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUnpausePoolResponse { + const message = createBaseMsgUnpausePoolResponse(); + return message; + }, +}; + +function createBaseMsgScheduleRuntimeUpgrade(): MsgScheduleRuntimeUpgrade { + return { authority: "", runtime: "", version: "", scheduled_at: "0", duration: "0", binaries: "" }; +} + +export const MsgScheduleRuntimeUpgrade = { + encode(message: MsgScheduleRuntimeUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.runtime !== "") { + writer.uint32(18).string(message.runtime); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.scheduled_at !== "0") { + writer.uint32(32).uint64(message.scheduled_at); + } + if (message.duration !== "0") { + writer.uint32(40).uint64(message.duration); + } + if (message.binaries !== "") { + writer.uint32(50).string(message.binaries); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgScheduleRuntimeUpgrade { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgScheduleRuntimeUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.runtime = reader.string(); + break; + case 3: + message.version = reader.string(); + break; + case 4: + message.scheduled_at = longToString(reader.uint64() as Long); + break; + case 5: + message.duration = longToString(reader.uint64() as Long); + break; + case 6: + message.binaries = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgScheduleRuntimeUpgrade { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + version: isSet(object.version) ? String(object.version) : "", + scheduled_at: isSet(object.scheduled_at) ? String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? String(object.duration) : "0", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + }; + }, + + toJSON(message: MsgScheduleRuntimeUpgrade): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.version !== undefined && (obj.version = message.version); + message.scheduled_at !== undefined && (obj.scheduled_at = message.scheduled_at); + message.duration !== undefined && (obj.duration = message.duration); + message.binaries !== undefined && (obj.binaries = message.binaries); + return obj; + }, + + fromPartial, I>>(object: I): MsgScheduleRuntimeUpgrade { + const message = createBaseMsgScheduleRuntimeUpgrade(); + message.authority = object.authority ?? ""; + message.runtime = object.runtime ?? ""; + message.version = object.version ?? ""; + message.scheduled_at = object.scheduled_at ?? "0"; + message.duration = object.duration ?? "0"; + message.binaries = object.binaries ?? ""; + return message; + }, +}; + +function createBaseMsgScheduleRuntimeUpgradeResponse(): MsgScheduleRuntimeUpgradeResponse { + return {}; +} + +export const MsgScheduleRuntimeUpgradeResponse = { + encode(_: MsgScheduleRuntimeUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgScheduleRuntimeUpgradeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgScheduleRuntimeUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgScheduleRuntimeUpgradeResponse { + return {}; + }, + + toJSON(_: MsgScheduleRuntimeUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgScheduleRuntimeUpgradeResponse { + const message = createBaseMsgScheduleRuntimeUpgradeResponse(); + return message; + }, +}; + +function createBaseMsgCancelRuntimeUpgrade(): MsgCancelRuntimeUpgrade { + return { authority: "", runtime: "" }; +} + +export const MsgCancelRuntimeUpgrade = { + encode(message: MsgCancelRuntimeUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.runtime !== "") { + writer.uint32(18).string(message.runtime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelRuntimeUpgrade { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelRuntimeUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.runtime = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCancelRuntimeUpgrade { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + }; + }, + + toJSON(message: MsgCancelRuntimeUpgrade): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.runtime !== undefined && (obj.runtime = message.runtime); + return obj; + }, + + fromPartial, I>>(object: I): MsgCancelRuntimeUpgrade { + const message = createBaseMsgCancelRuntimeUpgrade(); + message.authority = object.authority ?? ""; + message.runtime = object.runtime ?? ""; + return message; + }, +}; + +function createBaseMsgCancelRuntimeUpgradeResponse(): MsgCancelRuntimeUpgradeResponse { + return {}; +} + +export const MsgCancelRuntimeUpgradeResponse = { + encode(_: MsgCancelRuntimeUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelRuntimeUpgradeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelRuntimeUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCancelRuntimeUpgradeResponse { + return {}; + }, + + toJSON(_: MsgCancelRuntimeUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCancelRuntimeUpgradeResponse { + const message = createBaseMsgCancelRuntimeUpgradeResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** FundPool ... */ + FundPool(request: MsgFundPool): Promise; + /** DefundPool ... */ + DefundPool(request: MsgDefundPool): Promise; + /** + * CreatePool defines a governance operation for creating a new pool. + * The authority is hard-coded to the x/gov module account. + */ + CreatePool(request: MsgCreatePool): Promise; + /** + * UpdatePool defines a governance operation for updating an existing pool. + * The authority is hard-coded to the x/gov module account. + */ + UpdatePool(request: MsgUpdatePool): Promise; + /** + * PausingPool defines a governance operation for pausing an existing pool. + * The authority is hard-coded to the x/gov module account. + */ + PausePool(request: MsgPausePool): Promise; + /** + * UnpausePool defines a governance operation for unpausing an existing pool. + * The authority is hard-coded to the x/gov module account. + */ + UnpausePool(request: MsgUnpausePool): Promise; + /** + * ScheduleRuntimeUpgrade defines a governance operation for scheduling a runtime upgrade. + * The authority is hard-coded to the x/gov module account. + */ + ScheduleRuntimeUpgrade(request: MsgScheduleRuntimeUpgrade): Promise; + /** + * CancelRuntimeUpgrade defines a governance operation for cancelling a runtime upgrade. + * The authority is hard-coded to the x/gov module account. + */ + CancelRuntimeUpgrade(request: MsgCancelRuntimeUpgrade): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.pool.v1beta1.Msg"; + this.rpc = rpc; + this.FundPool = this.FundPool.bind(this); + this.DefundPool = this.DefundPool.bind(this); + this.CreatePool = this.CreatePool.bind(this); + this.UpdatePool = this.UpdatePool.bind(this); + this.PausePool = this.PausePool.bind(this); + this.UnpausePool = this.UnpausePool.bind(this); + this.ScheduleRuntimeUpgrade = this.ScheduleRuntimeUpgrade.bind(this); + this.CancelRuntimeUpgrade = this.CancelRuntimeUpgrade.bind(this); + } + FundPool(request: MsgFundPool): Promise { + const data = MsgFundPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "FundPool", data); + return promise.then((data) => MsgFundPoolResponse.decode(new _m0.Reader(data))); + } + + DefundPool(request: MsgDefundPool): Promise { + const data = MsgDefundPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DefundPool", data); + return promise.then((data) => MsgDefundPoolResponse.decode(new _m0.Reader(data))); + } + + CreatePool(request: MsgCreatePool): Promise { + const data = MsgCreatePool.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreatePool", data); + return promise.then((data) => MsgCreatePoolResponse.decode(new _m0.Reader(data))); + } + + UpdatePool(request: MsgUpdatePool): Promise { + const data = MsgUpdatePool.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdatePool", data); + return promise.then((data) => MsgUpdatePoolResponse.decode(new _m0.Reader(data))); + } + + PausePool(request: MsgPausePool): Promise { + const data = MsgPausePool.encode(request).finish(); + const promise = this.rpc.request(this.service, "PausePool", data); + return promise.then((data) => MsgPausePoolResponse.decode(new _m0.Reader(data))); + } + + UnpausePool(request: MsgUnpausePool): Promise { + const data = MsgUnpausePool.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnpausePool", data); + return promise.then((data) => MsgUnpausePoolResponse.decode(new _m0.Reader(data))); + } + + ScheduleRuntimeUpgrade(request: MsgScheduleRuntimeUpgrade): Promise { + const data = MsgScheduleRuntimeUpgrade.encode(request).finish(); + const promise = this.rpc.request(this.service, "ScheduleRuntimeUpgrade", data); + return promise.then((data) => MsgScheduleRuntimeUpgradeResponse.decode(new _m0.Reader(data))); + } + + CancelRuntimeUpgrade(request: MsgCancelRuntimeUpgrade): Promise { + const data = MsgCancelRuntimeUpgrade.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelRuntimeUpgrade", data); + return promise.then((data) => MsgCancelRuntimeUpgradeResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/query/v1beta1/account.ts b/common/types/src/client/kyve/query/v1beta1/account.ts new file mode 100644 index 00000000..1a12e74d --- /dev/null +++ b/common/types/src/client/kyve/query/v1beta1/account.ts @@ -0,0 +1,880 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { BasicPool, FullStaker } from "./query"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** QueryAccountAssetsRequest is the request type for the Query/AccountAssets RPC method. */ +export interface QueryAccountAssetsRequest { + /** address ... */ + address: string; +} + +/** QueryAccountAssetsResponse is the response type for the Query/AccountAssets RPC method. */ +export interface QueryAccountAssetsResponse { + /** balance ... */ + balance: string; + /** protocol_staking ... */ + protocol_self_delegation: string; + /** protocol_staking_unbonding */ + protocol_self_delegation_unbonding: string; + /** protocol_delegation ... */ + protocol_delegation: string; + /** protocol_delegation_unbonding */ + protocol_delegation_unbonding: string; + /** protocol_rewards ... */ + protocol_rewards: string; + /** protocol_funding ... */ + protocol_funding: string; +} + +/** QueryAccountFundedListRequest ... */ +export interface QueryAccountDelegationUnbondingsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** address ... */ + address: string; +} + +/** QueryAccountAssetsResponse is the response type for the Query/AccountAssets RPC method. */ +export interface QueryAccountDelegationUnbondingsResponse { + /** balance ... */ + unbondings: DelegationUnbonding[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryAccountAssetsResponse is the response type for the Query/AccountAssets RPC method. */ +export interface DelegationUnbonding { + /** amount */ + amount: string; + /** creation_time */ + creation_time: string; + /** staker */ + staker?: FullStaker; +} + +/** QueryAccountFundedListRequest is the request type for the account queries with pagination */ +export interface QueryAccountFundedListRequest { + /** address ... */ + address: string; +} + +/** QueryAccountFundedListResponse is the response type for the Query/AccountFundedList RPC method. */ +export interface QueryAccountFundedListResponse { + /** funded ... */ + funded: Funded[]; +} + +/** Funded ... */ +export interface Funded { + /** amount ... */ + amount: string; + /** pool ... */ + pool?: BasicPool; +} + +/** QueryAccountDelegationListRequest ... */ +export interface QueryAccountRedelegationRequest { + /** address ... */ + address: string; +} + +/** QueryAccountDelegationListRequest is the response type for the Query/AccountDelegationList RPC method. */ +export interface QueryAccountRedelegationResponse { + /** redelegation_cooldown_entries ... */ + redelegation_cooldown_entries: RedelegationEntry[]; + /** availableSlots ... */ + available_slots: string; +} + +/** RedelegationEntry ... */ +export interface RedelegationEntry { + /** creation_date ... */ + creation_date: string; + /** finish_date ... */ + finish_date: string; +} + +function createBaseQueryAccountAssetsRequest(): QueryAccountAssetsRequest { + return { address: "" }; +} + +export const QueryAccountAssetsRequest = { + encode(message: QueryAccountAssetsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountAssetsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAssetsRequest(); + 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; + }, + + fromJSON(object: any): QueryAccountAssetsRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryAccountAssetsRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountAssetsRequest { + const message = createBaseQueryAccountAssetsRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountAssetsResponse(): QueryAccountAssetsResponse { + return { + balance: "0", + protocol_self_delegation: "0", + protocol_self_delegation_unbonding: "0", + protocol_delegation: "0", + protocol_delegation_unbonding: "0", + protocol_rewards: "0", + protocol_funding: "0", + }; +} + +export const QueryAccountAssetsResponse = { + encode(message: QueryAccountAssetsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.balance !== "0") { + writer.uint32(8).uint64(message.balance); + } + if (message.protocol_self_delegation !== "0") { + writer.uint32(16).uint64(message.protocol_self_delegation); + } + if (message.protocol_self_delegation_unbonding !== "0") { + writer.uint32(24).uint64(message.protocol_self_delegation_unbonding); + } + if (message.protocol_delegation !== "0") { + writer.uint32(32).uint64(message.protocol_delegation); + } + if (message.protocol_delegation_unbonding !== "0") { + writer.uint32(40).uint64(message.protocol_delegation_unbonding); + } + if (message.protocol_rewards !== "0") { + writer.uint32(48).uint64(message.protocol_rewards); + } + if (message.protocol_funding !== "0") { + writer.uint32(56).uint64(message.protocol_funding); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountAssetsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAssetsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balance = longToString(reader.uint64() as Long); + break; + case 2: + message.protocol_self_delegation = longToString(reader.uint64() as Long); + break; + case 3: + message.protocol_self_delegation_unbonding = longToString(reader.uint64() as Long); + break; + case 4: + message.protocol_delegation = longToString(reader.uint64() as Long); + break; + case 5: + message.protocol_delegation_unbonding = longToString(reader.uint64() as Long); + break; + case 6: + message.protocol_rewards = longToString(reader.uint64() as Long); + break; + case 7: + message.protocol_funding = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountAssetsResponse { + return { + balance: isSet(object.balance) ? String(object.balance) : "0", + protocol_self_delegation: isSet(object.protocol_self_delegation) ? String(object.protocol_self_delegation) : "0", + protocol_self_delegation_unbonding: isSet(object.protocol_self_delegation_unbonding) + ? String(object.protocol_self_delegation_unbonding) + : "0", + protocol_delegation: isSet(object.protocol_delegation) ? String(object.protocol_delegation) : "0", + protocol_delegation_unbonding: isSet(object.protocol_delegation_unbonding) + ? String(object.protocol_delegation_unbonding) + : "0", + protocol_rewards: isSet(object.protocol_rewards) ? String(object.protocol_rewards) : "0", + protocol_funding: isSet(object.protocol_funding) ? String(object.protocol_funding) : "0", + }; + }, + + toJSON(message: QueryAccountAssetsResponse): unknown { + const obj: any = {}; + message.balance !== undefined && (obj.balance = message.balance); + message.protocol_self_delegation !== undefined && (obj.protocol_self_delegation = message.protocol_self_delegation); + message.protocol_self_delegation_unbonding !== undefined && + (obj.protocol_self_delegation_unbonding = message.protocol_self_delegation_unbonding); + message.protocol_delegation !== undefined && (obj.protocol_delegation = message.protocol_delegation); + message.protocol_delegation_unbonding !== undefined && + (obj.protocol_delegation_unbonding = message.protocol_delegation_unbonding); + message.protocol_rewards !== undefined && (obj.protocol_rewards = message.protocol_rewards); + message.protocol_funding !== undefined && (obj.protocol_funding = message.protocol_funding); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountAssetsResponse { + const message = createBaseQueryAccountAssetsResponse(); + message.balance = object.balance ?? "0"; + message.protocol_self_delegation = object.protocol_self_delegation ?? "0"; + message.protocol_self_delegation_unbonding = object.protocol_self_delegation_unbonding ?? "0"; + message.protocol_delegation = object.protocol_delegation ?? "0"; + message.protocol_delegation_unbonding = object.protocol_delegation_unbonding ?? "0"; + message.protocol_rewards = object.protocol_rewards ?? "0"; + message.protocol_funding = object.protocol_funding ?? "0"; + return message; + }, +}; + +function createBaseQueryAccountDelegationUnbondingsRequest(): QueryAccountDelegationUnbondingsRequest { + return { pagination: undefined, address: "" }; +} + +export const QueryAccountDelegationUnbondingsRequest = { + encode(message: QueryAccountDelegationUnbondingsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountDelegationUnbondingsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountDelegationUnbondingsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountDelegationUnbondingsRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + address: isSet(object.address) ? String(object.address) : "", + }; + }, + + toJSON(message: QueryAccountDelegationUnbondingsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountDelegationUnbondingsRequest { + const message = createBaseQueryAccountDelegationUnbondingsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountDelegationUnbondingsResponse(): QueryAccountDelegationUnbondingsResponse { + return { unbondings: [], pagination: undefined }; +} + +export const QueryAccountDelegationUnbondingsResponse = { + encode(message: QueryAccountDelegationUnbondingsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.unbondings) { + DelegationUnbonding.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountDelegationUnbondingsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountDelegationUnbondingsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbondings.push(DelegationUnbonding.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountDelegationUnbondingsResponse { + return { + unbondings: Array.isArray(object?.unbondings) + ? object.unbondings.map((e: any) => DelegationUnbonding.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAccountDelegationUnbondingsResponse): unknown { + const obj: any = {}; + if (message.unbondings) { + obj.unbondings = message.unbondings.map((e) => e ? DelegationUnbonding.toJSON(e) : undefined); + } else { + obj.unbondings = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountDelegationUnbondingsResponse { + const message = createBaseQueryAccountDelegationUnbondingsResponse(); + message.unbondings = object.unbondings?.map((e) => DelegationUnbonding.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseDelegationUnbonding(): DelegationUnbonding { + return { amount: "0", creation_time: "0", staker: undefined }; +} + +export const DelegationUnbonding = { + encode(message: DelegationUnbonding, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== "0") { + writer.uint32(8).uint64(message.amount); + } + if (message.creation_time !== "0") { + writer.uint32(16).uint64(message.creation_time); + } + if (message.staker !== undefined) { + FullStaker.encode(message.staker, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationUnbonding { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationUnbonding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = longToString(reader.uint64() as Long); + break; + case 2: + message.creation_time = longToString(reader.uint64() as Long); + break; + case 3: + message.staker = FullStaker.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationUnbonding { + return { + amount: isSet(object.amount) ? String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? String(object.creation_time) : "0", + staker: isSet(object.staker) ? FullStaker.fromJSON(object.staker) : undefined, + }; + }, + + toJSON(message: DelegationUnbonding): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount); + message.creation_time !== undefined && (obj.creation_time = message.creation_time); + message.staker !== undefined && (obj.staker = message.staker ? FullStaker.toJSON(message.staker) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DelegationUnbonding { + const message = createBaseDelegationUnbonding(); + message.amount = object.amount ?? "0"; + message.creation_time = object.creation_time ?? "0"; + message.staker = (object.staker !== undefined && object.staker !== null) + ? FullStaker.fromPartial(object.staker) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountFundedListRequest(): QueryAccountFundedListRequest { + return { address: "" }; +} + +export const QueryAccountFundedListRequest = { + encode(message: QueryAccountFundedListRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountFundedListRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountFundedListRequest(); + 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; + }, + + fromJSON(object: any): QueryAccountFundedListRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryAccountFundedListRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountFundedListRequest { + const message = createBaseQueryAccountFundedListRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountFundedListResponse(): QueryAccountFundedListResponse { + return { funded: [] }; +} + +export const QueryAccountFundedListResponse = { + encode(message: QueryAccountFundedListResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.funded) { + Funded.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountFundedListResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountFundedListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.funded.push(Funded.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountFundedListResponse { + return { funded: Array.isArray(object?.funded) ? object.funded.map((e: any) => Funded.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryAccountFundedListResponse): unknown { + const obj: any = {}; + if (message.funded) { + obj.funded = message.funded.map((e) => e ? Funded.toJSON(e) : undefined); + } else { + obj.funded = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountFundedListResponse { + const message = createBaseQueryAccountFundedListResponse(); + message.funded = object.funded?.map((e) => Funded.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFunded(): Funded { + return { amount: "0", pool: undefined }; +} + +export const Funded = { + encode(message: Funded, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== "0") { + writer.uint32(8).uint64(message.amount); + } + if (message.pool !== undefined) { + BasicPool.encode(message.pool, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Funded { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunded(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = longToString(reader.uint64() as Long); + break; + case 2: + message.pool = BasicPool.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Funded { + return { + amount: isSet(object.amount) ? String(object.amount) : "0", + pool: isSet(object.pool) ? BasicPool.fromJSON(object.pool) : undefined, + }; + }, + + toJSON(message: Funded): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount); + message.pool !== undefined && (obj.pool = message.pool ? BasicPool.toJSON(message.pool) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Funded { + const message = createBaseFunded(); + message.amount = object.amount ?? "0"; + message.pool = (object.pool !== undefined && object.pool !== null) ? BasicPool.fromPartial(object.pool) : undefined; + return message; + }, +}; + +function createBaseQueryAccountRedelegationRequest(): QueryAccountRedelegationRequest { + return { address: "" }; +} + +export const QueryAccountRedelegationRequest = { + encode(message: QueryAccountRedelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRedelegationRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRedelegationRequest(); + 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; + }, + + fromJSON(object: any): QueryAccountRedelegationRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRedelegationRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountRedelegationRequest { + const message = createBaseQueryAccountRedelegationRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountRedelegationResponse(): QueryAccountRedelegationResponse { + return { redelegation_cooldown_entries: [], available_slots: "0" }; +} + +export const QueryAccountRedelegationResponse = { + encode(message: QueryAccountRedelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.redelegation_cooldown_entries) { + RedelegationEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.available_slots !== "0") { + writer.uint32(16).uint64(message.available_slots); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRedelegationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegation_cooldown_entries.push(RedelegationEntry.decode(reader, reader.uint32())); + break; + case 2: + message.available_slots = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountRedelegationResponse { + return { + redelegation_cooldown_entries: Array.isArray(object?.redelegation_cooldown_entries) + ? object.redelegation_cooldown_entries.map((e: any) => RedelegationEntry.fromJSON(e)) + : [], + available_slots: isSet(object.available_slots) ? String(object.available_slots) : "0", + }; + }, + + toJSON(message: QueryAccountRedelegationResponse): unknown { + const obj: any = {}; + if (message.redelegation_cooldown_entries) { + obj.redelegation_cooldown_entries = message.redelegation_cooldown_entries.map((e) => + e ? RedelegationEntry.toJSON(e) : undefined + ); + } else { + obj.redelegation_cooldown_entries = []; + } + message.available_slots !== undefined && (obj.available_slots = message.available_slots); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountRedelegationResponse { + const message = createBaseQueryAccountRedelegationResponse(); + message.redelegation_cooldown_entries = + object.redelegation_cooldown_entries?.map((e) => RedelegationEntry.fromPartial(e)) || []; + message.available_slots = object.available_slots ?? "0"; + return message; + }, +}; + +function createBaseRedelegationEntry(): RedelegationEntry { + return { creation_date: "0", finish_date: "0" }; +} + +export const RedelegationEntry = { + encode(message: RedelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creation_date !== "0") { + writer.uint32(8).uint64(message.creation_date); + } + if (message.finish_date !== "0") { + writer.uint32(16).uint64(message.finish_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.creation_date = longToString(reader.uint64() as Long); + break; + case 2: + message.finish_date = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RedelegationEntry { + return { + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + finish_date: isSet(object.finish_date) ? String(object.finish_date) : "0", + }; + }, + + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + message.finish_date !== undefined && (obj.finish_date = message.finish_date); + return obj; + }, + + fromPartial, I>>(object: I): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creation_date = object.creation_date ?? "0"; + message.finish_date = object.finish_date ?? "0"; + return message; + }, +}; + +/** QueryDelegation contains all rpc requests related to direct delegation data */ +export interface QueryAccount { + /** AccountAssets returns an overview of the sum of all balances for a given user. e.g. balance, staking, funding, etc. */ + AccountAssets(request: QueryAccountAssetsRequest): Promise; + /** AccountDelegationUnbondings ... */ + AccountDelegationUnbondings( + request: QueryAccountDelegationUnbondingsRequest, + ): Promise; + /** AccountFundedList returns all pools the given user has funded into. */ + AccountFundedList(request: QueryAccountFundedListRequest): Promise; + /** AccountRedelegation ... */ + AccountRedelegation(request: QueryAccountRedelegationRequest): Promise; +} + +export class QueryAccountClientImpl implements QueryAccount { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryAccount"; + this.rpc = rpc; + this.AccountAssets = this.AccountAssets.bind(this); + this.AccountDelegationUnbondings = this.AccountDelegationUnbondings.bind(this); + this.AccountFundedList = this.AccountFundedList.bind(this); + this.AccountRedelegation = this.AccountRedelegation.bind(this); + } + AccountAssets(request: QueryAccountAssetsRequest): Promise { + const data = QueryAccountAssetsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountAssets", data); + return promise.then((data) => QueryAccountAssetsResponse.decode(new _m0.Reader(data))); + } + + AccountDelegationUnbondings( + request: QueryAccountDelegationUnbondingsRequest, + ): Promise { + const data = QueryAccountDelegationUnbondingsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountDelegationUnbondings", data); + return promise.then((data) => QueryAccountDelegationUnbondingsResponse.decode(new _m0.Reader(data))); + } + + AccountFundedList(request: QueryAccountFundedListRequest): Promise { + const data = QueryAccountFundedListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountFundedList", data); + return promise.then((data) => QueryAccountFundedListResponse.decode(new _m0.Reader(data))); + } + + AccountRedelegation(request: QueryAccountRedelegationRequest): Promise { + const data = QueryAccountRedelegationRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountRedelegation", data); + return promise.then((data) => QueryAccountRedelegationResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/query/v1beta1/bundles.ts b/common/types/src/client/kyve/query/v1beta1/bundles.ts new file mode 100644 index 00000000..fa32d124 --- /dev/null +++ b/common/types/src/client/kyve/query/v1beta1/bundles.ts @@ -0,0 +1,1097 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { FinalizedBundle } from "../../bundles/v1beta1/bundles"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** QueryFinalizedBundlesRequest is the request type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundlesRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** pool_id ... */ + pool_id: string; +} + +/** QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundlesResponse { + /** finalized_bundles ... */ + finalized_bundles: FinalizedBundle[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryFinalizedBundleRequest is the request type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundleRequest { + /** pool_id ... */ + pool_id: string; + /** id ... */ + id: string; +} + +/** QueryFinalizedBundleResponse is the response type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundleResponse { + /** finalized_bundle ... */ + finalized_bundle?: FinalizedBundle; +} + +/** QueryFinalizedBundleRequest is the request type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundlesByHeightRequest { + /** pool_id ... */ + pool_id: string; + /** id ... */ + height: string; +} + +/** QueryFinalizedBundleResponse is the response type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundlesByHeightResponse { + /** finalized_bundle ... */ + finalized_bundle?: FinalizedBundle; +} + +/** QueryCurrentVoteStatusRequest is the request type for the Query/Staker RPC method. */ +export interface QueryCurrentVoteStatusRequest { + /** pool_id ... */ + pool_id: string; +} + +/** QueryCurrentVoteStatusResponse is the response type for the Query/Staker RPC method. */ +export interface QueryCurrentVoteStatusResponse { + /** valid ... */ + valid: string; + /** invalid ... */ + invalid: string; + /** abstain ... */ + abstain: string; + /** total ... */ + total: string; +} + +/** QueryCanProposeRequest is the request type for the Query/CanPropose RPC method. */ +export interface QueryCanValidateRequest { + /** pool_id defines the unique ID of the pool. */ + pool_id: string; + /** valaddress ... */ + valaddress: string; +} + +/** QueryCanProposeResponse is the response type for the Query/CanPropose RPC method. */ +export interface QueryCanValidateResponse { + /** possible ... */ + possible: boolean; + /** reason ... */ + reason: string; +} + +/** QueryCanProposeRequest is the request type for the Query/CanPropose RPC method. */ +export interface QueryCanProposeRequest { + /** pool_id defines the unique ID of the pool. */ + pool_id: string; + /** staker ... */ + staker: string; + /** proposer ... */ + proposer: string; + /** from_index ... */ + from_index: string; +} + +/** QueryCanProposeResponse is the response type for the Query/CanPropose RPC method. */ +export interface QueryCanProposeResponse { + /** possible ... */ + possible: boolean; + /** reason ... */ + reason: string; +} + +/** QueryCanVoteRequest is the request type for the Query/CanVote RPC method. */ +export interface QueryCanVoteRequest { + /** pool_id defines the unique ID of the pool. */ + pool_id: string; + /** staker ... */ + staker: string; + /** voter ... */ + voter: string; + /** storage_id ... */ + storage_id: string; +} + +/** QueryCanVoteResponse is the response type for the Query/CanVote RPC method. */ +export interface QueryCanVoteResponse { + /** possible ... */ + possible: boolean; + /** reason ... */ + reason: string; +} + +function createBaseQueryFinalizedBundlesRequest(): QueryFinalizedBundlesRequest { + return { pagination: undefined, pool_id: "0" }; +} + +export const QueryFinalizedBundlesRequest = { + encode(message: QueryFinalizedBundlesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundlesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundlesRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + }; + }, + + toJSON(message: QueryFinalizedBundlesRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryFinalizedBundlesRequest { + const message = createBaseQueryFinalizedBundlesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +function createBaseQueryFinalizedBundlesResponse(): QueryFinalizedBundlesResponse { + return { finalized_bundles: [], pagination: undefined }; +} + +export const QueryFinalizedBundlesResponse = { + encode(message: QueryFinalizedBundlesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.finalized_bundles) { + FinalizedBundle.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundlesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.finalized_bundles.push(FinalizedBundle.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundlesResponse { + return { + finalized_bundles: Array.isArray(object?.finalized_bundles) + ? object.finalized_bundles.map((e: any) => FinalizedBundle.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryFinalizedBundlesResponse): unknown { + const obj: any = {}; + if (message.finalized_bundles) { + obj.finalized_bundles = message.finalized_bundles.map((e) => e ? FinalizedBundle.toJSON(e) : undefined); + } else { + obj.finalized_bundles = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryFinalizedBundlesResponse { + const message = createBaseQueryFinalizedBundlesResponse(); + message.finalized_bundles = object.finalized_bundles?.map((e) => FinalizedBundle.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryFinalizedBundleRequest(): QueryFinalizedBundleRequest { + return { pool_id: "0", id: "0" }; +} + +export const QueryFinalizedBundleRequest = { + encode(message: QueryFinalizedBundleRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundleRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundleRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundleRequest { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + }; + }, + + toJSON(message: QueryFinalizedBundleRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): QueryFinalizedBundleRequest { + const message = createBaseQueryFinalizedBundleRequest(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseQueryFinalizedBundleResponse(): QueryFinalizedBundleResponse { + return { finalized_bundle: undefined }; +} + +export const QueryFinalizedBundleResponse = { + encode(message: QueryFinalizedBundleResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.finalized_bundle !== undefined) { + FinalizedBundle.encode(message.finalized_bundle, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundleResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundleResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.finalized_bundle = FinalizedBundle.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundleResponse { + return { + finalized_bundle: isSet(object.finalized_bundle) ? FinalizedBundle.fromJSON(object.finalized_bundle) : undefined, + }; + }, + + toJSON(message: QueryFinalizedBundleResponse): unknown { + const obj: any = {}; + message.finalized_bundle !== undefined && + (obj.finalized_bundle = message.finalized_bundle ? FinalizedBundle.toJSON(message.finalized_bundle) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryFinalizedBundleResponse { + const message = createBaseQueryFinalizedBundleResponse(); + message.finalized_bundle = (object.finalized_bundle !== undefined && object.finalized_bundle !== null) + ? FinalizedBundle.fromPartial(object.finalized_bundle) + : undefined; + return message; + }, +}; + +function createBaseQueryFinalizedBundlesByHeightRequest(): QueryFinalizedBundlesByHeightRequest { + return { pool_id: "0", height: "0" }; +} + +export const QueryFinalizedBundlesByHeightRequest = { + encode(message: QueryFinalizedBundlesByHeightRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.height !== "0") { + writer.uint32(16).uint64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesByHeightRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundlesByHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.height = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundlesByHeightRequest { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + height: isSet(object.height) ? String(object.height) : "0", + }; + }, + + toJSON(message: QueryFinalizedBundlesByHeightRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryFinalizedBundlesByHeightRequest { + const message = createBaseQueryFinalizedBundlesByHeightRequest(); + message.pool_id = object.pool_id ?? "0"; + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseQueryFinalizedBundlesByHeightResponse(): QueryFinalizedBundlesByHeightResponse { + return { finalized_bundle: undefined }; +} + +export const QueryFinalizedBundlesByHeightResponse = { + encode(message: QueryFinalizedBundlesByHeightResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.finalized_bundle !== undefined) { + FinalizedBundle.encode(message.finalized_bundle, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesByHeightResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundlesByHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.finalized_bundle = FinalizedBundle.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundlesByHeightResponse { + return { + finalized_bundle: isSet(object.finalized_bundle) ? FinalizedBundle.fromJSON(object.finalized_bundle) : undefined, + }; + }, + + toJSON(message: QueryFinalizedBundlesByHeightResponse): unknown { + const obj: any = {}; + message.finalized_bundle !== undefined && + (obj.finalized_bundle = message.finalized_bundle ? FinalizedBundle.toJSON(message.finalized_bundle) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryFinalizedBundlesByHeightResponse { + const message = createBaseQueryFinalizedBundlesByHeightResponse(); + message.finalized_bundle = (object.finalized_bundle !== undefined && object.finalized_bundle !== null) + ? FinalizedBundle.fromPartial(object.finalized_bundle) + : undefined; + return message; + }, +}; + +function createBaseQueryCurrentVoteStatusRequest(): QueryCurrentVoteStatusRequest { + return { pool_id: "0" }; +} + +export const QueryCurrentVoteStatusRequest = { + encode(message: QueryCurrentVoteStatusRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentVoteStatusRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentVoteStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCurrentVoteStatusRequest { + return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + }, + + toJSON(message: QueryCurrentVoteStatusRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryCurrentVoteStatusRequest { + const message = createBaseQueryCurrentVoteStatusRequest(); + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +function createBaseQueryCurrentVoteStatusResponse(): QueryCurrentVoteStatusResponse { + return { valid: "0", invalid: "0", abstain: "0", total: "0" }; +} + +export const QueryCurrentVoteStatusResponse = { + encode(message: QueryCurrentVoteStatusResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.valid !== "0") { + writer.uint32(8).uint64(message.valid); + } + if (message.invalid !== "0") { + writer.uint32(16).uint64(message.invalid); + } + if (message.abstain !== "0") { + writer.uint32(24).uint64(message.abstain); + } + if (message.total !== "0") { + writer.uint32(32).uint64(message.total); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentVoteStatusResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentVoteStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.valid = longToString(reader.uint64() as Long); + break; + case 2: + message.invalid = longToString(reader.uint64() as Long); + break; + case 3: + message.abstain = longToString(reader.uint64() as Long); + break; + case 4: + message.total = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCurrentVoteStatusResponse { + return { + valid: isSet(object.valid) ? String(object.valid) : "0", + invalid: isSet(object.invalid) ? String(object.invalid) : "0", + abstain: isSet(object.abstain) ? String(object.abstain) : "0", + total: isSet(object.total) ? String(object.total) : "0", + }; + }, + + toJSON(message: QueryCurrentVoteStatusResponse): unknown { + const obj: any = {}; + message.valid !== undefined && (obj.valid = message.valid); + message.invalid !== undefined && (obj.invalid = message.invalid); + message.abstain !== undefined && (obj.abstain = message.abstain); + message.total !== undefined && (obj.total = message.total); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryCurrentVoteStatusResponse { + const message = createBaseQueryCurrentVoteStatusResponse(); + message.valid = object.valid ?? "0"; + message.invalid = object.invalid ?? "0"; + message.abstain = object.abstain ?? "0"; + message.total = object.total ?? "0"; + return message; + }, +}; + +function createBaseQueryCanValidateRequest(): QueryCanValidateRequest { + return { pool_id: "0", valaddress: "" }; +} + +export const QueryCanValidateRequest = { + encode(message: QueryCanValidateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.valaddress !== "") { + writer.uint32(18).string(message.valaddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanValidateRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanValidateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.valaddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanValidateRequest { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + valaddress: isSet(object.valaddress) ? String(object.valaddress) : "", + }; + }, + + toJSON(message: QueryCanValidateRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.valaddress !== undefined && (obj.valaddress = message.valaddress); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanValidateRequest { + const message = createBaseQueryCanValidateRequest(); + message.pool_id = object.pool_id ?? "0"; + message.valaddress = object.valaddress ?? ""; + return message; + }, +}; + +function createBaseQueryCanValidateResponse(): QueryCanValidateResponse { + return { possible: false, reason: "" }; +} + +export const QueryCanValidateResponse = { + encode(message: QueryCanValidateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.possible === true) { + writer.uint32(8).bool(message.possible); + } + if (message.reason !== "") { + writer.uint32(18).string(message.reason); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanValidateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanValidateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.possible = reader.bool(); + break; + case 2: + message.reason = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanValidateResponse { + return { + possible: isSet(object.possible) ? Boolean(object.possible) : false, + reason: isSet(object.reason) ? String(object.reason) : "", + }; + }, + + toJSON(message: QueryCanValidateResponse): unknown { + const obj: any = {}; + message.possible !== undefined && (obj.possible = message.possible); + message.reason !== undefined && (obj.reason = message.reason); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanValidateResponse { + const message = createBaseQueryCanValidateResponse(); + message.possible = object.possible ?? false; + message.reason = object.reason ?? ""; + return message; + }, +}; + +function createBaseQueryCanProposeRequest(): QueryCanProposeRequest { + return { pool_id: "0", staker: "", proposer: "", from_index: "0" }; +} + +export const QueryCanProposeRequest = { + encode(message: QueryCanProposeRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.from_index !== "0") { + writer.uint32(32).uint64(message.from_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanProposeRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanProposeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.proposer = reader.string(); + break; + case 4: + message.from_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanProposeRequest { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + proposer: isSet(object.proposer) ? String(object.proposer) : "", + from_index: isSet(object.from_index) ? String(object.from_index) : "0", + }; + }, + + toJSON(message: QueryCanProposeRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.proposer !== undefined && (obj.proposer = message.proposer); + message.from_index !== undefined && (obj.from_index = message.from_index); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanProposeRequest { + const message = createBaseQueryCanProposeRequest(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.proposer = object.proposer ?? ""; + message.from_index = object.from_index ?? "0"; + return message; + }, +}; + +function createBaseQueryCanProposeResponse(): QueryCanProposeResponse { + return { possible: false, reason: "" }; +} + +export const QueryCanProposeResponse = { + encode(message: QueryCanProposeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.possible === true) { + writer.uint32(8).bool(message.possible); + } + if (message.reason !== "") { + writer.uint32(18).string(message.reason); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanProposeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanProposeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.possible = reader.bool(); + break; + case 2: + message.reason = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanProposeResponse { + return { + possible: isSet(object.possible) ? Boolean(object.possible) : false, + reason: isSet(object.reason) ? String(object.reason) : "", + }; + }, + + toJSON(message: QueryCanProposeResponse): unknown { + const obj: any = {}; + message.possible !== undefined && (obj.possible = message.possible); + message.reason !== undefined && (obj.reason = message.reason); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanProposeResponse { + const message = createBaseQueryCanProposeResponse(); + message.possible = object.possible ?? false; + message.reason = object.reason ?? ""; + return message; + }, +}; + +function createBaseQueryCanVoteRequest(): QueryCanVoteRequest { + return { pool_id: "0", staker: "", voter: "", storage_id: "" }; +} + +export const QueryCanVoteRequest = { + encode(message: QueryCanVoteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.voter !== "") { + writer.uint32(26).string(message.voter); + } + if (message.storage_id !== "") { + writer.uint32(34).string(message.storage_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanVoteRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.voter = reader.string(); + break; + case 4: + message.storage_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanVoteRequest { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + voter: isSet(object.voter) ? String(object.voter) : "", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + }; + }, + + toJSON(message: QueryCanVoteRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.voter !== undefined && (obj.voter = message.voter); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanVoteRequest { + const message = createBaseQueryCanVoteRequest(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.voter = object.voter ?? ""; + message.storage_id = object.storage_id ?? ""; + return message; + }, +}; + +function createBaseQueryCanVoteResponse(): QueryCanVoteResponse { + return { possible: false, reason: "" }; +} + +export const QueryCanVoteResponse = { + encode(message: QueryCanVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.possible === true) { + writer.uint32(8).bool(message.possible); + } + if (message.reason !== "") { + writer.uint32(18).string(message.reason); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.possible = reader.bool(); + break; + case 2: + message.reason = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanVoteResponse { + return { + possible: isSet(object.possible) ? Boolean(object.possible) : false, + reason: isSet(object.reason) ? String(object.reason) : "", + }; + }, + + toJSON(message: QueryCanVoteResponse): unknown { + const obj: any = {}; + message.possible !== undefined && (obj.possible = message.possible); + message.reason !== undefined && (obj.reason = message.reason); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanVoteResponse { + const message = createBaseQueryCanVoteResponse(); + message.possible = object.possible ?? false; + message.reason = object.reason ?? ""; + return message; + }, +}; + +/** QueryDelegation contains all rpc requests related to direct delegation data */ +export interface QueryBundles { + /** FinalizedBundles ... */ + FinalizedBundles(request: QueryFinalizedBundlesRequest): Promise; + /** FinalizedBundle ... */ + FinalizedBundle(request: QueryFinalizedBundleRequest): Promise; + /** Queries the bundle which contains the data given height */ + FinalizedBundlesByHeight( + request: QueryFinalizedBundlesByHeightRequest, + ): Promise; + /** CurrentVoteStatus ... */ + CurrentVoteStatus(request: QueryCurrentVoteStatusRequest): Promise; + /** CanValidate ... */ + CanValidate(request: QueryCanValidateRequest): Promise; + /** CanPropose ... */ + CanPropose(request: QueryCanProposeRequest): Promise; + /** CanVote checks if voter on pool can still vote for the given bundle */ + CanVote(request: QueryCanVoteRequest): Promise; +} + +export class QueryBundlesClientImpl implements QueryBundles { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryBundles"; + this.rpc = rpc; + this.FinalizedBundles = this.FinalizedBundles.bind(this); + this.FinalizedBundle = this.FinalizedBundle.bind(this); + this.FinalizedBundlesByHeight = this.FinalizedBundlesByHeight.bind(this); + this.CurrentVoteStatus = this.CurrentVoteStatus.bind(this); + this.CanValidate = this.CanValidate.bind(this); + this.CanPropose = this.CanPropose.bind(this); + this.CanVote = this.CanVote.bind(this); + } + FinalizedBundles(request: QueryFinalizedBundlesRequest): Promise { + const data = QueryFinalizedBundlesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizedBundles", data); + return promise.then((data) => QueryFinalizedBundlesResponse.decode(new _m0.Reader(data))); + } + + FinalizedBundle(request: QueryFinalizedBundleRequest): Promise { + const data = QueryFinalizedBundleRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizedBundle", data); + return promise.then((data) => QueryFinalizedBundleResponse.decode(new _m0.Reader(data))); + } + + FinalizedBundlesByHeight( + request: QueryFinalizedBundlesByHeightRequest, + ): Promise { + const data = QueryFinalizedBundlesByHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizedBundlesByHeight", data); + return promise.then((data) => QueryFinalizedBundlesByHeightResponse.decode(new _m0.Reader(data))); + } + + CurrentVoteStatus(request: QueryCurrentVoteStatusRequest): Promise { + const data = QueryCurrentVoteStatusRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CurrentVoteStatus", data); + return promise.then((data) => QueryCurrentVoteStatusResponse.decode(new _m0.Reader(data))); + } + + CanValidate(request: QueryCanValidateRequest): Promise { + const data = QueryCanValidateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CanValidate", data); + return promise.then((data) => QueryCanValidateResponse.decode(new _m0.Reader(data))); + } + + CanPropose(request: QueryCanProposeRequest): Promise { + const data = QueryCanProposeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CanPropose", data); + return promise.then((data) => QueryCanProposeResponse.decode(new _m0.Reader(data))); + } + + CanVote(request: QueryCanVoteRequest): Promise { + const data = QueryCanVoteRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CanVote", data); + return promise.then((data) => QueryCanVoteResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/query/v1beta1/delegation.ts b/common/types/src/client/kyve/query/v1beta1/delegation.ts new file mode 100644 index 00000000..5c87d5b4 --- /dev/null +++ b/common/types/src/client/kyve/query/v1beta1/delegation.ts @@ -0,0 +1,698 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { FullStaker } from "./query"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** QueryDelegatorRequest is the request type for the Query/Delegator RPC method. */ +export interface QueryDelegatorRequest { + /** staker ... */ + staker: string; + /** delegator ... */ + delegator: string; +} + +/** QueryDelegatorResponse is the response type for the Query/Delegator RPC method. */ +export interface QueryDelegatorResponse { + /** delegator ... */ + delegator?: StakerDelegatorResponse; +} + +/** StakerDelegatorResponse ... */ +export interface StakerDelegatorResponse { + /** delegator ... */ + delegator: string; + /** current_reward ... */ + current_reward: string; + /** delegation_amount ... */ + delegation_amount: string; + /** staker ... */ + staker: string; +} + +/** QueryDelegatorsByStakerRequest ... */ +export interface QueryDelegatorsByStakerRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** staker ... */ + staker: string; +} + +/** QueryDelegatorsByStakerResponse ... */ +export interface QueryDelegatorsByStakerResponse { + /** delegators ... */ + delegators: StakerDelegatorResponse[]; + /** total_delegation ... (consider metadata object) */ + total_delegation: string; + /** total_delegation ... */ + total_delegator_count: string; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryStakersByDelegatorRequest ... */ +export interface QueryStakersByDelegatorRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** delegator ... */ + delegator: string; +} + +/** QueryStakersByDelegatorResponse ... */ +export interface QueryStakersByDelegatorResponse { + /** delegator ... */ + delegator: string; + /** stakers ... */ + stakers: DelegationForStakerResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** DelegationForStakerResponse ... */ +export interface DelegationForStakerResponse { + /** staker ... */ + staker?: FullStaker; + /** current_reward ... */ + current_reward: string; + /** delegation_amount ... */ + delegation_amount: string; +} + +function createBaseQueryDelegatorRequest(): QueryDelegatorRequest { + return { staker: "", delegator: "" }; +} + +export const QueryDelegatorRequest = { + encode(message: QueryDelegatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.delegator !== "") { + writer.uint32(18).string(message.delegator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.delegator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorRequest { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + delegator: isSet(object.delegator) ? String(object.delegator) : "", + }; + }, + + toJSON(message: QueryDelegatorRequest): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.delegator !== undefined && (obj.delegator = message.delegator); + return obj; + }, + + fromPartial, I>>(object: I): QueryDelegatorRequest { + const message = createBaseQueryDelegatorRequest(); + message.staker = object.staker ?? ""; + message.delegator = object.delegator ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorResponse(): QueryDelegatorResponse { + return { delegator: undefined }; +} + +export const QueryDelegatorResponse = { + encode(message: QueryDelegatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator !== undefined) { + StakerDelegatorResponse.encode(message.delegator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator = StakerDelegatorResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorResponse { + return { delegator: isSet(object.delegator) ? StakerDelegatorResponse.fromJSON(object.delegator) : undefined }; + }, + + toJSON(message: QueryDelegatorResponse): unknown { + const obj: any = {}; + message.delegator !== undefined && + (obj.delegator = message.delegator ? StakerDelegatorResponse.toJSON(message.delegator) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDelegatorResponse { + const message = createBaseQueryDelegatorResponse(); + message.delegator = (object.delegator !== undefined && object.delegator !== null) + ? StakerDelegatorResponse.fromPartial(object.delegator) + : undefined; + return message; + }, +}; + +function createBaseStakerDelegatorResponse(): StakerDelegatorResponse { + return { delegator: "", current_reward: "0", delegation_amount: "0", staker: "" }; +} + +export const StakerDelegatorResponse = { + encode(message: StakerDelegatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator !== "") { + writer.uint32(10).string(message.delegator); + } + if (message.current_reward !== "0") { + writer.uint32(16).uint64(message.current_reward); + } + if (message.delegation_amount !== "0") { + writer.uint32(24).uint64(message.delegation_amount); + } + if (message.staker !== "") { + writer.uint32(34).string(message.staker); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakerDelegatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakerDelegatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator = reader.string(); + break; + case 2: + message.current_reward = longToString(reader.uint64() as Long); + break; + case 3: + message.delegation_amount = longToString(reader.uint64() as Long); + break; + case 4: + message.staker = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StakerDelegatorResponse { + return { + delegator: isSet(object.delegator) ? String(object.delegator) : "", + current_reward: isSet(object.current_reward) ? String(object.current_reward) : "0", + delegation_amount: isSet(object.delegation_amount) ? String(object.delegation_amount) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + }; + }, + + toJSON(message: StakerDelegatorResponse): unknown { + const obj: any = {}; + message.delegator !== undefined && (obj.delegator = message.delegator); + message.current_reward !== undefined && (obj.current_reward = message.current_reward); + message.delegation_amount !== undefined && (obj.delegation_amount = message.delegation_amount); + message.staker !== undefined && (obj.staker = message.staker); + return obj; + }, + + fromPartial, I>>(object: I): StakerDelegatorResponse { + const message = createBaseStakerDelegatorResponse(); + message.delegator = object.delegator ?? ""; + message.current_reward = object.current_reward ?? "0"; + message.delegation_amount = object.delegation_amount ?? "0"; + message.staker = object.staker ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorsByStakerRequest(): QueryDelegatorsByStakerRequest { + return { pagination: undefined, staker: "" }; +} + +export const QueryDelegatorsByStakerRequest = { + encode(message: QueryDelegatorsByStakerRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorsByStakerRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorsByStakerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.staker = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorsByStakerRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + staker: isSet(object.staker) ? String(object.staker) : "", + }; + }, + + toJSON(message: QueryDelegatorsByStakerRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.staker !== undefined && (obj.staker = message.staker); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorsByStakerRequest { + const message = createBaseQueryDelegatorsByStakerRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.staker = object.staker ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorsByStakerResponse(): QueryDelegatorsByStakerResponse { + return { delegators: [], total_delegation: "0", total_delegator_count: "0", pagination: undefined }; +} + +export const QueryDelegatorsByStakerResponse = { + encode(message: QueryDelegatorsByStakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.delegators) { + StakerDelegatorResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.total_delegation !== "0") { + writer.uint32(16).uint64(message.total_delegation); + } + if (message.total_delegator_count !== "0") { + writer.uint32(24).uint64(message.total_delegator_count); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorsByStakerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorsByStakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegators.push(StakerDelegatorResponse.decode(reader, reader.uint32())); + break; + case 2: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 3: + message.total_delegator_count = longToString(reader.uint64() as Long); + break; + case 4: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorsByStakerResponse { + return { + delegators: Array.isArray(object?.delegators) + ? object.delegators.map((e: any) => StakerDelegatorResponse.fromJSON(e)) + : [], + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + total_delegator_count: isSet(object.total_delegator_count) ? String(object.total_delegator_count) : "0", + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorsByStakerResponse): unknown { + const obj: any = {}; + if (message.delegators) { + obj.delegators = message.delegators.map((e) => e ? StakerDelegatorResponse.toJSON(e) : undefined); + } else { + obj.delegators = []; + } + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.total_delegator_count !== undefined && (obj.total_delegator_count = message.total_delegator_count); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorsByStakerResponse { + const message = createBaseQueryDelegatorsByStakerResponse(); + message.delegators = object.delegators?.map((e) => StakerDelegatorResponse.fromPartial(e)) || []; + message.total_delegation = object.total_delegation ?? "0"; + message.total_delegator_count = object.total_delegator_count ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryStakersByDelegatorRequest(): QueryStakersByDelegatorRequest { + return { pagination: undefined, delegator: "" }; +} + +export const QueryStakersByDelegatorRequest = { + encode(message: QueryStakersByDelegatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.delegator !== "") { + writer.uint32(18).string(message.delegator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByDelegatorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByDelegatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.delegator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersByDelegatorRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + delegator: isSet(object.delegator) ? String(object.delegator) : "", + }; + }, + + toJSON(message: QueryStakersByDelegatorRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.delegator !== undefined && (obj.delegator = message.delegator); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryStakersByDelegatorRequest { + const message = createBaseQueryStakersByDelegatorRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.delegator = object.delegator ?? ""; + return message; + }, +}; + +function createBaseQueryStakersByDelegatorResponse(): QueryStakersByDelegatorResponse { + return { delegator: "", stakers: [], pagination: undefined }; +} + +export const QueryStakersByDelegatorResponse = { + encode(message: QueryStakersByDelegatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator !== "") { + writer.uint32(10).string(message.delegator); + } + for (const v of message.stakers) { + DelegationForStakerResponse.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByDelegatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByDelegatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator = reader.string(); + break; + case 2: + message.stakers.push(DelegationForStakerResponse.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersByDelegatorResponse { + return { + delegator: isSet(object.delegator) ? String(object.delegator) : "", + stakers: Array.isArray(object?.stakers) + ? object.stakers.map((e: any) => DelegationForStakerResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryStakersByDelegatorResponse): unknown { + const obj: any = {}; + message.delegator !== undefined && (obj.delegator = message.delegator); + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e ? DelegationForStakerResponse.toJSON(e) : undefined); + } else { + obj.stakers = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryStakersByDelegatorResponse { + const message = createBaseQueryStakersByDelegatorResponse(); + message.delegator = object.delegator ?? ""; + message.stakers = object.stakers?.map((e) => DelegationForStakerResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseDelegationForStakerResponse(): DelegationForStakerResponse { + return { staker: undefined, current_reward: "0", delegation_amount: "0" }; +} + +export const DelegationForStakerResponse = { + encode(message: DelegationForStakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== undefined) { + FullStaker.encode(message.staker, writer.uint32(10).fork()).ldelim(); + } + if (message.current_reward !== "0") { + writer.uint32(16).uint64(message.current_reward); + } + if (message.delegation_amount !== "0") { + writer.uint32(24).uint64(message.delegation_amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationForStakerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationForStakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = FullStaker.decode(reader, reader.uint32()); + break; + case 2: + message.current_reward = longToString(reader.uint64() as Long); + break; + case 3: + message.delegation_amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationForStakerResponse { + return { + staker: isSet(object.staker) ? FullStaker.fromJSON(object.staker) : undefined, + current_reward: isSet(object.current_reward) ? String(object.current_reward) : "0", + delegation_amount: isSet(object.delegation_amount) ? String(object.delegation_amount) : "0", + }; + }, + + toJSON(message: DelegationForStakerResponse): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker ? FullStaker.toJSON(message.staker) : undefined); + message.current_reward !== undefined && (obj.current_reward = message.current_reward); + message.delegation_amount !== undefined && (obj.delegation_amount = message.delegation_amount); + return obj; + }, + + fromPartial, I>>(object: I): DelegationForStakerResponse { + const message = createBaseDelegationForStakerResponse(); + message.staker = (object.staker !== undefined && object.staker !== null) + ? FullStaker.fromPartial(object.staker) + : undefined; + message.current_reward = object.current_reward ?? "0"; + message.delegation_amount = object.delegation_amount ?? "0"; + return message; + }, +}; + +/** QueryDelegation contains all rpc requests related to direct delegation data */ +export interface QueryDelegation { + /** Delegator returns delegation information for a specific delegator of a specific staker. */ + Delegator(request: QueryDelegatorRequest): Promise; + /** + * DelegatorsByStaker returns all delegators that have delegated to the given staker + * This query is paginated. + */ + DelegatorsByStaker(request: QueryDelegatorsByStakerRequest): Promise; + /** + * StakersByPoolAndDelegator returns all stakers the given delegator has delegated to. + * This query is paginated. + */ + StakersByDelegator(request: QueryStakersByDelegatorRequest): Promise; +} + +export class QueryDelegationClientImpl implements QueryDelegation { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryDelegation"; + this.rpc = rpc; + this.Delegator = this.Delegator.bind(this); + this.DelegatorsByStaker = this.DelegatorsByStaker.bind(this); + this.StakersByDelegator = this.StakersByDelegator.bind(this); + } + Delegator(request: QueryDelegatorRequest): Promise { + const data = QueryDelegatorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Delegator", data); + return promise.then((data) => QueryDelegatorResponse.decode(new _m0.Reader(data))); + } + + DelegatorsByStaker(request: QueryDelegatorsByStakerRequest): Promise { + const data = QueryDelegatorsByStakerRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorsByStaker", data); + return promise.then((data) => QueryDelegatorsByStakerResponse.decode(new _m0.Reader(data))); + } + + StakersByDelegator(request: QueryStakersByDelegatorRequest): Promise { + const data = QueryStakersByDelegatorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "StakersByDelegator", data); + return promise.then((data) => QueryStakersByDelegatorResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/query/v1beta1/params.ts b/common/types/src/client/kyve/query/v1beta1/params.ts new file mode 100644 index 00000000..86e71a3a --- /dev/null +++ b/common/types/src/client/kyve/query/v1beta1/params.ts @@ -0,0 +1,212 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { QueryParamsResponse as QueryParamsResponse3 } from "../../../cosmos/gov/v1/query"; +import { Params } from "../../bundles/v1beta1/params"; +import { Params as Params1 } from "../../delegation/v1beta1/params"; +import { Params as Params2 } from "../../fees/v1beta1/fees"; +import { Params as Params4 } from "../../stakers/v1beta1/params"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** QueryParamsRequest ... */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse ... */ +export interface QueryParamsResponse { + /** bundles_params ... */ + bundles_params?: Params; + /** delegation_params ... */ + delegation_params?: Params1; + /** fees_params ... */ + fees_params?: Params2; + /** gov_params ... */ + gov_params?: QueryParamsResponse3; + /** stakers_params ... */ + stakers_params?: Params4; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + bundles_params: undefined, + delegation_params: undefined, + fees_params: undefined, + gov_params: undefined, + stakers_params: undefined, + }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bundles_params !== undefined) { + Params.encode(message.bundles_params, writer.uint32(10).fork()).ldelim(); + } + if (message.delegation_params !== undefined) { + Params1.encode(message.delegation_params, writer.uint32(18).fork()).ldelim(); + } + if (message.fees_params !== undefined) { + Params2.encode(message.fees_params, writer.uint32(26).fork()).ldelim(); + } + if (message.gov_params !== undefined) { + QueryParamsResponse3.encode(message.gov_params, writer.uint32(34).fork()).ldelim(); + } + if (message.stakers_params !== undefined) { + Params4.encode(message.stakers_params, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.bundles_params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.delegation_params = Params1.decode(reader, reader.uint32()); + break; + case 3: + message.fees_params = Params2.decode(reader, reader.uint32()); + break; + case 4: + message.gov_params = QueryParamsResponse3.decode(reader, reader.uint32()); + break; + case 5: + message.stakers_params = Params4.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + bundles_params: isSet(object.bundles_params) ? Params.fromJSON(object.bundles_params) : undefined, + delegation_params: isSet(object.delegation_params) ? Params1.fromJSON(object.delegation_params) : undefined, + fees_params: isSet(object.fees_params) ? Params2.fromJSON(object.fees_params) : undefined, + gov_params: isSet(object.gov_params) ? QueryParamsResponse3.fromJSON(object.gov_params) : undefined, + stakers_params: isSet(object.stakers_params) ? Params4.fromJSON(object.stakers_params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.bundles_params !== undefined && + (obj.bundles_params = message.bundles_params ? Params.toJSON(message.bundles_params) : undefined); + message.delegation_params !== undefined && + (obj.delegation_params = message.delegation_params ? Params1.toJSON(message.delegation_params) : undefined); + message.fees_params !== undefined && + (obj.fees_params = message.fees_params ? Params2.toJSON(message.fees_params) : undefined); + message.gov_params !== undefined && + (obj.gov_params = message.gov_params ? QueryParamsResponse3.toJSON(message.gov_params) : undefined); + message.stakers_params !== undefined && + (obj.stakers_params = message.stakers_params ? Params4.toJSON(message.stakers_params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.bundles_params = (object.bundles_params !== undefined && object.bundles_params !== null) + ? Params.fromPartial(object.bundles_params) + : undefined; + message.delegation_params = (object.delegation_params !== undefined && object.delegation_params !== null) + ? Params1.fromPartial(object.delegation_params) + : undefined; + message.fees_params = (object.fees_params !== undefined && object.fees_params !== null) + ? Params2.fromPartial(object.fees_params) + : undefined; + message.gov_params = (object.gov_params !== undefined && object.gov_params !== null) + ? QueryParamsResponse3.fromPartial(object.gov_params) + : undefined; + message.stakers_params = (object.stakers_params !== undefined && object.stakers_params !== null) + ? Params4.fromPartial(object.stakers_params) + : undefined; + return message; + }, +}; + +/** QueryPool ... */ +export interface QueryParams { + /** Pools queries for all pools. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryParamsClientImpl implements QueryParams { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryParams"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/query/v1beta1/pools.ts b/common/types/src/client/kyve/query/v1beta1/pools.ts new file mode 100644 index 00000000..71dd72d0 --- /dev/null +++ b/common/types/src/client/kyve/query/v1beta1/pools.ts @@ -0,0 +1,485 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { BundleProposal } from "../../bundles/v1beta1/bundles"; +import { Pool, PoolStatus, poolStatusFromJSON, poolStatusToJSON } from "../../pool/v1beta1/pool"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** QueryPoolsRequest is the request type for the Query/Pools RPC method. */ +export interface QueryPoolsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** search ... */ + search: string; + /** runtime ... */ + runtime: string; + /** paused ... */ + paused: boolean; + /** storage_provider_id ... */ + storage_provider_id: number; +} + +/** QueryPoolsResponse is the response type for the Query/Pools RPC method. */ +export interface QueryPoolsResponse { + /** pools ... */ + pools: PoolResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** PoolResponse ... */ +export interface PoolResponse { + /** id ... */ + id: string; + /** data ... */ + data?: Pool; + /** bundle_proposal ... */ + bundle_proposal?: BundleProposal; + /** stakers ... */ + stakers: string[]; + /** total_stake ... */ + total_self_delegation: string; + /** total_delegation ... */ + total_delegation: string; + /** status ... */ + status: PoolStatus; +} + +/** QueryPoolRequest is the request type for the Query/Pool RPC method. */ +export interface QueryPoolRequest { + /** id defines the unique ID of the pool. */ + id: string; +} + +/** QueryPoolResponse is the response type for the Query/Pool RPC method. */ +export interface QueryPoolResponse { + /** pool ... */ + pool?: PoolResponse; +} + +function createBaseQueryPoolsRequest(): QueryPoolsRequest { + return { pagination: undefined, search: "", runtime: "", paused: false, storage_provider_id: 0 }; +} + +export const QueryPoolsRequest = { + encode(message: QueryPoolsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.search !== "") { + writer.uint32(18).string(message.search); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.paused === true) { + writer.uint32(32).bool(message.paused); + } + if (message.storage_provider_id !== 0) { + writer.uint32(40).uint32(message.storage_provider_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.search = reader.string(); + break; + case 3: + message.runtime = reader.string(); + break; + case 4: + message.paused = reader.bool(); + break; + case 5: + message.storage_provider_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryPoolsRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + search: isSet(object.search) ? String(object.search) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + paused: isSet(object.paused) ? Boolean(object.paused) : false, + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + }; + }, + + toJSON(message: QueryPoolsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.search !== undefined && (obj.search = message.search); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.paused !== undefined && (obj.paused = message.paused); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + return obj; + }, + + fromPartial, I>>(object: I): QueryPoolsRequest { + const message = createBaseQueryPoolsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.search = object.search ?? ""; + message.runtime = object.runtime ?? ""; + message.paused = object.paused ?? false; + message.storage_provider_id = object.storage_provider_id ?? 0; + return message; + }, +}; + +function createBaseQueryPoolsResponse(): QueryPoolsResponse { + return { pools: [], pagination: undefined }; +} + +export const QueryPoolsResponse = { + encode(message: QueryPoolsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pools) { + PoolResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pools.push(PoolResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryPoolsResponse { + return { + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => PoolResponse.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPoolsResponse): unknown { + const obj: any = {}; + if (message.pools) { + obj.pools = message.pools.map((e) => e ? PoolResponse.toJSON(e) : undefined); + } else { + obj.pools = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryPoolsResponse { + const message = createBaseQueryPoolsResponse(); + message.pools = object.pools?.map((e) => PoolResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBasePoolResponse(): PoolResponse { + return { + id: "0", + data: undefined, + bundle_proposal: undefined, + stakers: [], + total_self_delegation: "0", + total_delegation: "0", + status: 0, + }; +} + +export const PoolResponse = { + encode(message: PoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.data !== undefined) { + Pool.encode(message.data, writer.uint32(18).fork()).ldelim(); + } + if (message.bundle_proposal !== undefined) { + BundleProposal.encode(message.bundle_proposal, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.stakers) { + writer.uint32(34).string(v!); + } + if (message.total_self_delegation !== "0") { + writer.uint32(40).uint64(message.total_self_delegation); + } + if (message.total_delegation !== "0") { + writer.uint32(48).uint64(message.total_delegation); + } + if (message.status !== 0) { + writer.uint32(56).int32(message.status); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.data = Pool.decode(reader, reader.uint32()); + break; + case 3: + message.bundle_proposal = BundleProposal.decode(reader, reader.uint32()); + break; + case 4: + message.stakers.push(reader.string()); + break; + case 5: + message.total_self_delegation = longToString(reader.uint64() as Long); + break; + case 6: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 7: + message.status = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PoolResponse { + return { + id: isSet(object.id) ? String(object.id) : "0", + data: isSet(object.data) ? Pool.fromJSON(object.data) : undefined, + bundle_proposal: isSet(object.bundle_proposal) ? BundleProposal.fromJSON(object.bundle_proposal) : undefined, + stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => String(e)) : [], + total_self_delegation: isSet(object.total_self_delegation) ? String(object.total_self_delegation) : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + status: isSet(object.status) ? poolStatusFromJSON(object.status) : 0, + }; + }, + + toJSON(message: PoolResponse): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.data !== undefined && (obj.data = message.data ? Pool.toJSON(message.data) : undefined); + message.bundle_proposal !== undefined && + (obj.bundle_proposal = message.bundle_proposal ? BundleProposal.toJSON(message.bundle_proposal) : undefined); + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e); + } else { + obj.stakers = []; + } + message.total_self_delegation !== undefined && (obj.total_self_delegation = message.total_self_delegation); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.status !== undefined && (obj.status = poolStatusToJSON(message.status)); + return obj; + }, + + fromPartial, I>>(object: I): PoolResponse { + const message = createBasePoolResponse(); + message.id = object.id ?? "0"; + message.data = (object.data !== undefined && object.data !== null) ? Pool.fromPartial(object.data) : undefined; + message.bundle_proposal = (object.bundle_proposal !== undefined && object.bundle_proposal !== null) + ? BundleProposal.fromPartial(object.bundle_proposal) + : undefined; + message.stakers = object.stakers?.map((e) => e) || []; + message.total_self_delegation = object.total_self_delegation ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseQueryPoolRequest(): QueryPoolRequest { + return { id: "0" }; +} + +export const QueryPoolRequest = { + encode(message: QueryPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryPoolRequest { + return { id: isSet(object.id) ? String(object.id) : "0" }; + }, + + toJSON(message: QueryPoolRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { pool: undefined }; +} + +export const QueryPoolResponse = { + encode(message: QueryPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool !== undefined) { + PoolResponse.encode(message.pool, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = PoolResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryPoolResponse { + return { pool: isSet(object.pool) ? PoolResponse.fromJSON(object.pool) : undefined }; + }, + + toJSON(message: QueryPoolResponse): unknown { + const obj: any = {}; + message.pool !== undefined && (obj.pool = message.pool ? PoolResponse.toJSON(message.pool) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryPoolResponse { + const message = createBaseQueryPoolResponse(); + message.pool = (object.pool !== undefined && object.pool !== null) + ? PoolResponse.fromPartial(object.pool) + : undefined; + return message; + }, +}; + +/** QueryPool ... */ +export interface QueryPool { + /** Pools queries for all pools. */ + Pools(request: QueryPoolsRequest): Promise; + /** Pool queries a pool by its Id. */ + Pool(request: QueryPoolRequest): Promise; +} + +export class QueryPoolClientImpl implements QueryPool { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryPool"; + this.rpc = rpc; + this.Pools = this.Pools.bind(this); + this.Pool = this.Pool.bind(this); + } + Pools(request: QueryPoolsRequest): Promise { + const data = QueryPoolsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pools", data); + return promise.then((data) => QueryPoolsResponse.decode(new _m0.Reader(data))); + } + + Pool(request: QueryPoolRequest): Promise { + const data = QueryPoolRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pool", data); + return promise.then((data) => QueryPoolResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/query/v1beta1/query.ts b/common/types/src/client/kyve/query/v1beta1/query.ts new file mode 100644 index 00000000..db7c03c2 --- /dev/null +++ b/common/types/src/client/kyve/query/v1beta1/query.ts @@ -0,0 +1,668 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PoolStatus, poolStatusFromJSON, poolStatusToJSON } from "../../pool/v1beta1/pool"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** + * BasicPool contains the necessary properties need for a pool + * to be displayed in the UI + */ +export interface BasicPool { + /** id is the ID of the pool */ + id: string; + /** name of the pool */ + name: string; + /** + * runtime for the protocol nodes + * like evm, bitcoin, etc. + */ + runtime: string; + /** logo of the pool */ + logo: string; + /** operating_cost is the base payout for each bundle reward */ + operating_cost: string; + /** upload_interval is the interval bundles get created */ + upload_interval: string; + /** + * total_funds of the pool. If the pool runs + * out of funds no more bundles will be produced + */ + total_funds: string; + /** total_delegation of the pool */ + total_delegation: string; + /** + * status of the pool if pool is able + * to produce bundles, etc. + */ + status: PoolStatus; +} + +/** + * FullStaker aggregates information from the staker and its delegators + * as well as pending queue entries into one object. + * It contains almost all needed information for a convenient usage + */ +export interface FullStaker { + /** address of the staker */ + address: string; + /** metadata as logo, moniker, etc. */ + metadata?: StakerMetadata; + /** amount the staker has delegated to himself */ + self_delegation: string; + /** + * unbonding_amount is the amount the staker is currently unbonding + * from the self-delegation. + * This amount can be larger than `amount` when the staker + * got slashed during unbonding. However, at the end of + * the unbonding period this amount is double checked with the + * remaining amount. + */ + self_delegation_unbonding: string; + /** + * total_delegation returns the sum of all $KYVE users + * have delegated to this staker + */ + total_delegation: string; + /** + * delegator_count is the total number of individual + * delegator addresses for that user. + */ + delegator_count: string; + /** + * pools is a list of all pools the staker is currently + * participating, i.e. allowed to vote and upload data. + */ + pools: PoolMembership[]; +} + +/** StakerMetadata contains static information for a staker */ +export interface StakerMetadata { + /** + * commission is the percentage of the rewards that will + * get transferred to the staker before the remaining + * rewards are split across all delegators + */ + commission: string; + /** + * moniker is a human-readable name for displaying + * the staker in the UI + */ + moniker: string; + /** website is a https-link to the website of the staker */ + website: string; + /** logo is a link to an image file (like jpg or png) */ + logo: string; + /** + * pending_commission_change shows if the staker plans + * to change its commission. Delegators will see a warning in + * the UI. A Commission change takes some time until + * the commission is applied. Users have time to redelegate + * if they not agree with the new commission. + */ + pending_commission_change?: CommissionChangeEntry; +} + +/** + * CommissionChangeEntry shows when the old commission + * of a staker will change to the new commission + */ +export interface CommissionChangeEntry { + /** + * commission is the new commission that will + * become active once the change-time is over + */ + commission: string; + /** + * creation_date is the UNIX-timestamp (in seconds) + * of when the entry was created. + */ + creation_date: string; +} + +/** + * PoolMembership shows in which pool the staker + * is participating + */ +export interface PoolMembership { + /** pool contains useful information about the pool */ + pool?: BasicPool; + /** + * points indicates if the staker is inactive + * If the staker misses a vote, a point is added. + * After 5 points the staker is removed from + * the stakers set. + */ + points: string; + /** + * is_leaving indicates if a user has scheduled a + * a PoolLeave entry. After the leave-time is over + * the staker will no longer participate in that pool + */ + is_leaving: boolean; + /** + * Valaddress is the address which is authorized to vote + * and submit bundles. If the server gets compromised + * the staker can just change the valaddress. + */ + valaddress: string; + /** + * balance is the valaddress account balance and indicates + * whether or not the valaccount needs additional funds to + * pay for gas fees + */ + balance: string; +} + +function createBaseBasicPool(): BasicPool { + return { + id: "0", + name: "", + runtime: "", + logo: "", + operating_cost: "0", + upload_interval: "0", + total_funds: "0", + total_delegation: "0", + status: 0, + }; +} + +export const BasicPool = { + encode(message: BasicPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + if (message.operating_cost !== "0") { + writer.uint32(40).uint64(message.operating_cost); + } + if (message.upload_interval !== "0") { + writer.uint32(48).uint64(message.upload_interval); + } + if (message.total_funds !== "0") { + writer.uint32(56).uint64(message.total_funds); + } + if (message.total_delegation !== "0") { + writer.uint32(64).uint64(message.total_delegation); + } + if (message.status !== 0) { + writer.uint32(72).int32(message.status); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BasicPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBasicPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.runtime = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + case 5: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 6: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 7: + message.total_funds = longToString(reader.uint64() as Long); + break; + case 8: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 9: + message.status = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BasicPool { + return { + id: isSet(object.id) ? String(object.id) : "0", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + total_funds: isSet(object.total_funds) ? String(object.total_funds) : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + status: isSet(object.status) ? poolStatusFromJSON(object.status) : 0, + }; + }, + + toJSON(message: BasicPool): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.total_funds !== undefined && (obj.total_funds = message.total_funds); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.status !== undefined && (obj.status = poolStatusToJSON(message.status)); + return obj; + }, + + fromPartial, I>>(object: I): BasicPool { + const message = createBaseBasicPool(); + message.id = object.id ?? "0"; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.operating_cost = object.operating_cost ?? "0"; + message.upload_interval = object.upload_interval ?? "0"; + message.total_funds = object.total_funds ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseFullStaker(): FullStaker { + return { + address: "", + metadata: undefined, + self_delegation: "0", + self_delegation_unbonding: "0", + total_delegation: "0", + delegator_count: "0", + pools: [], + }; +} + +export const FullStaker = { + encode(message: FullStaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.metadata !== undefined) { + StakerMetadata.encode(message.metadata, writer.uint32(18).fork()).ldelim(); + } + if (message.self_delegation !== "0") { + writer.uint32(24).uint64(message.self_delegation); + } + if (message.self_delegation_unbonding !== "0") { + writer.uint32(32).uint64(message.self_delegation_unbonding); + } + if (message.total_delegation !== "0") { + writer.uint32(40).uint64(message.total_delegation); + } + if (message.delegator_count !== "0") { + writer.uint32(48).uint64(message.delegator_count); + } + for (const v of message.pools) { + PoolMembership.encode(v!, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FullStaker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFullStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.metadata = StakerMetadata.decode(reader, reader.uint32()); + break; + case 3: + message.self_delegation = longToString(reader.uint64() as Long); + break; + case 4: + message.self_delegation_unbonding = longToString(reader.uint64() as Long); + break; + case 5: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 6: + message.delegator_count = longToString(reader.uint64() as Long); + break; + case 7: + message.pools.push(PoolMembership.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FullStaker { + return { + address: isSet(object.address) ? String(object.address) : "", + metadata: isSet(object.metadata) ? StakerMetadata.fromJSON(object.metadata) : undefined, + self_delegation: isSet(object.self_delegation) ? String(object.self_delegation) : "0", + self_delegation_unbonding: isSet(object.self_delegation_unbonding) + ? String(object.self_delegation_unbonding) + : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + delegator_count: isSet(object.delegator_count) ? String(object.delegator_count) : "0", + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => PoolMembership.fromJSON(e)) : [], + }; + }, + + toJSON(message: FullStaker): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.metadata !== undefined && + (obj.metadata = message.metadata ? StakerMetadata.toJSON(message.metadata) : undefined); + message.self_delegation !== undefined && (obj.self_delegation = message.self_delegation); + message.self_delegation_unbonding !== undefined && + (obj.self_delegation_unbonding = message.self_delegation_unbonding); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.delegator_count !== undefined && (obj.delegator_count = message.delegator_count); + if (message.pools) { + obj.pools = message.pools.map((e) => e ? PoolMembership.toJSON(e) : undefined); + } else { + obj.pools = []; + } + return obj; + }, + + fromPartial, I>>(object: I): FullStaker { + const message = createBaseFullStaker(); + message.address = object.address ?? ""; + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? StakerMetadata.fromPartial(object.metadata) + : undefined; + message.self_delegation = object.self_delegation ?? "0"; + message.self_delegation_unbonding = object.self_delegation_unbonding ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.delegator_count = object.delegator_count ?? "0"; + message.pools = object.pools?.map((e) => PoolMembership.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStakerMetadata(): StakerMetadata { + return { commission: "", moniker: "", website: "", logo: "", pending_commission_change: undefined }; +} + +export const StakerMetadata = { + encode(message: StakerMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.commission !== "") { + writer.uint32(10).string(message.commission); + } + if (message.moniker !== "") { + writer.uint32(18).string(message.moniker); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + if (message.pending_commission_change !== undefined) { + CommissionChangeEntry.encode(message.pending_commission_change, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakerMetadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakerMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission = reader.string(); + break; + case 2: + message.moniker = reader.string(); + break; + case 3: + message.website = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + case 5: + message.pending_commission_change = CommissionChangeEntry.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StakerMetadata { + return { + commission: isSet(object.commission) ? String(object.commission) : "", + moniker: isSet(object.moniker) ? String(object.moniker) : "", + website: isSet(object.website) ? String(object.website) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + pending_commission_change: isSet(object.pending_commission_change) + ? CommissionChangeEntry.fromJSON(object.pending_commission_change) + : undefined, + }; + }, + + toJSON(message: StakerMetadata): unknown { + const obj: any = {}; + message.commission !== undefined && (obj.commission = message.commission); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.website !== undefined && (obj.website = message.website); + message.logo !== undefined && (obj.logo = message.logo); + message.pending_commission_change !== undefined && + (obj.pending_commission_change = message.pending_commission_change + ? CommissionChangeEntry.toJSON(message.pending_commission_change) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): StakerMetadata { + const message = createBaseStakerMetadata(); + message.commission = object.commission ?? ""; + message.moniker = object.moniker ?? ""; + message.website = object.website ?? ""; + message.logo = object.logo ?? ""; + message.pending_commission_change = + (object.pending_commission_change !== undefined && object.pending_commission_change !== null) + ? CommissionChangeEntry.fromPartial(object.pending_commission_change) + : undefined; + return message; + }, +}; + +function createBaseCommissionChangeEntry(): CommissionChangeEntry { + return { commission: "", creation_date: "0" }; +} + +export const CommissionChangeEntry = { + encode(message: CommissionChangeEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.commission !== "") { + writer.uint32(10).string(message.commission); + } + if (message.creation_date !== "0") { + writer.uint32(16).int64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionChangeEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission = reader.string(); + break; + case 2: + message.creation_date = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommissionChangeEntry { + return { + commission: isSet(object.commission) ? String(object.commission) : "", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: CommissionChangeEntry): unknown { + const obj: any = {}; + message.commission !== undefined && (obj.commission = message.commission); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): CommissionChangeEntry { + const message = createBaseCommissionChangeEntry(); + message.commission = object.commission ?? ""; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +function createBasePoolMembership(): PoolMembership { + return { pool: undefined, points: "0", is_leaving: false, valaddress: "", balance: "0" }; +} + +export const PoolMembership = { + encode(message: PoolMembership, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool !== undefined) { + BasicPool.encode(message.pool, writer.uint32(10).fork()).ldelim(); + } + if (message.points !== "0") { + writer.uint32(16).uint64(message.points); + } + if (message.is_leaving === true) { + writer.uint32(24).bool(message.is_leaving); + } + if (message.valaddress !== "") { + writer.uint32(34).string(message.valaddress); + } + if (message.balance !== "0") { + writer.uint32(40).uint64(message.balance); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PoolMembership { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePoolMembership(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool = BasicPool.decode(reader, reader.uint32()); + break; + case 2: + message.points = longToString(reader.uint64() as Long); + break; + case 3: + message.is_leaving = reader.bool(); + break; + case 4: + message.valaddress = reader.string(); + break; + case 5: + message.balance = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PoolMembership { + return { + pool: isSet(object.pool) ? BasicPool.fromJSON(object.pool) : undefined, + points: isSet(object.points) ? String(object.points) : "0", + is_leaving: isSet(object.is_leaving) ? Boolean(object.is_leaving) : false, + valaddress: isSet(object.valaddress) ? String(object.valaddress) : "", + balance: isSet(object.balance) ? String(object.balance) : "0", + }; + }, + + toJSON(message: PoolMembership): unknown { + const obj: any = {}; + message.pool !== undefined && (obj.pool = message.pool ? BasicPool.toJSON(message.pool) : undefined); + message.points !== undefined && (obj.points = message.points); + message.is_leaving !== undefined && (obj.is_leaving = message.is_leaving); + message.valaddress !== undefined && (obj.valaddress = message.valaddress); + message.balance !== undefined && (obj.balance = message.balance); + return obj; + }, + + fromPartial, I>>(object: I): PoolMembership { + const message = createBasePoolMembership(); + message.pool = (object.pool !== undefined && object.pool !== null) ? BasicPool.fromPartial(object.pool) : undefined; + message.points = object.points ?? "0"; + message.is_leaving = object.is_leaving ?? false; + message.valaddress = object.valaddress ?? ""; + message.balance = object.balance ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/query/v1beta1/stakers.ts b/common/types/src/client/kyve/query/v1beta1/stakers.ts new file mode 100644 index 00000000..3266f228 --- /dev/null +++ b/common/types/src/client/kyve/query/v1beta1/stakers.ts @@ -0,0 +1,707 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Valaccount } from "../../stakers/v1beta1/stakers"; +import { FullStaker } from "./query"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** StakerStatus ... */ +export enum StakerStatus { + /** STAKER_STATUS_UNSPECIFIED - STAKER_STATUS_UNSPECIFIED ... */ + STAKER_STATUS_UNSPECIFIED = 0, + /** STAKER_STATUS_ACTIVE - STAKER_STATUS_ACTIVE ... */ + STAKER_STATUS_ACTIVE = 1, + /** STAKER_STATUS_INACTIVE - STAKER_STATUS_INACTIVE ... */ + STAKER_STATUS_INACTIVE = 2, + UNRECOGNIZED = -1, +} + +export function stakerStatusFromJSON(object: any): StakerStatus { + switch (object) { + case 0: + case "STAKER_STATUS_UNSPECIFIED": + return StakerStatus.STAKER_STATUS_UNSPECIFIED; + case 1: + case "STAKER_STATUS_ACTIVE": + return StakerStatus.STAKER_STATUS_ACTIVE; + case 2: + case "STAKER_STATUS_INACTIVE": + return StakerStatus.STAKER_STATUS_INACTIVE; + case -1: + case "UNRECOGNIZED": + default: + return StakerStatus.UNRECOGNIZED; + } +} + +export function stakerStatusToJSON(object: StakerStatus): string { + switch (object) { + case StakerStatus.STAKER_STATUS_UNSPECIFIED: + return "STAKER_STATUS_UNSPECIFIED"; + case StakerStatus.STAKER_STATUS_ACTIVE: + return "STAKER_STATUS_ACTIVE"; + case StakerStatus.STAKER_STATUS_INACTIVE: + return "STAKER_STATUS_INACTIVE"; + case StakerStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** QueryStakersRequest is the request type for the Query/Stakers RPC method. */ +export interface QueryStakersRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** status looks whether a staker is participating in pools or not */ + status: StakerStatus; + /** search searches for moniker OR address */ + search: string; +} + +/** QueryStakersResponse is the response type for the Query/Stakers RPC method. */ +export interface QueryStakersResponse { + /** stakers ... */ + stakers: FullStaker[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryStakerRequest is the request type for the Query/Staker RPC method. */ +export interface QueryStakerRequest { + /** address ... */ + address: string; +} + +/** QueryStakerResponse is the response type for the Query/Staker RPC method. */ +export interface QueryStakerResponse { + /** staker ... */ + staker?: FullStaker; +} + +/** QueryStakersByPoolRequest is the request type for the Query/Staker RPC method. */ +export interface QueryStakersByPoolRequest { + /** pool_id ... */ + pool_id: string; +} + +/** QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. */ +export interface QueryStakersByPoolResponse { + /** stakers ... */ + stakers: StakerPoolResponse[]; +} + +/** StakerPoolResponse ... */ +export interface StakerPoolResponse { + /** staker ... */ + staker?: FullStaker; + /** valaccount ... */ + valaccount?: Valaccount; +} + +/** QueryStakersByPoolCountRequest ... */ +export interface QueryStakersByPoolCountRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryStakersByPoolCountResponse ... */ +export interface QueryStakersByPoolCountResponse { + /** stakers ... */ + stakers: FullStaker[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +function createBaseQueryStakersRequest(): QueryStakersRequest { + return { pagination: undefined, status: 0, search: "" }; +} + +export const QueryStakersRequest = { + encode(message: QueryStakersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.search !== "") { + writer.uint32(26).string(message.search); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.status = reader.int32() as any; + break; + case 3: + message.search = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + status: isSet(object.status) ? stakerStatusFromJSON(object.status) : 0, + search: isSet(object.search) ? String(object.search) : "", + }; + }, + + toJSON(message: QueryStakersRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.status !== undefined && (obj.status = stakerStatusToJSON(message.status)); + message.search !== undefined && (obj.search = message.search); + return obj; + }, + + fromPartial, I>>(object: I): QueryStakersRequest { + const message = createBaseQueryStakersRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.status = object.status ?? 0; + message.search = object.search ?? ""; + return message; + }, +}; + +function createBaseQueryStakersResponse(): QueryStakersResponse { + return { stakers: [], pagination: undefined }; +} + +export const QueryStakersResponse = { + encode(message: QueryStakersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.stakers) { + FullStaker.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.stakers.push(FullStaker.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersResponse { + return { + stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => FullStaker.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryStakersResponse): unknown { + const obj: any = {}; + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e ? FullStaker.toJSON(e) : undefined); + } else { + obj.stakers = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryStakersResponse { + const message = createBaseQueryStakersResponse(); + message.stakers = object.stakers?.map((e) => FullStaker.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryStakerRequest(): QueryStakerRequest { + return { address: "" }; +} + +export const QueryStakerRequest = { + encode(message: QueryStakerRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakerRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakerRequest(); + 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; + }, + + fromJSON(object: any): QueryStakerRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryStakerRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): QueryStakerRequest { + const message = createBaseQueryStakerRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryStakerResponse(): QueryStakerResponse { + return { staker: undefined }; +} + +export const QueryStakerResponse = { + encode(message: QueryStakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== undefined) { + FullStaker.encode(message.staker, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = FullStaker.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakerResponse { + return { staker: isSet(object.staker) ? FullStaker.fromJSON(object.staker) : undefined }; + }, + + toJSON(message: QueryStakerResponse): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker ? FullStaker.toJSON(message.staker) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryStakerResponse { + const message = createBaseQueryStakerResponse(); + message.staker = (object.staker !== undefined && object.staker !== null) + ? FullStaker.fromPartial(object.staker) + : undefined; + return message; + }, +}; + +function createBaseQueryStakersByPoolRequest(): QueryStakersByPoolRequest { + return { pool_id: "0" }; +} + +export const QueryStakersByPoolRequest = { + encode(message: QueryStakersByPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersByPoolRequest { + return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + }, + + toJSON(message: QueryStakersByPoolRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryStakersByPoolRequest { + const message = createBaseQueryStakersByPoolRequest(); + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +function createBaseQueryStakersByPoolResponse(): QueryStakersByPoolResponse { + return { stakers: [] }; +} + +export const QueryStakersByPoolResponse = { + encode(message: QueryStakersByPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.stakers) { + StakerPoolResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.stakers.push(StakerPoolResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersByPoolResponse { + return { + stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => StakerPoolResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryStakersByPoolResponse): unknown { + const obj: any = {}; + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e ? StakerPoolResponse.toJSON(e) : undefined); + } else { + obj.stakers = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryStakersByPoolResponse { + const message = createBaseQueryStakersByPoolResponse(); + message.stakers = object.stakers?.map((e) => StakerPoolResponse.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStakerPoolResponse(): StakerPoolResponse { + return { staker: undefined, valaccount: undefined }; +} + +export const StakerPoolResponse = { + encode(message: StakerPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== undefined) { + FullStaker.encode(message.staker, writer.uint32(10).fork()).ldelim(); + } + if (message.valaccount !== undefined) { + Valaccount.encode(message.valaccount, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakerPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakerPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = FullStaker.decode(reader, reader.uint32()); + break; + case 2: + message.valaccount = Valaccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StakerPoolResponse { + return { + staker: isSet(object.staker) ? FullStaker.fromJSON(object.staker) : undefined, + valaccount: isSet(object.valaccount) ? Valaccount.fromJSON(object.valaccount) : undefined, + }; + }, + + toJSON(message: StakerPoolResponse): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker ? FullStaker.toJSON(message.staker) : undefined); + message.valaccount !== undefined && + (obj.valaccount = message.valaccount ? Valaccount.toJSON(message.valaccount) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): StakerPoolResponse { + const message = createBaseStakerPoolResponse(); + message.staker = (object.staker !== undefined && object.staker !== null) + ? FullStaker.fromPartial(object.staker) + : undefined; + message.valaccount = (object.valaccount !== undefined && object.valaccount !== null) + ? Valaccount.fromPartial(object.valaccount) + : undefined; + return message; + }, +}; + +function createBaseQueryStakersByPoolCountRequest(): QueryStakersByPoolCountRequest { + return { pagination: undefined }; +} + +export const QueryStakersByPoolCountRequest = { + encode(message: QueryStakersByPoolCountRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolCountRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByPoolCountRequest(); + 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; + }, + + fromJSON(object: any): QueryStakersByPoolCountRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryStakersByPoolCountRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryStakersByPoolCountRequest { + const message = createBaseQueryStakersByPoolCountRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryStakersByPoolCountResponse(): QueryStakersByPoolCountResponse { + return { stakers: [], pagination: undefined }; +} + +export const QueryStakersByPoolCountResponse = { + encode(message: QueryStakersByPoolCountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.stakers) { + FullStaker.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolCountResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByPoolCountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.stakers.push(FullStaker.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersByPoolCountResponse { + return { + stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => FullStaker.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryStakersByPoolCountResponse): unknown { + const obj: any = {}; + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e ? FullStaker.toJSON(e) : undefined); + } else { + obj.stakers = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryStakersByPoolCountResponse { + const message = createBaseQueryStakersByPoolCountResponse(); + message.stakers = object.stakers?.map((e) => FullStaker.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** QueryStakers ... */ +export interface QueryStakers { + /** Stakers queries for all stakers. */ + Stakers(request: QueryStakersRequest): Promise; + /** Staker queries for all stakers. */ + Staker(request: QueryStakerRequest): Promise; + /** StakersByPool queries for all stakers that are currently participating in the given pool */ + StakersByPool(request: QueryStakersByPoolRequest): Promise; + /** + * StakersByPool queries for all stakers and sorted them first by number of pools participating and + * then by delegation + */ + StakersByPoolCount(request: QueryStakersByPoolCountRequest): Promise; +} + +export class QueryStakersClientImpl implements QueryStakers { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryStakers"; + this.rpc = rpc; + this.Stakers = this.Stakers.bind(this); + this.Staker = this.Staker.bind(this); + this.StakersByPool = this.StakersByPool.bind(this); + this.StakersByPoolCount = this.StakersByPoolCount.bind(this); + } + Stakers(request: QueryStakersRequest): Promise { + const data = QueryStakersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Stakers", data); + return promise.then((data) => QueryStakersResponse.decode(new _m0.Reader(data))); + } + + Staker(request: QueryStakerRequest): Promise { + const data = QueryStakerRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Staker", data); + return promise.then((data) => QueryStakerResponse.decode(new _m0.Reader(data))); + } + + StakersByPool(request: QueryStakersByPoolRequest): Promise { + const data = QueryStakersByPoolRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "StakersByPool", data); + return promise.then((data) => QueryStakersByPoolResponse.decode(new _m0.Reader(data))); + } + + StakersByPoolCount(request: QueryStakersByPoolCountRequest): Promise { + const data = QueryStakersByPoolCountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "StakersByPoolCount", data); + return promise.then((data) => QueryStakersByPoolCountResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/registry/v1beta1/genesis.ts b/common/types/src/client/kyve/registry/v1beta1/genesis.ts new file mode 100644 index 00000000..aacc67a3 --- /dev/null +++ b/common/types/src/client/kyve/registry/v1beta1/genesis.ts @@ -0,0 +1,394 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { + CommissionChangeQueueEntry, + CommissionChangeQueueState, + DelegationEntries, + DelegationPoolData, + Delegator, + Funder, + Pool, + Proposal, + RedelegationCooldown, + Staker, + UnbondingDelegationQueueEntry, + UnbondingDelegationQueueState, + UnbondingStaker, + UnbondingStakingQueueEntry, + UnbondingStakingQueueState, +} from "./registry"; + +export const protobufPackage = "kyve.registry.v1beta1"; + +/** GenesisState defines the registry module's genesis state. */ +export interface GenesisState { + /** pool_list ... */ + pool_list: Pool[]; + /** pool_count ... */ + pool_count: string; + /** funder_list ... */ + funder_list: Funder[]; + /** staker_list ... */ + staker_list: Staker[]; + /** commission_change_queue_state ... */ + commission_change_queue_state?: CommissionChangeQueueState; + /** commission_change_queue_entry ... */ + commission_change_queue_entry: CommissionChangeQueueEntry[]; + /** unbonding_staker_list ... */ + unbonding_staker_list: UnbondingStaker[]; + /** unbonding_staking_queue_state ... */ + unbonding_staking_queue_state?: UnbondingStakingQueueState; + /** unbonding_staking_queue_entries ... */ + unbonding_staking_queue_entries: UnbondingStakingQueueEntry[]; + /** delegator_list ... */ + delegator_list: Delegator[]; + /** delegation_pool_data_list ... */ + delegation_pool_data_list: DelegationPoolData[]; + /** delegation_entries_list ... */ + delegation_entries_list: DelegationEntries[]; + /** proposal_list ... */ + proposal_list: Proposal[]; + /** unbonding_delegation_queue_state ... */ + unbonding_delegation_queue_state?: UnbondingDelegationQueueState; + /** unbonding_delegation_queue_entries ... */ + unbonding_delegation_queue_entries: UnbondingDelegationQueueEntry[]; + /** redelegation_cooldown_list ... */ + redelegation_cooldown_list: RedelegationCooldown[]; +} + +function createBaseGenesisState(): GenesisState { + return { + pool_list: [], + pool_count: "0", + funder_list: [], + staker_list: [], + commission_change_queue_state: undefined, + commission_change_queue_entry: [], + unbonding_staker_list: [], + unbonding_staking_queue_state: undefined, + unbonding_staking_queue_entries: [], + delegator_list: [], + delegation_pool_data_list: [], + delegation_entries_list: [], + proposal_list: [], + unbonding_delegation_queue_state: undefined, + unbonding_delegation_queue_entries: [], + redelegation_cooldown_list: [], + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pool_list) { + Pool.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pool_count !== "0") { + writer.uint32(24).uint64(message.pool_count); + } + for (const v of message.funder_list) { + Funder.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.staker_list) { + Staker.encode(v!, writer.uint32(42).fork()).ldelim(); + } + if (message.commission_change_queue_state !== undefined) { + CommissionChangeQueueState.encode(message.commission_change_queue_state, writer.uint32(130).fork()).ldelim(); + } + for (const v of message.commission_change_queue_entry) { + CommissionChangeQueueEntry.encode(v!, writer.uint32(138).fork()).ldelim(); + } + for (const v of message.unbonding_staker_list) { + UnbondingStaker.encode(v!, writer.uint32(98).fork()).ldelim(); + } + if (message.unbonding_staking_queue_state !== undefined) { + UnbondingStakingQueueState.encode(message.unbonding_staking_queue_state, writer.uint32(82).fork()).ldelim(); + } + for (const v of message.unbonding_staking_queue_entries) { + UnbondingStakingQueueEntry.encode(v!, writer.uint32(90).fork()).ldelim(); + } + for (const v of message.delegator_list) { + Delegator.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.delegation_pool_data_list) { + DelegationPoolData.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.delegation_entries_list) { + DelegationEntries.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.proposal_list) { + Proposal.encode(v!, writer.uint32(74).fork()).ldelim(); + } + if (message.unbonding_delegation_queue_state !== undefined) { + UnbondingDelegationQueueState.encode(message.unbonding_delegation_queue_state, writer.uint32(106).fork()) + .ldelim(); + } + for (const v of message.unbonding_delegation_queue_entries) { + UnbondingDelegationQueueEntry.encode(v!, writer.uint32(114).fork()).ldelim(); + } + for (const v of message.redelegation_cooldown_list) { + RedelegationCooldown.encode(v!, writer.uint32(122).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.pool_list.push(Pool.decode(reader, reader.uint32())); + break; + case 3: + message.pool_count = longToString(reader.uint64() as Long); + break; + case 4: + message.funder_list.push(Funder.decode(reader, reader.uint32())); + break; + case 5: + message.staker_list.push(Staker.decode(reader, reader.uint32())); + break; + case 16: + message.commission_change_queue_state = CommissionChangeQueueState.decode(reader, reader.uint32()); + break; + case 17: + message.commission_change_queue_entry.push(CommissionChangeQueueEntry.decode(reader, reader.uint32())); + break; + case 12: + message.unbonding_staker_list.push(UnbondingStaker.decode(reader, reader.uint32())); + break; + case 10: + message.unbonding_staking_queue_state = UnbondingStakingQueueState.decode(reader, reader.uint32()); + break; + case 11: + message.unbonding_staking_queue_entries.push(UnbondingStakingQueueEntry.decode(reader, reader.uint32())); + break; + case 6: + message.delegator_list.push(Delegator.decode(reader, reader.uint32())); + break; + case 7: + message.delegation_pool_data_list.push(DelegationPoolData.decode(reader, reader.uint32())); + break; + case 8: + message.delegation_entries_list.push(DelegationEntries.decode(reader, reader.uint32())); + break; + case 9: + message.proposal_list.push(Proposal.decode(reader, reader.uint32())); + break; + case 13: + message.unbonding_delegation_queue_state = UnbondingDelegationQueueState.decode(reader, reader.uint32()); + break; + case 14: + message.unbonding_delegation_queue_entries.push( + UnbondingDelegationQueueEntry.decode(reader, reader.uint32()), + ); + break; + case 15: + message.redelegation_cooldown_list.push(RedelegationCooldown.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + pool_list: Array.isArray(object?.pool_list) ? object.pool_list.map((e: any) => Pool.fromJSON(e)) : [], + pool_count: isSet(object.pool_count) ? String(object.pool_count) : "0", + funder_list: Array.isArray(object?.funder_list) ? object.funder_list.map((e: any) => Funder.fromJSON(e)) : [], + staker_list: Array.isArray(object?.staker_list) ? object.staker_list.map((e: any) => Staker.fromJSON(e)) : [], + commission_change_queue_state: isSet(object.commission_change_queue_state) + ? CommissionChangeQueueState.fromJSON(object.commission_change_queue_state) + : undefined, + commission_change_queue_entry: Array.isArray(object?.commission_change_queue_entry) + ? object.commission_change_queue_entry.map((e: any) => CommissionChangeQueueEntry.fromJSON(e)) + : [], + unbonding_staker_list: Array.isArray(object?.unbonding_staker_list) + ? object.unbonding_staker_list.map((e: any) => UnbondingStaker.fromJSON(e)) + : [], + unbonding_staking_queue_state: isSet(object.unbonding_staking_queue_state) + ? UnbondingStakingQueueState.fromJSON(object.unbonding_staking_queue_state) + : undefined, + unbonding_staking_queue_entries: Array.isArray(object?.unbonding_staking_queue_entries) + ? object.unbonding_staking_queue_entries.map((e: any) => UnbondingStakingQueueEntry.fromJSON(e)) + : [], + delegator_list: Array.isArray(object?.delegator_list) + ? object.delegator_list.map((e: any) => Delegator.fromJSON(e)) + : [], + delegation_pool_data_list: Array.isArray(object?.delegation_pool_data_list) + ? object.delegation_pool_data_list.map((e: any) => DelegationPoolData.fromJSON(e)) + : [], + delegation_entries_list: Array.isArray(object?.delegation_entries_list) + ? object.delegation_entries_list.map((e: any) => DelegationEntries.fromJSON(e)) + : [], + proposal_list: Array.isArray(object?.proposal_list) + ? object.proposal_list.map((e: any) => Proposal.fromJSON(e)) + : [], + unbonding_delegation_queue_state: isSet(object.unbonding_delegation_queue_state) + ? UnbondingDelegationQueueState.fromJSON(object.unbonding_delegation_queue_state) + : undefined, + unbonding_delegation_queue_entries: Array.isArray(object?.unbonding_delegation_queue_entries) + ? object.unbonding_delegation_queue_entries.map((e: any) => UnbondingDelegationQueueEntry.fromJSON(e)) + : [], + redelegation_cooldown_list: Array.isArray(object?.redelegation_cooldown_list) + ? object.redelegation_cooldown_list.map((e: any) => RedelegationCooldown.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.pool_list) { + obj.pool_list = message.pool_list.map((e) => e ? Pool.toJSON(e) : undefined); + } else { + obj.pool_list = []; + } + message.pool_count !== undefined && (obj.pool_count = message.pool_count); + if (message.funder_list) { + obj.funder_list = message.funder_list.map((e) => e ? Funder.toJSON(e) : undefined); + } else { + obj.funder_list = []; + } + if (message.staker_list) { + obj.staker_list = message.staker_list.map((e) => e ? Staker.toJSON(e) : undefined); + } else { + obj.staker_list = []; + } + message.commission_change_queue_state !== undefined && + (obj.commission_change_queue_state = message.commission_change_queue_state + ? CommissionChangeQueueState.toJSON(message.commission_change_queue_state) + : undefined); + if (message.commission_change_queue_entry) { + obj.commission_change_queue_entry = message.commission_change_queue_entry.map((e) => + e ? CommissionChangeQueueEntry.toJSON(e) : undefined + ); + } else { + obj.commission_change_queue_entry = []; + } + if (message.unbonding_staker_list) { + obj.unbonding_staker_list = message.unbonding_staker_list.map((e) => e ? UnbondingStaker.toJSON(e) : undefined); + } else { + obj.unbonding_staker_list = []; + } + message.unbonding_staking_queue_state !== undefined && + (obj.unbonding_staking_queue_state = message.unbonding_staking_queue_state + ? UnbondingStakingQueueState.toJSON(message.unbonding_staking_queue_state) + : undefined); + if (message.unbonding_staking_queue_entries) { + obj.unbonding_staking_queue_entries = message.unbonding_staking_queue_entries.map((e) => + e ? UnbondingStakingQueueEntry.toJSON(e) : undefined + ); + } else { + obj.unbonding_staking_queue_entries = []; + } + if (message.delegator_list) { + obj.delegator_list = message.delegator_list.map((e) => e ? Delegator.toJSON(e) : undefined); + } else { + obj.delegator_list = []; + } + if (message.delegation_pool_data_list) { + obj.delegation_pool_data_list = message.delegation_pool_data_list.map((e) => + e ? DelegationPoolData.toJSON(e) : undefined + ); + } else { + obj.delegation_pool_data_list = []; + } + if (message.delegation_entries_list) { + obj.delegation_entries_list = message.delegation_entries_list.map((e) => + e ? DelegationEntries.toJSON(e) : undefined + ); + } else { + obj.delegation_entries_list = []; + } + if (message.proposal_list) { + obj.proposal_list = message.proposal_list.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposal_list = []; + } + message.unbonding_delegation_queue_state !== undefined && + (obj.unbonding_delegation_queue_state = message.unbonding_delegation_queue_state + ? UnbondingDelegationQueueState.toJSON(message.unbonding_delegation_queue_state) + : undefined); + if (message.unbonding_delegation_queue_entries) { + obj.unbonding_delegation_queue_entries = message.unbonding_delegation_queue_entries.map((e) => + e ? UnbondingDelegationQueueEntry.toJSON(e) : undefined + ); + } else { + obj.unbonding_delegation_queue_entries = []; + } + if (message.redelegation_cooldown_list) { + obj.redelegation_cooldown_list = message.redelegation_cooldown_list.map((e) => + e ? RedelegationCooldown.toJSON(e) : undefined + ); + } else { + obj.redelegation_cooldown_list = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.pool_list = object.pool_list?.map((e) => Pool.fromPartial(e)) || []; + message.pool_count = object.pool_count ?? "0"; + message.funder_list = object.funder_list?.map((e) => Funder.fromPartial(e)) || []; + message.staker_list = object.staker_list?.map((e) => Staker.fromPartial(e)) || []; + message.commission_change_queue_state = + (object.commission_change_queue_state !== undefined && object.commission_change_queue_state !== null) + ? CommissionChangeQueueState.fromPartial(object.commission_change_queue_state) + : undefined; + message.commission_change_queue_entry = + object.commission_change_queue_entry?.map((e) => CommissionChangeQueueEntry.fromPartial(e)) || []; + message.unbonding_staker_list = object.unbonding_staker_list?.map((e) => UnbondingStaker.fromPartial(e)) || []; + message.unbonding_staking_queue_state = + (object.unbonding_staking_queue_state !== undefined && object.unbonding_staking_queue_state !== null) + ? UnbondingStakingQueueState.fromPartial(object.unbonding_staking_queue_state) + : undefined; + message.unbonding_staking_queue_entries = + object.unbonding_staking_queue_entries?.map((e) => UnbondingStakingQueueEntry.fromPartial(e)) || []; + message.delegator_list = object.delegator_list?.map((e) => Delegator.fromPartial(e)) || []; + message.delegation_pool_data_list = + object.delegation_pool_data_list?.map((e) => DelegationPoolData.fromPartial(e)) || []; + message.delegation_entries_list = object.delegation_entries_list?.map((e) => DelegationEntries.fromPartial(e)) || + []; + message.proposal_list = object.proposal_list?.map((e) => Proposal.fromPartial(e)) || []; + message.unbonding_delegation_queue_state = + (object.unbonding_delegation_queue_state !== undefined && object.unbonding_delegation_queue_state !== null) + ? UnbondingDelegationQueueState.fromPartial(object.unbonding_delegation_queue_state) + : undefined; + message.unbonding_delegation_queue_entries = + object.unbonding_delegation_queue_entries?.map((e) => UnbondingDelegationQueueEntry.fromPartial(e)) || []; + message.redelegation_cooldown_list = + object.redelegation_cooldown_list?.map((e) => RedelegationCooldown.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/registry/v1beta1/gov.ts b/common/types/src/client/kyve/registry/v1beta1/gov.ts new file mode 100644 index 00000000..ab1546ce --- /dev/null +++ b/common/types/src/client/kyve/registry/v1beta1/gov.ts @@ -0,0 +1,694 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.registry.v1beta1"; + +/** + * CreatePoolProposal is a gov Content type for creating a pool. + * + * @deprecated + */ +export interface CreatePoolProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** name ... */ + name: string; + /** runtime ... */ + runtime: string; + /** logo ... */ + logo: string; + /** config ... */ + config: string; + /** start_key ... */ + start_key: string; + /** upload_interval ... */ + upload_interval: string; + /** operating_cost ... */ + operating_cost: string; + /** min_delegation ... */ + min_delegation: string; + /** max_bundle_size ... */ + max_bundle_size: string; + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; +} + +/** + * UpdatePoolProposal is a gov Content type for updating a pool. + * + * @deprecated + */ +export interface UpdatePoolProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** id ... */ + id: string; + /** payload */ + payload: string; +} + +/** + * PausePoolProposal is a gov Content type for pausing a pool. + * + * @deprecated + */ +export interface PausePoolProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** id ... */ + id: string; +} + +/** + * UnpausePoolProposal is a gov Content type for unpausing a pool. + * + * @deprecated + */ +export interface UnpausePoolProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** id ... */ + id: string; +} + +/** + * SchedulePoolUpgradeProposal is a gov Content type for upgrading a pool by the runtime. + * + * @deprecated + */ +export interface SchedulePoolUpgradeProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** runtime ... */ + runtime: string; + /** version ... */ + version: string; + /** scheduled_at ... */ + scheduled_at: string; + /** duration ... */ + duration: string; + /** binaries ... */ + binaries: string; +} + +/** + * CancelPoolUpgradeProposal is a gov Content type for cancelling a scheduled pool upgrade by the runtime. + * + * @deprecated + */ +export interface CancelPoolUpgradeProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** runtime ... */ + runtime: string; +} + +function createBaseCreatePoolProposal(): CreatePoolProposal { + return { + title: "", + description: "", + name: "", + runtime: "", + logo: "", + config: "", + start_key: "", + upload_interval: "0", + operating_cost: "0", + min_delegation: "0", + max_bundle_size: "0", + version: "", + binaries: "", + }; +} + +export const CreatePoolProposal = { + encode(message: CreatePoolProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(34).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(42).string(message.logo); + } + if (message.config !== "") { + writer.uint32(50).string(message.config); + } + if (message.start_key !== "") { + writer.uint32(58).string(message.start_key); + } + if (message.upload_interval !== "0") { + writer.uint32(64).uint64(message.upload_interval); + } + if (message.operating_cost !== "0") { + writer.uint32(72).uint64(message.operating_cost); + } + if (message.min_delegation !== "0") { + writer.uint32(80).uint64(message.min_delegation); + } + if (message.max_bundle_size !== "0") { + writer.uint32(88).uint64(message.max_bundle_size); + } + if (message.version !== "") { + writer.uint32(98).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(106).string(message.binaries); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreatePoolProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreatePoolProposal(); + 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.name = reader.string(); + break; + case 4: + message.runtime = reader.string(); + break; + case 5: + message.logo = reader.string(); + break; + case 6: + message.config = reader.string(); + break; + case 7: + message.start_key = reader.string(); + break; + case 8: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 9: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 10: + message.min_delegation = longToString(reader.uint64() as Long); + break; + case 11: + message.max_bundle_size = longToString(reader.uint64() as Long); + break; + case 12: + message.version = reader.string(); + break; + case 13: + message.binaries = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CreatePoolProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + config: isSet(object.config) ? String(object.config) : "", + start_key: isSet(object.start_key) ? String(object.start_key) : "", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? String(object.max_bundle_size) : "0", + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + }; + }, + + toJSON(message: CreatePoolProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.config !== undefined && (obj.config = message.config); + message.start_key !== undefined && (obj.start_key = message.start_key); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.min_delegation !== undefined && (obj.min_delegation = message.min_delegation); + message.max_bundle_size !== undefined && (obj.max_bundle_size = message.max_bundle_size); + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + return obj; + }, + + fromPartial, I>>(object: I): CreatePoolProposal { + const message = createBaseCreatePoolProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.config = object.config ?? ""; + message.start_key = object.start_key ?? ""; + message.upload_interval = object.upload_interval ?? "0"; + message.operating_cost = object.operating_cost ?? "0"; + message.min_delegation = object.min_delegation ?? "0"; + message.max_bundle_size = object.max_bundle_size ?? "0"; + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + return message; + }, +}; + +function createBaseUpdatePoolProposal(): UpdatePoolProposal { + return { title: "", description: "", id: "0", payload: "" }; +} + +export const UpdatePoolProposal = { + encode(message: UpdatePoolProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.id !== "0") { + writer.uint32(24).uint64(message.id); + } + if (message.payload !== "") { + writer.uint32(34).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdatePoolProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdatePoolProposal(); + 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.id = longToString(reader.uint64() as Long); + break; + case 4: + message.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UpdatePoolProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + id: isSet(object.id) ? String(object.id) : "0", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: UpdatePoolProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.id !== undefined && (obj.id = message.id); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): UpdatePoolProposal { + const message = createBaseUpdatePoolProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.id = object.id ?? "0"; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBasePausePoolProposal(): PausePoolProposal { + return { title: "", description: "", id: "0" }; +} + +export const PausePoolProposal = { + encode(message: PausePoolProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.id !== "0") { + writer.uint32(24).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PausePoolProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePausePoolProposal(); + 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.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PausePoolProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + id: isSet(object.id) ? String(object.id) : "0", + }; + }, + + toJSON(message: PausePoolProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): PausePoolProposal { + const message = createBasePausePoolProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseUnpausePoolProposal(): UnpausePoolProposal { + return { title: "", description: "", id: "0" }; +} + +export const UnpausePoolProposal = { + encode(message: UnpausePoolProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.id !== "0") { + writer.uint32(24).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnpausePoolProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnpausePoolProposal(); + 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.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnpausePoolProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + id: isSet(object.id) ? String(object.id) : "0", + }; + }, + + toJSON(message: UnpausePoolProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): UnpausePoolProposal { + const message = createBaseUnpausePoolProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseSchedulePoolUpgradeProposal(): SchedulePoolUpgradeProposal { + return { title: "", description: "", runtime: "", version: "", scheduled_at: "0", duration: "0", binaries: "" }; +} + +export const SchedulePoolUpgradeProposal = { + encode(message: SchedulePoolUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.version !== "") { + writer.uint32(34).string(message.version); + } + if (message.scheduled_at !== "0") { + writer.uint32(40).uint64(message.scheduled_at); + } + if (message.duration !== "0") { + writer.uint32(48).uint64(message.duration); + } + if (message.binaries !== "") { + writer.uint32(58).string(message.binaries); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SchedulePoolUpgradeProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSchedulePoolUpgradeProposal(); + 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.runtime = reader.string(); + break; + case 4: + message.version = reader.string(); + break; + case 5: + message.scheduled_at = longToString(reader.uint64() as Long); + break; + case 6: + message.duration = longToString(reader.uint64() as Long); + break; + case 7: + message.binaries = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SchedulePoolUpgradeProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + version: isSet(object.version) ? String(object.version) : "", + scheduled_at: isSet(object.scheduled_at) ? String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? String(object.duration) : "0", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + }; + }, + + toJSON(message: SchedulePoolUpgradeProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.version !== undefined && (obj.version = message.version); + message.scheduled_at !== undefined && (obj.scheduled_at = message.scheduled_at); + message.duration !== undefined && (obj.duration = message.duration); + message.binaries !== undefined && (obj.binaries = message.binaries); + return obj; + }, + + fromPartial, I>>(object: I): SchedulePoolUpgradeProposal { + const message = createBaseSchedulePoolUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runtime = object.runtime ?? ""; + message.version = object.version ?? ""; + message.scheduled_at = object.scheduled_at ?? "0"; + message.duration = object.duration ?? "0"; + message.binaries = object.binaries ?? ""; + return message; + }, +}; + +function createBaseCancelPoolUpgradeProposal(): CancelPoolUpgradeProposal { + return { title: "", description: "", runtime: "" }; +} + +export const CancelPoolUpgradeProposal = { + encode(message: CancelPoolUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CancelPoolUpgradeProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelPoolUpgradeProposal(); + 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.runtime = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CancelPoolUpgradeProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + }; + }, + + toJSON(message: CancelPoolUpgradeProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.runtime !== undefined && (obj.runtime = message.runtime); + return obj; + }, + + fromPartial, I>>(object: I): CancelPoolUpgradeProposal { + const message = createBaseCancelPoolUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runtime = object.runtime ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/registry/v1beta1/registry.ts b/common/types/src/client/kyve/registry/v1beta1/registry.ts new file mode 100644 index 00000000..5a52f51f --- /dev/null +++ b/common/types/src/client/kyve/registry/v1beta1/registry.ts @@ -0,0 +1,2398 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.registry.v1beta1"; + +/** PoolStatus ... */ +export enum PoolStatus { + /** POOL_STATUS_UNSPECIFIED - POOL_STATUS_UNSPECIFIED ... */ + POOL_STATUS_UNSPECIFIED = 0, + /** POOL_STATUS_ACTIVE - POOL_STATUS_ACTIVE ... */ + POOL_STATUS_ACTIVE = 1, + /** POOL_STATUS_PAUSED - POOL_STATUS_PAUSED ... */ + POOL_STATUS_PAUSED = 2, + /** POOL_STATUS_NO_FUNDS - POOL_STATUS_NO_FUNDS ... */ + POOL_STATUS_NO_FUNDS = 3, + /** POOL_STATUS_NOT_ENOUGH_VALIDATORS - POOL_STATUS_NOT_ENOUGH_VALIDATORS ... */ + POOL_STATUS_NOT_ENOUGH_VALIDATORS = 4, + /** POOL_STATUS_NOT_ENOUGH_STAKE - POOL_STATUS_NOT_ENOUGH_STAKE ... */ + POOL_STATUS_NOT_ENOUGH_STAKE = 5, + /** POOL_STATUS_UPGRADING - POOL_STATUS_UPGRADING ... */ + POOL_STATUS_UPGRADING = 6, + UNRECOGNIZED = -1, +} + +export function poolStatusFromJSON(object: any): PoolStatus { + switch (object) { + case 0: + case "POOL_STATUS_UNSPECIFIED": + return PoolStatus.POOL_STATUS_UNSPECIFIED; + case 1: + case "POOL_STATUS_ACTIVE": + return PoolStatus.POOL_STATUS_ACTIVE; + case 2: + case "POOL_STATUS_PAUSED": + return PoolStatus.POOL_STATUS_PAUSED; + case 3: + case "POOL_STATUS_NO_FUNDS": + return PoolStatus.POOL_STATUS_NO_FUNDS; + case 4: + case "POOL_STATUS_NOT_ENOUGH_VALIDATORS": + return PoolStatus.POOL_STATUS_NOT_ENOUGH_VALIDATORS; + case 5: + case "POOL_STATUS_NOT_ENOUGH_STAKE": + return PoolStatus.POOL_STATUS_NOT_ENOUGH_STAKE; + case 6: + case "POOL_STATUS_UPGRADING": + return PoolStatus.POOL_STATUS_UPGRADING; + case -1: + case "UNRECOGNIZED": + default: + return PoolStatus.UNRECOGNIZED; + } +} + +export function poolStatusToJSON(object: PoolStatus): string { + switch (object) { + case PoolStatus.POOL_STATUS_UNSPECIFIED: + return "POOL_STATUS_UNSPECIFIED"; + case PoolStatus.POOL_STATUS_ACTIVE: + return "POOL_STATUS_ACTIVE"; + case PoolStatus.POOL_STATUS_PAUSED: + return "POOL_STATUS_PAUSED"; + case PoolStatus.POOL_STATUS_NO_FUNDS: + return "POOL_STATUS_NO_FUNDS"; + case PoolStatus.POOL_STATUS_NOT_ENOUGH_VALIDATORS: + return "POOL_STATUS_NOT_ENOUGH_VALIDATORS"; + case PoolStatus.POOL_STATUS_NOT_ENOUGH_STAKE: + return "POOL_STATUS_NOT_ENOUGH_STAKE"; + case PoolStatus.POOL_STATUS_UPGRADING: + return "POOL_STATUS_UPGRADING"; + case PoolStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** StakerStatus ... */ +export enum StakerStatus { + /** STAKER_STATUS_UNSPECIFIED - STAKER_STATUS_UNSPECIFIED ... */ + STAKER_STATUS_UNSPECIFIED = 0, + /** STAKER_STATUS_ACTIVE - STAKER_STATUS_ACTIVE ... */ + STAKER_STATUS_ACTIVE = 1, + /** STAKER_STATUS_INACTIVE - STAKER_STATUS_INACTIVE ... */ + STAKER_STATUS_INACTIVE = 2, + UNRECOGNIZED = -1, +} + +export function stakerStatusFromJSON(object: any): StakerStatus { + switch (object) { + case 0: + case "STAKER_STATUS_UNSPECIFIED": + return StakerStatus.STAKER_STATUS_UNSPECIFIED; + case 1: + case "STAKER_STATUS_ACTIVE": + return StakerStatus.STAKER_STATUS_ACTIVE; + case 2: + case "STAKER_STATUS_INACTIVE": + return StakerStatus.STAKER_STATUS_INACTIVE; + case -1: + case "UNRECOGNIZED": + default: + return StakerStatus.UNRECOGNIZED; + } +} + +export function stakerStatusToJSON(object: StakerStatus): string { + switch (object) { + case StakerStatus.STAKER_STATUS_UNSPECIFIED: + return "STAKER_STATUS_UNSPECIFIED"; + case StakerStatus.STAKER_STATUS_ACTIVE: + return "STAKER_STATUS_ACTIVE"; + case StakerStatus.STAKER_STATUS_INACTIVE: + return "STAKER_STATUS_INACTIVE"; + case StakerStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** BundleProposal ... */ +export interface BundleProposal { + /** uploader ... */ + uploader: string; + /** next_uploader ... */ + next_uploader: string; + /** storage_id ... */ + storage_id: string; + /** byte_size ... */ + byte_size: string; + /** + * from_height ... + * + * @deprecated + */ + from_height: string; + /** to_height ... */ + to_height: string; + /** created_at ... */ + created_at: string; + /** voters_valid ... */ + voters_valid: string[]; + /** voters_invalid ... */ + voters_invalid: string[]; + /** voters_abstain ... */ + voters_abstain: string[]; + /** to_key ... */ + to_key: string; + /** to_value ... */ + to_value: string; + /** bundle_hash ... */ + bundle_hash: string; +} + +/** Protocol ... */ +export interface Protocol { + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** last_upgrade ... */ + last_upgrade: string; + /** test */ + test: string; +} + +/** Upgrade ... */ +export interface UpgradePlan { + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** scheduled_at ... */ + scheduled_at: string; + /** duration ... */ + duration: string; +} + +/** DelegationEntries ... */ +export interface DelegationEntries { + /** id ... */ + id: string; + /** balance ... */ + balance: string; + /** staker ... */ + staker: string; + /** k_index ... */ + k_index: string; +} + +/** DelegationPoolData ... */ +export interface DelegationPoolData { + /** id ... */ + id: string; + /** staker ... */ + staker: string; + /** current_rewards ... */ + current_rewards: string; + /** total_delegation ... */ + total_delegation: string; + /** latest_index_k ... */ + latest_index_k: string; + /** delegator_count ... */ + delegator_count: string; + /** latest_index_was_undelegation ... */ + latest_index_was_undelegation: boolean; +} + +/** Delegator ... */ +export interface Delegator { + /** id ... */ + id: string; + /** k_index ... */ + k_index: string; + /** delegation_amount ... */ + delegation_amount: string; + /** staker ... */ + staker: string; + /** delegator ... */ + delegator: string; +} + +/** Funder ... */ +export interface Funder { + /** account ... */ + account: string; + /** fund_id ... */ + pool_id: string; + /** amount ... */ + amount: string; +} + +/** Pool ... */ +export interface Pool { + /** id ... */ + id: string; + /** creator ... */ + creator: string; + /** name ... */ + name: string; + /** runtime ... */ + runtime: string; + /** logo ... */ + logo: string; + /** + * versions ... + * + * @deprecated + */ + versions: string; + /** config ... */ + config: string; + /** current_height ... */ + current_height: string; + /** total_bytes ... */ + total_bytes: string; + /** total_bundles ... */ + total_bundles: string; + /** total_bundle_rewards ... */ + total_bundle_rewards: string; + /** + * start_height ... + * + * @deprecated + */ + start_height: string; + /** upload_interval ... */ + upload_interval: string; + /** operating_cost ... */ + operating_cost: string; + /** paused ... */ + paused: boolean; + /** funders ... */ + funders: string[]; + /** lowest_funder ... */ + lowest_funder: string; + /** total_funds ... */ + total_funds: string; + /** stakers ... */ + stakers: string[]; + /** lowest_staker ... */ + lowest_staker: string; + /** total_stake ... */ + total_stake: string; + /** total_delegation ... */ + total_delegation: string; + /** bundle_proposal ... */ + bundle_proposal?: BundleProposal; + /** max_bundle_size ... */ + max_bundle_size: string; + /** protocol ... */ + protocol?: Protocol; + /** upgrade_plan ... */ + upgrade_plan?: UpgradePlan; + /** start_key ... */ + start_key: string; + /** current_key ... */ + current_key: string; + /** current_value ... */ + current_value: string; + /** inactive_stakers ... */ + inactive_stakers: string[]; + /** total_inactive_stake ... */ + total_inactive_stake: string; + /** min_stake ... */ + min_stake: string; + /** status ... */ + status: PoolStatus; +} + +/** Proposal ... */ +export interface Proposal { + /** storage_id ... */ + storage_id: string; + /** pool_id ... */ + pool_id: string; + /** uploader ... */ + uploader: string; + /** from_height ... */ + from_height: string; + /** to_height ... */ + to_height: string; + /** finalized_at ... */ + finalized_at: string; + /** id ... */ + id: string; + /** key ... */ + key: string; + /** value ... */ + value: string; + /** bundle_hash ... */ + bundle_hash: string; +} + +/** Staker ... */ +export interface Staker { + /** staker ... */ + account: string; + /** pool_id ... */ + pool_id: string; + /** amount ... */ + amount: string; + /** unbonding_amount ... */ + unbonding_amount: string; + /** commission ... */ + commission: string; + /** moniker ... */ + moniker: string; + /** website ... */ + website: string; + /** logo */ + logo: string; + /** points */ + points: string; + /** status */ + status: StakerStatus; +} + +/** + * UnbondingStakingEntry + * Creates an entry for an upcoming unbonding of a staker which is put in the unbonding fifo queue and + * executed after the unbonding time is over. + */ +export interface UnbondingStakingQueueEntry { + /** index is a monotonically increasing integer to order the entries */ + index: string; + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** amount ... */ + amount: string; + /** creation_time ... */ + creation_time: string; +} + +/** + * UnbondingStakingEntry + * Creates an entry for an upcoming unbonding of a staker which is put in the unbonding fifo queue and + * executed after the unbonding time is over. + */ +export interface UnbondingStaker { + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** amount ... */ + unbonding_amount: string; +} + +/** UnbondingState stores the state for the unbonding of stakes and delegations. */ +export interface UnbondingStakingQueueState { + /** low_index ... */ + low_index: string; + /** high_index ... */ + high_index: string; +} + +/** + * UnbondingStakingEntry + * Creates an entry for an upcoming unbonding of a staker which is put in the unbonding fifo queue and + * executed after the unbonding time is over. + */ +export interface UnbondingDelegationQueueEntry { + /** index is a monotonically increasing integer to order the entries */ + index: string; + /** staker ... */ + staker: string; + /** delegator ... */ + delegator: string; + /** pool_id ... */ + pool_id: string; + /** amount ... */ + amount: string; + /** creation_time ... */ + creation_time: string; +} + +/** UnbondingState stores the state for the unbonding of stakes and delegations. */ +export interface UnbondingDelegationQueueState { + /** low_index ... */ + low_index: string; + /** high_index ... */ + high_index: string; +} + +/** RedelegationCooldown ... */ +export interface RedelegationCooldown { + /** low_index ... */ + address: string; + /** high_index ... */ + creation_date: string; +} + +/** CommissionChangeQueueEntry ... */ +export interface CommissionChangeQueueEntry { + /** index is a monotonically increasing integer to order the entries */ + index: string; + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** commission ... */ + commission: string; + /** commission ... */ + creation_date: string; +} + +/** CommissionChangeQueueState ... */ +export interface CommissionChangeQueueState { + /** low_index ... */ + low_index: string; + /** high_index ... */ + high_index: string; +} + +function createBaseBundleProposal(): BundleProposal { + return { + uploader: "", + next_uploader: "", + storage_id: "", + byte_size: "0", + from_height: "0", + to_height: "0", + created_at: "0", + voters_valid: [], + voters_invalid: [], + voters_abstain: [], + to_key: "", + to_value: "", + bundle_hash: "", + }; +} + +export const BundleProposal = { + encode(message: BundleProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.uploader !== "") { + writer.uint32(10).string(message.uploader); + } + if (message.next_uploader !== "") { + writer.uint32(18).string(message.next_uploader); + } + if (message.storage_id !== "") { + writer.uint32(26).string(message.storage_id); + } + if (message.byte_size !== "0") { + writer.uint32(32).uint64(message.byte_size); + } + if (message.from_height !== "0") { + writer.uint32(40).uint64(message.from_height); + } + if (message.to_height !== "0") { + writer.uint32(48).uint64(message.to_height); + } + if (message.created_at !== "0") { + writer.uint32(56).uint64(message.created_at); + } + for (const v of message.voters_valid) { + writer.uint32(66).string(v!); + } + for (const v of message.voters_invalid) { + writer.uint32(74).string(v!); + } + for (const v of message.voters_abstain) { + writer.uint32(82).string(v!); + } + if (message.to_key !== "") { + writer.uint32(90).string(message.to_key); + } + if (message.to_value !== "") { + writer.uint32(98).string(message.to_value); + } + if (message.bundle_hash !== "") { + writer.uint32(106).string(message.bundle_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BundleProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBundleProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uploader = reader.string(); + break; + case 2: + message.next_uploader = reader.string(); + break; + case 3: + message.storage_id = reader.string(); + break; + case 4: + message.byte_size = longToString(reader.uint64() as Long); + break; + case 5: + message.from_height = longToString(reader.uint64() as Long); + break; + case 6: + message.to_height = longToString(reader.uint64() as Long); + break; + case 7: + message.created_at = longToString(reader.uint64() as Long); + break; + case 8: + message.voters_valid.push(reader.string()); + break; + case 9: + message.voters_invalid.push(reader.string()); + break; + case 10: + message.voters_abstain.push(reader.string()); + break; + case 11: + message.to_key = reader.string(); + break; + case 12: + message.to_value = reader.string(); + break; + case 13: + message.bundle_hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BundleProposal { + return { + uploader: isSet(object.uploader) ? String(object.uploader) : "", + next_uploader: isSet(object.next_uploader) ? String(object.next_uploader) : "", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + byte_size: isSet(object.byte_size) ? String(object.byte_size) : "0", + from_height: isSet(object.from_height) ? String(object.from_height) : "0", + to_height: isSet(object.to_height) ? String(object.to_height) : "0", + created_at: isSet(object.created_at) ? String(object.created_at) : "0", + voters_valid: Array.isArray(object?.voters_valid) ? object.voters_valid.map((e: any) => String(e)) : [], + voters_invalid: Array.isArray(object?.voters_invalid) ? object.voters_invalid.map((e: any) => String(e)) : [], + voters_abstain: Array.isArray(object?.voters_abstain) ? object.voters_abstain.map((e: any) => String(e)) : [], + to_key: isSet(object.to_key) ? String(object.to_key) : "", + to_value: isSet(object.to_value) ? String(object.to_value) : "", + bundle_hash: isSet(object.bundle_hash) ? String(object.bundle_hash) : "", + }; + }, + + toJSON(message: BundleProposal): unknown { + const obj: any = {}; + message.uploader !== undefined && (obj.uploader = message.uploader); + message.next_uploader !== undefined && (obj.next_uploader = message.next_uploader); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.byte_size !== undefined && (obj.byte_size = message.byte_size); + message.from_height !== undefined && (obj.from_height = message.from_height); + message.to_height !== undefined && (obj.to_height = message.to_height); + message.created_at !== undefined && (obj.created_at = message.created_at); + if (message.voters_valid) { + obj.voters_valid = message.voters_valid.map((e) => e); + } else { + obj.voters_valid = []; + } + if (message.voters_invalid) { + obj.voters_invalid = message.voters_invalid.map((e) => e); + } else { + obj.voters_invalid = []; + } + if (message.voters_abstain) { + obj.voters_abstain = message.voters_abstain.map((e) => e); + } else { + obj.voters_abstain = []; + } + message.to_key !== undefined && (obj.to_key = message.to_key); + message.to_value !== undefined && (obj.to_value = message.to_value); + message.bundle_hash !== undefined && (obj.bundle_hash = message.bundle_hash); + return obj; + }, + + fromPartial, I>>(object: I): BundleProposal { + const message = createBaseBundleProposal(); + message.uploader = object.uploader ?? ""; + message.next_uploader = object.next_uploader ?? ""; + message.storage_id = object.storage_id ?? ""; + message.byte_size = object.byte_size ?? "0"; + message.from_height = object.from_height ?? "0"; + message.to_height = object.to_height ?? "0"; + message.created_at = object.created_at ?? "0"; + message.voters_valid = object.voters_valid?.map((e) => e) || []; + message.voters_invalid = object.voters_invalid?.map((e) => e) || []; + message.voters_abstain = object.voters_abstain?.map((e) => e) || []; + message.to_key = object.to_key ?? ""; + message.to_value = object.to_value ?? ""; + message.bundle_hash = object.bundle_hash ?? ""; + return message; + }, +}; + +function createBaseProtocol(): Protocol { + return { version: "", binaries: "", last_upgrade: "0", test: "" }; +} + +export const Protocol = { + encode(message: Protocol, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(18).string(message.binaries); + } + if (message.last_upgrade !== "0") { + writer.uint32(24).uint64(message.last_upgrade); + } + if (message.test !== "") { + writer.uint32(34).string(message.test); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Protocol { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProtocol(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.binaries = reader.string(); + break; + case 3: + message.last_upgrade = longToString(reader.uint64() as Long); + break; + case 4: + message.test = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Protocol { + return { + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + last_upgrade: isSet(object.last_upgrade) ? String(object.last_upgrade) : "0", + test: isSet(object.test) ? String(object.test) : "", + }; + }, + + toJSON(message: Protocol): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.last_upgrade !== undefined && (obj.last_upgrade = message.last_upgrade); + message.test !== undefined && (obj.test = message.test); + return obj; + }, + + fromPartial, I>>(object: I): Protocol { + const message = createBaseProtocol(); + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.last_upgrade = object.last_upgrade ?? "0"; + message.test = object.test ?? ""; + return message; + }, +}; + +function createBaseUpgradePlan(): UpgradePlan { + return { version: "", binaries: "", scheduled_at: "0", duration: "0" }; +} + +export const UpgradePlan = { + encode(message: UpgradePlan, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(18).string(message.binaries); + } + if (message.scheduled_at !== "0") { + writer.uint32(24).uint64(message.scheduled_at); + } + if (message.duration !== "0") { + writer.uint32(32).uint64(message.duration); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpgradePlan { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpgradePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.binaries = reader.string(); + break; + case 3: + message.scheduled_at = longToString(reader.uint64() as Long); + break; + case 4: + message.duration = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UpgradePlan { + return { + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + scheduled_at: isSet(object.scheduled_at) ? String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? String(object.duration) : "0", + }; + }, + + toJSON(message: UpgradePlan): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.scheduled_at !== undefined && (obj.scheduled_at = message.scheduled_at); + message.duration !== undefined && (obj.duration = message.duration); + return obj; + }, + + fromPartial, I>>(object: I): UpgradePlan { + const message = createBaseUpgradePlan(); + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.scheduled_at = object.scheduled_at ?? "0"; + message.duration = object.duration ?? "0"; + return message; + }, +}; + +function createBaseDelegationEntries(): DelegationEntries { + return { id: "0", balance: "", staker: "", k_index: "0" }; +} + +export const DelegationEntries = { + encode(message: DelegationEntries, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.balance !== "") { + writer.uint32(18).string(message.balance); + } + if (message.staker !== "") { + writer.uint32(26).string(message.staker); + } + if (message.k_index !== "0") { + writer.uint32(32).uint64(message.k_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationEntries { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationEntries(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.balance = reader.string(); + break; + case 3: + message.staker = reader.string(); + break; + case 4: + message.k_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationEntries { + return { + id: isSet(object.id) ? String(object.id) : "0", + balance: isSet(object.balance) ? String(object.balance) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + k_index: isSet(object.k_index) ? String(object.k_index) : "0", + }; + }, + + toJSON(message: DelegationEntries): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.balance !== undefined && (obj.balance = message.balance); + message.staker !== undefined && (obj.staker = message.staker); + message.k_index !== undefined && (obj.k_index = message.k_index); + return obj; + }, + + fromPartial, I>>(object: I): DelegationEntries { + const message = createBaseDelegationEntries(); + message.id = object.id ?? "0"; + message.balance = object.balance ?? ""; + message.staker = object.staker ?? ""; + message.k_index = object.k_index ?? "0"; + return message; + }, +}; + +function createBaseDelegationPoolData(): DelegationPoolData { + return { + id: "0", + staker: "", + current_rewards: "0", + total_delegation: "0", + latest_index_k: "0", + delegator_count: "0", + latest_index_was_undelegation: false, + }; +} + +export const DelegationPoolData = { + encode(message: DelegationPoolData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.current_rewards !== "0") { + writer.uint32(24).uint64(message.current_rewards); + } + if (message.total_delegation !== "0") { + writer.uint32(32).uint64(message.total_delegation); + } + if (message.latest_index_k !== "0") { + writer.uint32(40).uint64(message.latest_index_k); + } + if (message.delegator_count !== "0") { + writer.uint32(48).uint64(message.delegator_count); + } + if (message.latest_index_was_undelegation === true) { + writer.uint32(56).bool(message.latest_index_was_undelegation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationPoolData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationPoolData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.current_rewards = longToString(reader.uint64() as Long); + break; + case 4: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 5: + message.latest_index_k = longToString(reader.uint64() as Long); + break; + case 6: + message.delegator_count = longToString(reader.uint64() as Long); + break; + case 7: + message.latest_index_was_undelegation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationPoolData { + return { + id: isSet(object.id) ? String(object.id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + current_rewards: isSet(object.current_rewards) ? String(object.current_rewards) : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + latest_index_k: isSet(object.latest_index_k) ? String(object.latest_index_k) : "0", + delegator_count: isSet(object.delegator_count) ? String(object.delegator_count) : "0", + latest_index_was_undelegation: isSet(object.latest_index_was_undelegation) + ? Boolean(object.latest_index_was_undelegation) + : false, + }; + }, + + toJSON(message: DelegationPoolData): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.staker !== undefined && (obj.staker = message.staker); + message.current_rewards !== undefined && (obj.current_rewards = message.current_rewards); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.latest_index_k !== undefined && (obj.latest_index_k = message.latest_index_k); + message.delegator_count !== undefined && (obj.delegator_count = message.delegator_count); + message.latest_index_was_undelegation !== undefined && + (obj.latest_index_was_undelegation = message.latest_index_was_undelegation); + return obj; + }, + + fromPartial, I>>(object: I): DelegationPoolData { + const message = createBaseDelegationPoolData(); + message.id = object.id ?? "0"; + message.staker = object.staker ?? ""; + message.current_rewards = object.current_rewards ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.latest_index_k = object.latest_index_k ?? "0"; + message.delegator_count = object.delegator_count ?? "0"; + message.latest_index_was_undelegation = object.latest_index_was_undelegation ?? false; + return message; + }, +}; + +function createBaseDelegator(): Delegator { + return { id: "0", k_index: "0", delegation_amount: "0", staker: "", delegator: "" }; +} + +export const Delegator = { + encode(message: Delegator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.k_index !== "0") { + writer.uint32(16).uint64(message.k_index); + } + if (message.delegation_amount !== "0") { + writer.uint32(24).uint64(message.delegation_amount); + } + if (message.staker !== "") { + writer.uint32(34).string(message.staker); + } + if (message.delegator !== "") { + writer.uint32(42).string(message.delegator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Delegator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.k_index = longToString(reader.uint64() as Long); + break; + case 3: + message.delegation_amount = longToString(reader.uint64() as Long); + break; + case 4: + message.staker = reader.string(); + break; + case 5: + message.delegator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Delegator { + return { + id: isSet(object.id) ? String(object.id) : "0", + k_index: isSet(object.k_index) ? String(object.k_index) : "0", + delegation_amount: isSet(object.delegation_amount) ? String(object.delegation_amount) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + delegator: isSet(object.delegator) ? String(object.delegator) : "", + }; + }, + + toJSON(message: Delegator): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.k_index !== undefined && (obj.k_index = message.k_index); + message.delegation_amount !== undefined && (obj.delegation_amount = message.delegation_amount); + message.staker !== undefined && (obj.staker = message.staker); + message.delegator !== undefined && (obj.delegator = message.delegator); + return obj; + }, + + fromPartial, I>>(object: I): Delegator { + const message = createBaseDelegator(); + message.id = object.id ?? "0"; + message.k_index = object.k_index ?? "0"; + message.delegation_amount = object.delegation_amount ?? "0"; + message.staker = object.staker ?? ""; + message.delegator = object.delegator ?? ""; + return message; + }, +}; + +function createBaseFunder(): Funder { + return { account: "", pool_id: "0", amount: "0" }; +} + +export const Funder = { + encode(message: Funder, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Funder { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.account = reader.string(); + break; + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Funder { + return { + account: isSet(object.account) ? String(object.account) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: Funder): unknown { + const obj: any = {}; + message.account !== undefined && (obj.account = message.account); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): Funder { + const message = createBaseFunder(); + message.account = object.account ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBasePool(): Pool { + return { + id: "0", + creator: "", + name: "", + runtime: "", + logo: "", + versions: "", + config: "", + current_height: "0", + total_bytes: "0", + total_bundles: "0", + total_bundle_rewards: "0", + start_height: "0", + upload_interval: "0", + operating_cost: "0", + paused: false, + funders: [], + lowest_funder: "", + total_funds: "0", + stakers: [], + lowest_staker: "", + total_stake: "0", + total_delegation: "0", + bundle_proposal: undefined, + max_bundle_size: "0", + protocol: undefined, + upgrade_plan: undefined, + start_key: "", + current_key: "", + current_value: "", + inactive_stakers: [], + total_inactive_stake: "0", + min_stake: "0", + status: 0, + }; +} + +export const Pool = { + encode(message: Pool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(34).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(42).string(message.logo); + } + if (message.versions !== "") { + writer.uint32(50).string(message.versions); + } + if (message.config !== "") { + writer.uint32(58).string(message.config); + } + if (message.current_height !== "0") { + writer.uint32(64).uint64(message.current_height); + } + if (message.total_bytes !== "0") { + writer.uint32(72).uint64(message.total_bytes); + } + if (message.total_bundles !== "0") { + writer.uint32(80).uint64(message.total_bundles); + } + if (message.total_bundle_rewards !== "0") { + writer.uint32(88).uint64(message.total_bundle_rewards); + } + if (message.start_height !== "0") { + writer.uint32(96).uint64(message.start_height); + } + if (message.upload_interval !== "0") { + writer.uint32(104).uint64(message.upload_interval); + } + if (message.operating_cost !== "0") { + writer.uint32(112).uint64(message.operating_cost); + } + if (message.paused === true) { + writer.uint32(120).bool(message.paused); + } + for (const v of message.funders) { + writer.uint32(130).string(v!); + } + if (message.lowest_funder !== "") { + writer.uint32(138).string(message.lowest_funder); + } + if (message.total_funds !== "0") { + writer.uint32(144).uint64(message.total_funds); + } + for (const v of message.stakers) { + writer.uint32(154).string(v!); + } + if (message.lowest_staker !== "") { + writer.uint32(162).string(message.lowest_staker); + } + if (message.total_stake !== "0") { + writer.uint32(168).uint64(message.total_stake); + } + if (message.total_delegation !== "0") { + writer.uint32(176).uint64(message.total_delegation); + } + if (message.bundle_proposal !== undefined) { + BundleProposal.encode(message.bundle_proposal, writer.uint32(186).fork()).ldelim(); + } + if (message.max_bundle_size !== "0") { + writer.uint32(192).uint64(message.max_bundle_size); + } + if (message.protocol !== undefined) { + Protocol.encode(message.protocol, writer.uint32(202).fork()).ldelim(); + } + if (message.upgrade_plan !== undefined) { + UpgradePlan.encode(message.upgrade_plan, writer.uint32(210).fork()).ldelim(); + } + if (message.start_key !== "") { + writer.uint32(218).string(message.start_key); + } + if (message.current_key !== "") { + writer.uint32(226).string(message.current_key); + } + if (message.current_value !== "") { + writer.uint32(234).string(message.current_value); + } + for (const v of message.inactive_stakers) { + writer.uint32(242).string(v!); + } + if (message.total_inactive_stake !== "0") { + writer.uint32(248).uint64(message.total_inactive_stake); + } + if (message.min_stake !== "0") { + writer.uint32(256).uint64(message.min_stake); + } + if (message.status !== 0) { + writer.uint32(264).int32(message.status); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Pool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.id = longToString(reader.uint64() as Long); + break; + case 2: + message.creator = reader.string(); + break; + case 3: + message.name = reader.string(); + break; + case 4: + message.runtime = reader.string(); + break; + case 5: + message.logo = reader.string(); + break; + case 6: + message.versions = reader.string(); + break; + case 7: + message.config = reader.string(); + break; + case 8: + message.current_height = longToString(reader.uint64() as Long); + break; + case 9: + message.total_bytes = longToString(reader.uint64() as Long); + break; + case 10: + message.total_bundles = longToString(reader.uint64() as Long); + break; + case 11: + message.total_bundle_rewards = longToString(reader.uint64() as Long); + break; + case 12: + message.start_height = longToString(reader.uint64() as Long); + break; + case 13: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 14: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 15: + message.paused = reader.bool(); + break; + case 16: + message.funders.push(reader.string()); + break; + case 17: + message.lowest_funder = reader.string(); + break; + case 18: + message.total_funds = longToString(reader.uint64() as Long); + break; + case 19: + message.stakers.push(reader.string()); + break; + case 20: + message.lowest_staker = reader.string(); + break; + case 21: + message.total_stake = longToString(reader.uint64() as Long); + break; + case 22: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 23: + message.bundle_proposal = BundleProposal.decode(reader, reader.uint32()); + break; + case 24: + message.max_bundle_size = longToString(reader.uint64() as Long); + break; + case 25: + message.protocol = Protocol.decode(reader, reader.uint32()); + break; + case 26: + message.upgrade_plan = UpgradePlan.decode(reader, reader.uint32()); + break; + case 27: + message.start_key = reader.string(); + break; + case 28: + message.current_key = reader.string(); + break; + case 29: + message.current_value = reader.string(); + break; + case 30: + message.inactive_stakers.push(reader.string()); + break; + case 31: + message.total_inactive_stake = longToString(reader.uint64() as Long); + break; + case 32: + message.min_stake = longToString(reader.uint64() as Long); + break; + case 33: + message.status = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Pool { + return { + id: isSet(object.id) ? String(object.id) : "0", + creator: isSet(object.creator) ? String(object.creator) : "", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + versions: isSet(object.versions) ? String(object.versions) : "", + config: isSet(object.config) ? String(object.config) : "", + current_height: isSet(object.current_height) ? String(object.current_height) : "0", + total_bytes: isSet(object.total_bytes) ? String(object.total_bytes) : "0", + total_bundles: isSet(object.total_bundles) ? String(object.total_bundles) : "0", + total_bundle_rewards: isSet(object.total_bundle_rewards) ? String(object.total_bundle_rewards) : "0", + start_height: isSet(object.start_height) ? String(object.start_height) : "0", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + paused: isSet(object.paused) ? Boolean(object.paused) : false, + funders: Array.isArray(object?.funders) ? object.funders.map((e: any) => String(e)) : [], + lowest_funder: isSet(object.lowest_funder) ? String(object.lowest_funder) : "", + total_funds: isSet(object.total_funds) ? String(object.total_funds) : "0", + stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => String(e)) : [], + lowest_staker: isSet(object.lowest_staker) ? String(object.lowest_staker) : "", + total_stake: isSet(object.total_stake) ? String(object.total_stake) : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + bundle_proposal: isSet(object.bundle_proposal) ? BundleProposal.fromJSON(object.bundle_proposal) : undefined, + max_bundle_size: isSet(object.max_bundle_size) ? String(object.max_bundle_size) : "0", + protocol: isSet(object.protocol) ? Protocol.fromJSON(object.protocol) : undefined, + upgrade_plan: isSet(object.upgrade_plan) ? UpgradePlan.fromJSON(object.upgrade_plan) : undefined, + start_key: isSet(object.start_key) ? String(object.start_key) : "", + current_key: isSet(object.current_key) ? String(object.current_key) : "", + current_value: isSet(object.current_value) ? String(object.current_value) : "", + inactive_stakers: Array.isArray(object?.inactive_stakers) + ? object.inactive_stakers.map((e: any) => String(e)) + : [], + total_inactive_stake: isSet(object.total_inactive_stake) ? String(object.total_inactive_stake) : "0", + min_stake: isSet(object.min_stake) ? String(object.min_stake) : "0", + status: isSet(object.status) ? poolStatusFromJSON(object.status) : 0, + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.creator !== undefined && (obj.creator = message.creator); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.versions !== undefined && (obj.versions = message.versions); + message.config !== undefined && (obj.config = message.config); + message.current_height !== undefined && (obj.current_height = message.current_height); + message.total_bytes !== undefined && (obj.total_bytes = message.total_bytes); + message.total_bundles !== undefined && (obj.total_bundles = message.total_bundles); + message.total_bundle_rewards !== undefined && (obj.total_bundle_rewards = message.total_bundle_rewards); + message.start_height !== undefined && (obj.start_height = message.start_height); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.paused !== undefined && (obj.paused = message.paused); + if (message.funders) { + obj.funders = message.funders.map((e) => e); + } else { + obj.funders = []; + } + message.lowest_funder !== undefined && (obj.lowest_funder = message.lowest_funder); + message.total_funds !== undefined && (obj.total_funds = message.total_funds); + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e); + } else { + obj.stakers = []; + } + message.lowest_staker !== undefined && (obj.lowest_staker = message.lowest_staker); + message.total_stake !== undefined && (obj.total_stake = message.total_stake); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.bundle_proposal !== undefined && + (obj.bundle_proposal = message.bundle_proposal ? BundleProposal.toJSON(message.bundle_proposal) : undefined); + message.max_bundle_size !== undefined && (obj.max_bundle_size = message.max_bundle_size); + message.protocol !== undefined && (obj.protocol = message.protocol ? Protocol.toJSON(message.protocol) : undefined); + message.upgrade_plan !== undefined && + (obj.upgrade_plan = message.upgrade_plan ? UpgradePlan.toJSON(message.upgrade_plan) : undefined); + message.start_key !== undefined && (obj.start_key = message.start_key); + message.current_key !== undefined && (obj.current_key = message.current_key); + message.current_value !== undefined && (obj.current_value = message.current_value); + if (message.inactive_stakers) { + obj.inactive_stakers = message.inactive_stakers.map((e) => e); + } else { + obj.inactive_stakers = []; + } + message.total_inactive_stake !== undefined && (obj.total_inactive_stake = message.total_inactive_stake); + message.min_stake !== undefined && (obj.min_stake = message.min_stake); + message.status !== undefined && (obj.status = poolStatusToJSON(message.status)); + return obj; + }, + + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.id = object.id ?? "0"; + message.creator = object.creator ?? ""; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.versions = object.versions ?? ""; + message.config = object.config ?? ""; + message.current_height = object.current_height ?? "0"; + message.total_bytes = object.total_bytes ?? "0"; + message.total_bundles = object.total_bundles ?? "0"; + message.total_bundle_rewards = object.total_bundle_rewards ?? "0"; + message.start_height = object.start_height ?? "0"; + message.upload_interval = object.upload_interval ?? "0"; + message.operating_cost = object.operating_cost ?? "0"; + message.paused = object.paused ?? false; + message.funders = object.funders?.map((e) => e) || []; + message.lowest_funder = object.lowest_funder ?? ""; + message.total_funds = object.total_funds ?? "0"; + message.stakers = object.stakers?.map((e) => e) || []; + message.lowest_staker = object.lowest_staker ?? ""; + message.total_stake = object.total_stake ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.bundle_proposal = (object.bundle_proposal !== undefined && object.bundle_proposal !== null) + ? BundleProposal.fromPartial(object.bundle_proposal) + : undefined; + message.max_bundle_size = object.max_bundle_size ?? "0"; + message.protocol = (object.protocol !== undefined && object.protocol !== null) + ? Protocol.fromPartial(object.protocol) + : undefined; + message.upgrade_plan = (object.upgrade_plan !== undefined && object.upgrade_plan !== null) + ? UpgradePlan.fromPartial(object.upgrade_plan) + : undefined; + message.start_key = object.start_key ?? ""; + message.current_key = object.current_key ?? ""; + message.current_value = object.current_value ?? ""; + message.inactive_stakers = object.inactive_stakers?.map((e) => e) || []; + message.total_inactive_stake = object.total_inactive_stake ?? "0"; + message.min_stake = object.min_stake ?? "0"; + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + storage_id: "", + pool_id: "0", + uploader: "", + from_height: "0", + to_height: "0", + finalized_at: "0", + id: "0", + key: "", + value: "", + bundle_hash: "", + }; +} + +export const Proposal = { + encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.storage_id !== "") { + writer.uint32(10).string(message.storage_id); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + if (message.uploader !== "") { + writer.uint32(26).string(message.uploader); + } + if (message.from_height !== "0") { + writer.uint32(32).uint64(message.from_height); + } + if (message.to_height !== "0") { + writer.uint32(40).uint64(message.to_height); + } + if (message.finalized_at !== "0") { + writer.uint32(48).uint64(message.finalized_at); + } + if (message.id !== "0") { + writer.uint32(56).uint64(message.id); + } + if (message.key !== "") { + writer.uint32(66).string(message.key); + } + if (message.value !== "") { + writer.uint32(74).string(message.value); + } + if (message.bundle_hash !== "") { + writer.uint32(82).string(message.bundle_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.storage_id = reader.string(); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 3: + message.uploader = reader.string(); + break; + case 4: + message.from_height = longToString(reader.uint64() as Long); + break; + case 5: + message.to_height = longToString(reader.uint64() as Long); + break; + case 6: + message.finalized_at = longToString(reader.uint64() as Long); + break; + case 7: + message.id = longToString(reader.uint64() as Long); + break; + case 8: + message.key = reader.string(); + break; + case 9: + message.value = reader.string(); + break; + case 10: + message.bundle_hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + uploader: isSet(object.uploader) ? String(object.uploader) : "", + from_height: isSet(object.from_height) ? String(object.from_height) : "0", + to_height: isSet(object.to_height) ? String(object.to_height) : "0", + finalized_at: isSet(object.finalized_at) ? String(object.finalized_at) : "0", + id: isSet(object.id) ? String(object.id) : "0", + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "", + bundle_hash: isSet(object.bundle_hash) ? String(object.bundle_hash) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.uploader !== undefined && (obj.uploader = message.uploader); + message.from_height !== undefined && (obj.from_height = message.from_height); + message.to_height !== undefined && (obj.to_height = message.to_height); + message.finalized_at !== undefined && (obj.finalized_at = message.finalized_at); + message.id !== undefined && (obj.id = message.id); + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + message.bundle_hash !== undefined && (obj.bundle_hash = message.bundle_hash); + return obj; + }, + + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.storage_id = object.storage_id ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.uploader = object.uploader ?? ""; + message.from_height = object.from_height ?? "0"; + message.to_height = object.to_height ?? "0"; + message.finalized_at = object.finalized_at ?? "0"; + message.id = object.id ?? "0"; + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.bundle_hash = object.bundle_hash ?? ""; + return message; + }, +}; + +function createBaseStaker(): Staker { + return { + account: "", + pool_id: "0", + amount: "0", + unbonding_amount: "0", + commission: "", + moniker: "", + website: "", + logo: "", + points: "0", + status: 0, + }; +} + +export const Staker = { + encode(message: Staker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + if (message.unbonding_amount !== "0") { + writer.uint32(32).uint64(message.unbonding_amount); + } + if (message.commission !== "") { + writer.uint32(42).string(message.commission); + } + if (message.moniker !== "") { + writer.uint32(50).string(message.moniker); + } + if (message.website !== "") { + writer.uint32(58).string(message.website); + } + if (message.logo !== "") { + writer.uint32(66).string(message.logo); + } + if (message.points !== "0") { + writer.uint32(72).uint64(message.points); + } + if (message.status !== 0) { + writer.uint32(80).int32(message.status); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Staker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + case 4: + message.unbonding_amount = longToString(reader.uint64() as Long); + break; + case 5: + message.commission = reader.string(); + break; + case 6: + message.moniker = reader.string(); + break; + case 7: + message.website = reader.string(); + break; + case 8: + message.logo = reader.string(); + break; + case 9: + message.points = longToString(reader.uint64() as Long); + break; + case 10: + message.status = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Staker { + return { + account: isSet(object.account) ? String(object.account) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + unbonding_amount: isSet(object.unbonding_amount) ? String(object.unbonding_amount) : "0", + commission: isSet(object.commission) ? String(object.commission) : "", + moniker: isSet(object.moniker) ? String(object.moniker) : "", + website: isSet(object.website) ? String(object.website) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + points: isSet(object.points) ? String(object.points) : "0", + status: isSet(object.status) ? stakerStatusFromJSON(object.status) : 0, + }; + }, + + toJSON(message: Staker): unknown { + const obj: any = {}; + message.account !== undefined && (obj.account = message.account); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.amount !== undefined && (obj.amount = message.amount); + message.unbonding_amount !== undefined && (obj.unbonding_amount = message.unbonding_amount); + message.commission !== undefined && (obj.commission = message.commission); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.website !== undefined && (obj.website = message.website); + message.logo !== undefined && (obj.logo = message.logo); + message.points !== undefined && (obj.points = message.points); + message.status !== undefined && (obj.status = stakerStatusToJSON(message.status)); + return obj; + }, + + fromPartial, I>>(object: I): Staker { + const message = createBaseStaker(); + message.account = object.account ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.amount = object.amount ?? "0"; + message.unbonding_amount = object.unbonding_amount ?? "0"; + message.commission = object.commission ?? ""; + message.moniker = object.moniker ?? ""; + message.website = object.website ?? ""; + message.logo = object.logo ?? ""; + message.points = object.points ?? "0"; + message.status = object.status ?? 0; + return message; + }, +}; + +function createBaseUnbondingStakingQueueEntry(): UnbondingStakingQueueEntry { + return { index: "0", staker: "", pool_id: "0", amount: "0", creation_time: "0" }; +} + +export const UnbondingStakingQueueEntry = { + encode(message: UnbondingStakingQueueEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + if (message.creation_time !== "0") { + writer.uint32(40).uint64(message.creation_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingStakingQueueEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingStakingQueueEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + case 5: + message.creation_time = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingStakingQueueEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? String(object.creation_time) : "0", + }; + }, + + toJSON(message: UnbondingStakingQueueEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.amount !== undefined && (obj.amount = message.amount); + message.creation_time !== undefined && (obj.creation_time = message.creation_time); + return obj; + }, + + fromPartial, I>>(object: I): UnbondingStakingQueueEntry { + const message = createBaseUnbondingStakingQueueEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.amount = object.amount ?? "0"; + message.creation_time = object.creation_time ?? "0"; + return message; + }, +}; + +function createBaseUnbondingStaker(): UnbondingStaker { + return { staker: "", pool_id: "0", unbonding_amount: "0" }; +} + +export const UnbondingStaker = { + encode(message: UnbondingStaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + if (message.unbonding_amount !== "0") { + writer.uint32(24).uint64(message.unbonding_amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingStaker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 3: + message.unbonding_amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingStaker { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + unbonding_amount: isSet(object.unbonding_amount) ? String(object.unbonding_amount) : "0", + }; + }, + + toJSON(message: UnbondingStaker): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.unbonding_amount !== undefined && (obj.unbonding_amount = message.unbonding_amount); + return obj; + }, + + fromPartial, I>>(object: I): UnbondingStaker { + const message = createBaseUnbondingStaker(); + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.unbonding_amount = object.unbonding_amount ?? "0"; + return message; + }, +}; + +function createBaseUnbondingStakingQueueState(): UnbondingStakingQueueState { + return { low_index: "0", high_index: "0" }; +} + +export const UnbondingStakingQueueState = { + encode(message: UnbondingStakingQueueState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.low_index !== "0") { + writer.uint32(8).uint64(message.low_index); + } + if (message.high_index !== "0") { + writer.uint32(16).uint64(message.high_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingStakingQueueState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingStakingQueueState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.low_index = longToString(reader.uint64() as Long); + break; + case 2: + message.high_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingStakingQueueState { + return { + low_index: isSet(object.low_index) ? String(object.low_index) : "0", + high_index: isSet(object.high_index) ? String(object.high_index) : "0", + }; + }, + + toJSON(message: UnbondingStakingQueueState): unknown { + const obj: any = {}; + message.low_index !== undefined && (obj.low_index = message.low_index); + message.high_index !== undefined && (obj.high_index = message.high_index); + return obj; + }, + + fromPartial, I>>(object: I): UnbondingStakingQueueState { + const message = createBaseUnbondingStakingQueueState(); + message.low_index = object.low_index ?? "0"; + message.high_index = object.high_index ?? "0"; + return message; + }, +}; + +function createBaseUnbondingDelegationQueueEntry(): UnbondingDelegationQueueEntry { + return { index: "0", staker: "", delegator: "", pool_id: "0", amount: "0", creation_time: "0" }; +} + +export const UnbondingDelegationQueueEntry = { + encode(message: UnbondingDelegationQueueEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.delegator !== "") { + writer.uint32(26).string(message.delegator); + } + if (message.pool_id !== "0") { + writer.uint32(32).uint64(message.pool_id); + } + if (message.amount !== "0") { + writer.uint32(40).uint64(message.amount); + } + if (message.creation_time !== "0") { + writer.uint32(48).uint64(message.creation_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegationQueueEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationQueueEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.delegator = reader.string(); + break; + case 4: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 5: + message.amount = longToString(reader.uint64() as Long); + break; + case 6: + message.creation_time = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationQueueEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + delegator: isSet(object.delegator) ? String(object.delegator) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? String(object.creation_time) : "0", + }; + }, + + toJSON(message: UnbondingDelegationQueueEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.delegator !== undefined && (obj.delegator = message.delegator); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.amount !== undefined && (obj.amount = message.amount); + message.creation_time !== undefined && (obj.creation_time = message.creation_time); + return obj; + }, + + fromPartial, I>>( + object: I, + ): UnbondingDelegationQueueEntry { + const message = createBaseUnbondingDelegationQueueEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.delegator = object.delegator ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.amount = object.amount ?? "0"; + message.creation_time = object.creation_time ?? "0"; + return message; + }, +}; + +function createBaseUnbondingDelegationQueueState(): UnbondingDelegationQueueState { + return { low_index: "0", high_index: "0" }; +} + +export const UnbondingDelegationQueueState = { + encode(message: UnbondingDelegationQueueState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.low_index !== "0") { + writer.uint32(8).uint64(message.low_index); + } + if (message.high_index !== "0") { + writer.uint32(16).uint64(message.high_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegationQueueState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationQueueState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.low_index = longToString(reader.uint64() as Long); + break; + case 2: + message.high_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationQueueState { + return { + low_index: isSet(object.low_index) ? String(object.low_index) : "0", + high_index: isSet(object.high_index) ? String(object.high_index) : "0", + }; + }, + + toJSON(message: UnbondingDelegationQueueState): unknown { + const obj: any = {}; + message.low_index !== undefined && (obj.low_index = message.low_index); + message.high_index !== undefined && (obj.high_index = message.high_index); + return obj; + }, + + fromPartial, I>>( + object: I, + ): UnbondingDelegationQueueState { + const message = createBaseUnbondingDelegationQueueState(); + message.low_index = object.low_index ?? "0"; + message.high_index = object.high_index ?? "0"; + return message; + }, +}; + +function createBaseRedelegationCooldown(): RedelegationCooldown { + return { address: "", creation_date: "0" }; +} + +export const RedelegationCooldown = { + encode(message: RedelegationCooldown, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.creation_date !== "0") { + writer.uint32(16).uint64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationCooldown { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationCooldown(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.creation_date = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RedelegationCooldown { + return { + address: isSet(object.address) ? String(object.address) : "", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: RedelegationCooldown): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): RedelegationCooldown { + const message = createBaseRedelegationCooldown(); + message.address = object.address ?? ""; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +function createBaseCommissionChangeQueueEntry(): CommissionChangeQueueEntry { + return { index: "0", staker: "", pool_id: "0", commission: "", creation_date: "0" }; +} + +export const CommissionChangeQueueEntry = { + encode(message: CommissionChangeQueueEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.commission !== "") { + writer.uint32(34).string(message.commission); + } + if (message.creation_date !== "0") { + writer.uint32(40).int64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeQueueEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionChangeQueueEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.commission = reader.string(); + break; + case 5: + message.creation_date = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommissionChangeQueueEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + commission: isSet(object.commission) ? String(object.commission) : "", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: CommissionChangeQueueEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.commission !== undefined && (obj.commission = message.commission); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): CommissionChangeQueueEntry { + const message = createBaseCommissionChangeQueueEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.commission = object.commission ?? ""; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +function createBaseCommissionChangeQueueState(): CommissionChangeQueueState { + return { low_index: "0", high_index: "0" }; +} + +export const CommissionChangeQueueState = { + encode(message: CommissionChangeQueueState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.low_index !== "0") { + writer.uint32(8).uint64(message.low_index); + } + if (message.high_index !== "0") { + writer.uint32(16).uint64(message.high_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeQueueState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionChangeQueueState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.low_index = longToString(reader.uint64() as Long); + break; + case 2: + message.high_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommissionChangeQueueState { + return { + low_index: isSet(object.low_index) ? String(object.low_index) : "0", + high_index: isSet(object.high_index) ? String(object.high_index) : "0", + }; + }, + + toJSON(message: CommissionChangeQueueState): unknown { + const obj: any = {}; + message.low_index !== undefined && (obj.low_index = message.low_index); + message.high_index !== undefined && (obj.high_index = message.high_index); + return obj; + }, + + fromPartial, I>>(object: I): CommissionChangeQueueState { + const message = createBaseCommissionChangeQueueState(); + message.low_index = object.low_index ?? "0"; + message.high_index = object.high_index ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/stakers/v1beta1/events.ts b/common/types/src/client/kyve/stakers/v1beta1/events.ts new file mode 100644 index 00000000..a780e91b --- /dev/null +++ b/common/types/src/client/kyve/stakers/v1beta1/events.ts @@ -0,0 +1,418 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** + * EventCreateStaker is an event emitted when a protocol node stakes in a pool. + * emitted_by: MsgCreateStaker + */ +export interface EventCreateStaker { + /** staker is the account address of the protocol node. */ + staker: string; + /** amount ... */ + amount: string; +} + +/** + * EventUpdateMetadata is an event emitted when a protocol node updates their metadata. + * emitted_by: MsgUpdateMetadata + */ +export interface EventUpdateMetadata { + /** staker is the account address of the protocol node. */ + staker: string; + /** moniker ... */ + moniker: string; + /** website ... */ + website: string; + /** logo ... */ + logo: string; +} + +/** + * EventUpdateCommission ... + * emitted_by: EndBlock + */ +export interface EventUpdateCommission { + /** staker is the account address of the protocol node. */ + staker: string; + /** commission ... */ + commission: string; +} + +/** + * EventJoinPool ... + * emitted_by: MsgJoinPool + */ +export interface EventJoinPool { + /** pool_id ... */ + pool_id: string; + /** staker ... */ + staker: string; + /** valaddress ... */ + valaddress: string; + /** amount ... */ + amount: string; +} + +/** + * EventLeavePool ... + * emitted_by: EndBlock + */ +export interface EventLeavePool { + /** pool_id ... */ + pool_id: string; + /** staker ... */ + staker: string; +} + +function createBaseEventCreateStaker(): EventCreateStaker { + return { staker: "", amount: "0" }; +} + +export const EventCreateStaker = { + encode(message: EventCreateStaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(16).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateStaker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreateStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventCreateStaker { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventCreateStaker): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventCreateStaker { + const message = createBaseEventCreateStaker(); + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventUpdateMetadata(): EventUpdateMetadata { + return { staker: "", moniker: "", website: "", logo: "" }; +} + +export const EventUpdateMetadata = { + encode(message: EventUpdateMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.moniker !== "") { + writer.uint32(18).string(message.moniker); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateMetadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.moniker = reader.string(); + break; + case 3: + message.website = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventUpdateMetadata { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + moniker: isSet(object.moniker) ? String(object.moniker) : "", + website: isSet(object.website) ? String(object.website) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + }; + }, + + toJSON(message: EventUpdateMetadata): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.website !== undefined && (obj.website = message.website); + message.logo !== undefined && (obj.logo = message.logo); + return obj; + }, + + fromPartial, I>>(object: I): EventUpdateMetadata { + const message = createBaseEventUpdateMetadata(); + message.staker = object.staker ?? ""; + message.moniker = object.moniker ?? ""; + message.website = object.website ?? ""; + message.logo = object.logo ?? ""; + return message; + }, +}; + +function createBaseEventUpdateCommission(): EventUpdateCommission { + return { staker: "", commission: "" }; +} + +export const EventUpdateCommission = { + encode(message: EventUpdateCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.commission !== "") { + writer.uint32(18).string(message.commission); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateCommission { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.commission = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventUpdateCommission { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + commission: isSet(object.commission) ? String(object.commission) : "", + }; + }, + + toJSON(message: EventUpdateCommission): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.commission !== undefined && (obj.commission = message.commission); + return obj; + }, + + fromPartial, I>>(object: I): EventUpdateCommission { + const message = createBaseEventUpdateCommission(); + message.staker = object.staker ?? ""; + message.commission = object.commission ?? ""; + return message; + }, +}; + +function createBaseEventJoinPool(): EventJoinPool { + return { pool_id: "0", staker: "", valaddress: "", amount: "0" }; +} + +export const EventJoinPool = { + encode(message: EventJoinPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.valaddress !== "") { + writer.uint32(26).string(message.valaddress); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventJoinPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventJoinPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.valaddress = reader.string(); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventJoinPool { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + valaddress: isSet(object.valaddress) ? String(object.valaddress) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventJoinPool): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.valaddress !== undefined && (obj.valaddress = message.valaddress); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventJoinPool { + const message = createBaseEventJoinPool(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.valaddress = object.valaddress ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventLeavePool(): EventLeavePool { + return { pool_id: "0", staker: "" }; +} + +export const EventLeavePool = { + encode(message: EventLeavePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventLeavePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventLeavePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventLeavePool { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + }; + }, + + toJSON(message: EventLeavePool): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + return obj; + }, + + fromPartial, I>>(object: I): EventLeavePool { + const message = createBaseEventLeavePool(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/stakers/v1beta1/genesis.ts b/common/types/src/client/kyve/stakers/v1beta1/genesis.ts new file mode 100644 index 00000000..792284ab --- /dev/null +++ b/common/types/src/client/kyve/stakers/v1beta1/genesis.ts @@ -0,0 +1,187 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./params"; +import { CommissionChangeEntry, LeavePoolEntry, QueueState, Staker, Valaccount } from "./stakers"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** GenesisState defines the stakers module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params?: Params; + /** staker_list ... */ + staker_list: Staker[]; + /** valaccount_list ... */ + valaccount_list: Valaccount[]; + /** commission_change_entries ... */ + commission_change_entries: CommissionChangeEntry[]; + /** queue_state_commission ... */ + queue_state_commission?: QueueState; + /** leave_pool_entries ... */ + leave_pool_entries: LeavePoolEntry[]; + /** queue_state_leave ... */ + queue_state_leave?: QueueState; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + staker_list: [], + valaccount_list: [], + commission_change_entries: [], + queue_state_commission: undefined, + leave_pool_entries: [], + queue_state_leave: undefined, + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.staker_list) { + Staker.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.valaccount_list) { + Valaccount.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.commission_change_entries) { + CommissionChangeEntry.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.queue_state_commission !== undefined) { + QueueState.encode(message.queue_state_commission, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.leave_pool_entries) { + LeavePoolEntry.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.queue_state_leave !== undefined) { + QueueState.encode(message.queue_state_leave, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.staker_list.push(Staker.decode(reader, reader.uint32())); + break; + case 3: + message.valaccount_list.push(Valaccount.decode(reader, reader.uint32())); + break; + case 4: + message.commission_change_entries.push(CommissionChangeEntry.decode(reader, reader.uint32())); + break; + case 5: + message.queue_state_commission = QueueState.decode(reader, reader.uint32()); + break; + case 6: + message.leave_pool_entries.push(LeavePoolEntry.decode(reader, reader.uint32())); + break; + case 7: + message.queue_state_leave = QueueState.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + staker_list: Array.isArray(object?.staker_list) ? object.staker_list.map((e: any) => Staker.fromJSON(e)) : [], + valaccount_list: Array.isArray(object?.valaccount_list) + ? object.valaccount_list.map((e: any) => Valaccount.fromJSON(e)) + : [], + commission_change_entries: Array.isArray(object?.commission_change_entries) + ? object.commission_change_entries.map((e: any) => CommissionChangeEntry.fromJSON(e)) + : [], + queue_state_commission: isSet(object.queue_state_commission) + ? QueueState.fromJSON(object.queue_state_commission) + : undefined, + leave_pool_entries: Array.isArray(object?.leave_pool_entries) + ? object.leave_pool_entries.map((e: any) => LeavePoolEntry.fromJSON(e)) + : [], + queue_state_leave: isSet(object.queue_state_leave) ? QueueState.fromJSON(object.queue_state_leave) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.staker_list) { + obj.staker_list = message.staker_list.map((e) => e ? Staker.toJSON(e) : undefined); + } else { + obj.staker_list = []; + } + if (message.valaccount_list) { + obj.valaccount_list = message.valaccount_list.map((e) => e ? Valaccount.toJSON(e) : undefined); + } else { + obj.valaccount_list = []; + } + if (message.commission_change_entries) { + obj.commission_change_entries = message.commission_change_entries.map((e) => + e ? CommissionChangeEntry.toJSON(e) : undefined + ); + } else { + obj.commission_change_entries = []; + } + message.queue_state_commission !== undefined && (obj.queue_state_commission = message.queue_state_commission + ? QueueState.toJSON(message.queue_state_commission) + : undefined); + if (message.leave_pool_entries) { + obj.leave_pool_entries = message.leave_pool_entries.map((e) => e ? LeavePoolEntry.toJSON(e) : undefined); + } else { + obj.leave_pool_entries = []; + } + message.queue_state_leave !== undefined && + (obj.queue_state_leave = message.queue_state_leave ? QueueState.toJSON(message.queue_state_leave) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.staker_list = object.staker_list?.map((e) => Staker.fromPartial(e)) || []; + message.valaccount_list = object.valaccount_list?.map((e) => Valaccount.fromPartial(e)) || []; + message.commission_change_entries = + object.commission_change_entries?.map((e) => CommissionChangeEntry.fromPartial(e)) || []; + message.queue_state_commission = + (object.queue_state_commission !== undefined && object.queue_state_commission !== null) + ? QueueState.fromPartial(object.queue_state_commission) + : undefined; + message.leave_pool_entries = object.leave_pool_entries?.map((e) => LeavePoolEntry.fromPartial(e)) || []; + message.queue_state_leave = (object.queue_state_leave !== undefined && object.queue_state_leave !== null) + ? QueueState.fromPartial(object.queue_state_leave) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/stakers/v1beta1/params.ts b/common/types/src/client/kyve/stakers/v1beta1/params.ts new file mode 100644 index 00000000..a7917aaa --- /dev/null +++ b/common/types/src/client/kyve/stakers/v1beta1/params.ts @@ -0,0 +1,95 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** Params defines the stakers module parameters. */ +export interface Params { + /** commission_change_time ... */ + commission_change_time: string; + /** commission_change_time ... */ + leave_pool_time: string; +} + +function createBaseParams(): Params { + return { commission_change_time: "0", leave_pool_time: "0" }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.commission_change_time !== "0") { + writer.uint32(8).uint64(message.commission_change_time); + } + if (message.leave_pool_time !== "0") { + writer.uint32(16).uint64(message.leave_pool_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.commission_change_time = longToString(reader.uint64() as Long); + break; + case 2: + message.leave_pool_time = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + commission_change_time: isSet(object.commission_change_time) ? String(object.commission_change_time) : "0", + leave_pool_time: isSet(object.leave_pool_time) ? String(object.leave_pool_time) : "0", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.commission_change_time !== undefined && (obj.commission_change_time = message.commission_change_time); + message.leave_pool_time !== undefined && (obj.leave_pool_time = message.leave_pool_time); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.commission_change_time = object.commission_change_time ?? "0"; + message.leave_pool_time = object.leave_pool_time ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/stakers/v1beta1/query.ts b/common/types/src/client/kyve/stakers/v1beta1/query.ts new file mode 100644 index 00000000..cea644b1 --- /dev/null +++ b/common/types/src/client/kyve/stakers/v1beta1/query.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./params"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.stakers.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/stakers/v1beta1/stakers.ts b/common/types/src/client/kyve/stakers/v1beta1/stakers.ts new file mode 100644 index 00000000..e4c1401c --- /dev/null +++ b/common/types/src/client/kyve/stakers/v1beta1/stakers.ts @@ -0,0 +1,512 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** + * Staker contains all metadata for a staker + * Every address can only create one staker (itself) + */ +export interface Staker { + /** address ... */ + address: string; + /** commission ... */ + commission: string; + /** moniker ... */ + moniker: string; + /** website ... */ + website: string; + /** logo ... */ + logo: string; +} + +/** + * Valaccount gets authorized by a staker to + * vote in a given pool by favor of the staker. + */ +export interface Valaccount { + /** + * pool_id defines the pool in which the address + * is allowed to vote in. + */ + pool_id: string; + /** staker is the address the valaccount is voting for. */ + staker: string; + /** + * valaddress is the account stored on the protocol + * node which votes for the staker in the given pool + */ + valaddress: string; + /** + * When a node is inactive (does not vote at all) + * A point is added, after a certain amount of points + * is reached the node gets kicked out. + */ + points: string; + /** isLeaving indicates if a staker is leaving the given pool. */ + is_leaving: boolean; +} + +/** + * CommissionChangeEntry stores the information for an + * upcoming commission change. A commission change is never + * instant, so delegators have time to redelegate in case + * they don't agree with the new commission. + */ +export interface CommissionChangeEntry { + /** + * index is needed for the queue-algorithm which + * processes the commission changes + */ + index: string; + /** staker is the address of the affected staker */ + staker: string; + /** + * commission is the new commission which will + * be applied after the waiting time is over. + */ + commission: string; + /** + * creation_date is the UNIX-timestamp in seconds + * when the entry was created. + */ + creation_date: string; +} + +/** + * LeavePoolEntry stores the information for an upcoming + * pool leave. A staker can't leave a pool instantly. + * Instead a the `LeaveTime` needs to be awaited. + * If a staker start to leave a pool, it will be shown + * in the UI to the delegators. + */ +export interface LeavePoolEntry { + /** index ... */ + index: string; + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** creation_date ... */ + creation_date: string; +} + +/** UnbondingState stores the state for the unbonding of stakes and delegations. */ +export interface QueueState { + /** + * low_index is the tail of the queue. It is the + * oldest entry in the queue. If this entry isn't + * due, non of the other entries is. + */ + low_index: string; + /** + * high_index is the head of the queue. New entries + * are added to the top. + */ + high_index: string; +} + +function createBaseStaker(): Staker { + return { address: "", commission: "", moniker: "", website: "", logo: "" }; +} + +export const Staker = { + encode(message: Staker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.commission !== "") { + writer.uint32(18).string(message.commission); + } + if (message.moniker !== "") { + writer.uint32(26).string(message.moniker); + } + if (message.website !== "") { + writer.uint32(34).string(message.website); + } + if (message.logo !== "") { + writer.uint32(42).string(message.logo); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Staker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.commission = reader.string(); + break; + case 3: + message.moniker = reader.string(); + break; + case 4: + message.website = reader.string(); + break; + case 5: + message.logo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Staker { + return { + address: isSet(object.address) ? String(object.address) : "", + commission: isSet(object.commission) ? String(object.commission) : "", + moniker: isSet(object.moniker) ? String(object.moniker) : "", + website: isSet(object.website) ? String(object.website) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + }; + }, + + toJSON(message: Staker): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.commission !== undefined && (obj.commission = message.commission); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.website !== undefined && (obj.website = message.website); + message.logo !== undefined && (obj.logo = message.logo); + return obj; + }, + + fromPartial, I>>(object: I): Staker { + const message = createBaseStaker(); + message.address = object.address ?? ""; + message.commission = object.commission ?? ""; + message.moniker = object.moniker ?? ""; + message.website = object.website ?? ""; + message.logo = object.logo ?? ""; + return message; + }, +}; + +function createBaseValaccount(): Valaccount { + return { pool_id: "0", staker: "", valaddress: "", points: "0", is_leaving: false }; +} + +export const Valaccount = { + encode(message: Valaccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.valaddress !== "") { + writer.uint32(26).string(message.valaddress); + } + if (message.points !== "0") { + writer.uint32(32).uint64(message.points); + } + if (message.is_leaving === true) { + writer.uint32(40).bool(message.is_leaving); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Valaccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValaccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.valaddress = reader.string(); + break; + case 4: + message.points = longToString(reader.uint64() as Long); + break; + case 5: + message.is_leaving = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Valaccount { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + valaddress: isSet(object.valaddress) ? String(object.valaddress) : "", + points: isSet(object.points) ? String(object.points) : "0", + is_leaving: isSet(object.is_leaving) ? Boolean(object.is_leaving) : false, + }; + }, + + toJSON(message: Valaccount): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.valaddress !== undefined && (obj.valaddress = message.valaddress); + message.points !== undefined && (obj.points = message.points); + message.is_leaving !== undefined && (obj.is_leaving = message.is_leaving); + return obj; + }, + + fromPartial, I>>(object: I): Valaccount { + const message = createBaseValaccount(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.valaddress = object.valaddress ?? ""; + message.points = object.points ?? "0"; + message.is_leaving = object.is_leaving ?? false; + return message; + }, +}; + +function createBaseCommissionChangeEntry(): CommissionChangeEntry { + return { index: "0", staker: "", commission: "", creation_date: "0" }; +} + +export const CommissionChangeEntry = { + encode(message: CommissionChangeEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.commission !== "") { + writer.uint32(26).string(message.commission); + } + if (message.creation_date !== "0") { + writer.uint32(32).int64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionChangeEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.commission = reader.string(); + break; + case 4: + message.creation_date = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommissionChangeEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + commission: isSet(object.commission) ? String(object.commission) : "", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: CommissionChangeEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.commission !== undefined && (obj.commission = message.commission); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): CommissionChangeEntry { + const message = createBaseCommissionChangeEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.commission = object.commission ?? ""; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +function createBaseLeavePoolEntry(): LeavePoolEntry { + return { index: "0", staker: "", pool_id: "0", creation_date: "0" }; +} + +export const LeavePoolEntry = { + encode(message: LeavePoolEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.creation_date !== "0") { + writer.uint32(32).int64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LeavePoolEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeavePoolEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.creation_date = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LeavePoolEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: LeavePoolEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): LeavePoolEntry { + const message = createBaseLeavePoolEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +function createBaseQueueState(): QueueState { + return { low_index: "0", high_index: "0" }; +} + +export const QueueState = { + encode(message: QueueState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.low_index !== "0") { + writer.uint32(8).uint64(message.low_index); + } + if (message.high_index !== "0") { + writer.uint32(16).uint64(message.high_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueueState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.low_index = longToString(reader.uint64() as Long); + break; + case 2: + message.high_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueueState { + return { + low_index: isSet(object.low_index) ? String(object.low_index) : "0", + high_index: isSet(object.high_index) ? String(object.high_index) : "0", + }; + }, + + toJSON(message: QueueState): unknown { + const obj: any = {}; + message.low_index !== undefined && (obj.low_index = message.low_index); + message.high_index !== undefined && (obj.high_index = message.high_index); + return obj; + }, + + fromPartial, I>>(object: I): QueueState { + const message = createBaseQueueState(); + message.low_index = object.low_index ?? "0"; + message.high_index = object.high_index ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/kyve/stakers/v1beta1/tx.ts b/common/types/src/client/kyve/stakers/v1beta1/tx.ts new file mode 100644 index 00000000..4b8624ef --- /dev/null +++ b/common/types/src/client/kyve/stakers/v1beta1/tx.ts @@ -0,0 +1,800 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** MsgStakePool defines a SDK message for staking in a pool. */ +export interface MsgCreateStaker { + /** creator ... */ + creator: string; + /** amount ... */ + amount: string; +} + +/** MsgStakePoolResponse defines the Msg/StakePool response type. */ +export interface MsgCreateStakerResponse { +} + +/** MsgUpdateMetadata defines a SDK message for claiming the uploader role. */ +export interface MsgUpdateMetadata { + /** creator ... */ + creator: string; + /** moniker ... */ + moniker: string; + /** website ... */ + website: string; + /** logo */ + logo: string; +} + +/** MsgUpdateMetadataResponse defines the Msg/MsgUpdateMetadata response type. */ +export interface MsgUpdateMetadataResponse { +} + +/** MsgUpdateCommission ... */ +export interface MsgUpdateCommission { + /** creator ... */ + creator: string; + /** commission ... */ + commission: string; +} + +/** MsgUpdateCommissionResponse ... */ +export interface MsgUpdateCommissionResponse { +} + +/** MsgJoinPool ... */ +export interface MsgJoinPool { + /** creator ... */ + creator: string; + /** pool_id ... */ + pool_id: string; + /** valaddress ... */ + valaddress: string; + /** amount ... */ + amount: string; +} + +/** MsgJoinPoolResponse ... */ +export interface MsgJoinPoolResponse { +} + +/** MsgLeavePool ... */ +export interface MsgLeavePool { + /** creator ... */ + creator: string; + /** pool_id ... */ + pool_id: string; +} + +/** MsgReactivateStakerResponse ... */ +export interface MsgLeavePoolResponse { +} + +/** MsgUpdateParams defines a SDK message for updating the module parameters. */ +export interface MsgUpdateParams { + /** authority is the address of the governance account. */ + authority: string; + /** payload defines the x/stakers parameters to update. */ + payload: string; +} + +/** MsgUpdateParamsResponse defines the Msg/UpdateParams response type. */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgCreateStaker(): MsgCreateStaker { + return { creator: "", amount: "0" }; +} + +export const MsgCreateStaker = { + encode(message: MsgCreateStaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.amount !== "0") { + writer.uint32(16).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateStaker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateStaker { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgCreateStaker): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateStaker { + const message = createBaseMsgCreateStaker(); + message.creator = object.creator ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgCreateStakerResponse(): MsgCreateStakerResponse { + return {}; +} + +export const MsgCreateStakerResponse = { + encode(_: MsgCreateStakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateStakerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateStakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCreateStakerResponse { + return {}; + }, + + toJSON(_: MsgCreateStakerResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCreateStakerResponse { + const message = createBaseMsgCreateStakerResponse(); + return message; + }, +}; + +function createBaseMsgUpdateMetadata(): MsgUpdateMetadata { + return { creator: "", moniker: "", website: "", logo: "" }; +} + +export const MsgUpdateMetadata = { + encode(message: MsgUpdateMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.moniker !== "") { + writer.uint32(18).string(message.moniker); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateMetadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.moniker = reader.string(); + break; + case 3: + message.website = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateMetadata { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + moniker: isSet(object.moniker) ? String(object.moniker) : "", + website: isSet(object.website) ? String(object.website) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + }; + }, + + toJSON(message: MsgUpdateMetadata): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.website !== undefined && (obj.website = message.website); + message.logo !== undefined && (obj.logo = message.logo); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateMetadata { + const message = createBaseMsgUpdateMetadata(); + message.creator = object.creator ?? ""; + message.moniker = object.moniker ?? ""; + message.website = object.website ?? ""; + message.logo = object.logo ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateMetadataResponse(): MsgUpdateMetadataResponse { + return {}; +} + +export const MsgUpdateMetadataResponse = { + encode(_: MsgUpdateMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateMetadataResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUpdateMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateMetadataResponse { + const message = createBaseMsgUpdateMetadataResponse(); + return message; + }, +}; + +function createBaseMsgUpdateCommission(): MsgUpdateCommission { + return { creator: "", commission: "" }; +} + +export const MsgUpdateCommission = { + encode(message: MsgUpdateCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.commission !== "") { + writer.uint32(18).string(message.commission); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateCommission { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.commission = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateCommission { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + commission: isSet(object.commission) ? String(object.commission) : "", + }; + }, + + toJSON(message: MsgUpdateCommission): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.commission !== undefined && (obj.commission = message.commission); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateCommission { + const message = createBaseMsgUpdateCommission(); + message.creator = object.creator ?? ""; + message.commission = object.commission ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateCommissionResponse(): MsgUpdateCommissionResponse { + return {}; +} + +export const MsgUpdateCommissionResponse = { + encode(_: MsgUpdateCommissionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateCommissionResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUpdateCommissionResponse { + return {}; + }, + + toJSON(_: MsgUpdateCommissionResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateCommissionResponse { + const message = createBaseMsgUpdateCommissionResponse(); + return message; + }, +}; + +function createBaseMsgJoinPool(): MsgJoinPool { + return { creator: "", pool_id: "0", valaddress: "", amount: "0" }; +} + +export const MsgJoinPool = { + encode(message: MsgJoinPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + if (message.valaddress !== "") { + writer.uint32(26).string(message.valaddress); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgJoinPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgJoinPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 3: + message.valaddress = reader.string(); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgJoinPool { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + valaddress: isSet(object.valaddress) ? String(object.valaddress) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgJoinPool): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.valaddress !== undefined && (obj.valaddress = message.valaddress); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgJoinPool { + const message = createBaseMsgJoinPool(); + message.creator = object.creator ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.valaddress = object.valaddress ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgJoinPoolResponse(): MsgJoinPoolResponse { + return {}; +} + +export const MsgJoinPoolResponse = { + encode(_: MsgJoinPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgJoinPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgJoinPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgJoinPoolResponse { + return {}; + }, + + toJSON(_: MsgJoinPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgJoinPoolResponse { + const message = createBaseMsgJoinPoolResponse(); + return message; + }, +}; + +function createBaseMsgLeavePool(): MsgLeavePool { + return { creator: "", pool_id: "0" }; +} + +export const MsgLeavePool = { + encode(message: MsgLeavePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeavePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeavePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgLeavePool { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + }; + }, + + toJSON(message: MsgLeavePool): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgLeavePool { + const message = createBaseMsgLeavePool(); + message.creator = object.creator ?? ""; + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +function createBaseMsgLeavePoolResponse(): MsgLeavePoolResponse { + return {}; +} + +export const MsgLeavePoolResponse = { + encode(_: MsgLeavePoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeavePoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeavePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgLeavePoolResponse { + return {}; + }, + + toJSON(_: MsgLeavePoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgLeavePoolResponse { + const message = createBaseMsgLeavePoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", payload: "" }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.payload !== "") { + writer.uint32(18).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** CreateStaker ... */ + CreateStaker(request: MsgCreateStaker): Promise; + /** UpdateMetadata ... */ + UpdateMetadata(request: MsgUpdateMetadata): Promise; + /** UpdateCommission ... */ + UpdateCommission(request: MsgUpdateCommission): Promise; + /** JoinPool ... */ + JoinPool(request: MsgJoinPool): Promise; + /** LeavePool ... */ + LeavePool(request: MsgLeavePool): Promise; + /** + * UpdateParams defines a governance operation for updating the x/stakers module + * parameters. The authority is hard-coded to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.stakers.v1beta1.Msg"; + this.rpc = rpc; + this.CreateStaker = this.CreateStaker.bind(this); + this.UpdateMetadata = this.UpdateMetadata.bind(this); + this.UpdateCommission = this.UpdateCommission.bind(this); + this.JoinPool = this.JoinPool.bind(this); + this.LeavePool = this.LeavePool.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + } + CreateStaker(request: MsgCreateStaker): Promise { + const data = MsgCreateStaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateStaker", data); + return promise.then((data) => MsgCreateStakerResponse.decode(new _m0.Reader(data))); + } + + UpdateMetadata(request: MsgUpdateMetadata): Promise { + const data = MsgUpdateMetadata.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateMetadata", data); + return promise.then((data) => MsgUpdateMetadataResponse.decode(new _m0.Reader(data))); + } + + UpdateCommission(request: MsgUpdateCommission): Promise { + const data = MsgUpdateCommission.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateCommission", data); + return promise.then((data) => MsgUpdateCommissionResponse.decode(new _m0.Reader(data))); + } + + JoinPool(request: MsgJoinPool): Promise { + const data = MsgJoinPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "JoinPool", data); + return promise.then((data) => MsgJoinPoolResponse.decode(new _m0.Reader(data))); + } + + LeavePool(request: MsgLeavePool): Promise { + const data = MsgLeavePool.encode(request).finish(); + const promise = this.rpc.request(this.service, "LeavePool", data); + return promise.then((data) => MsgLeavePoolResponse.decode(new _m0.Reader(data))); + } + + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/abci/types.ts b/common/types/src/client/tendermint/abci/types.ts new file mode 100644 index 00000000..2e7cfd14 --- /dev/null +++ b/common/types/src/client/tendermint/abci/types.ts @@ -0,0 +1,4121 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { PublicKey } from "../crypto/keys"; +import { ProofOps } from "../crypto/proof"; +import { EvidenceParams, ValidatorParams, VersionParams } from "../types/params"; +import { Header } from "../types/types"; + +export const protobufPackage = "tendermint.abci"; + +export enum CheckTxType { + NEW = 0, + RECHECK = 1, + UNRECOGNIZED = -1, +} + +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 EvidenceType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1, +} + +export function evidenceTypeFromJSON(object: any): EvidenceType { + switch (object) { + case 0: + case "UNKNOWN": + return EvidenceType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return EvidenceType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return EvidenceType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return EvidenceType.UNRECOGNIZED; + } +} + +export function evidenceTypeToJSON(object: EvidenceType): string { + switch (object) { + case EvidenceType.UNKNOWN: + return "UNKNOWN"; + case EvidenceType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case EvidenceType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case EvidenceType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Request { + echo?: RequestEcho | undefined; + flush?: RequestFlush | undefined; + info?: RequestInfo | undefined; + set_option?: RequestSetOption | undefined; + init_chain?: RequestInitChain | undefined; + query?: RequestQuery | undefined; + begin_block?: RequestBeginBlock | undefined; + check_tx?: RequestCheckTx | undefined; + deliver_tx?: RequestDeliverTx | undefined; + end_block?: RequestEndBlock | undefined; + commit?: RequestCommit | undefined; + list_snapshots?: RequestListSnapshots | undefined; + offer_snapshot?: RequestOfferSnapshot | undefined; + load_snapshot_chunk?: RequestLoadSnapshotChunk | undefined; + apply_snapshot_chunk?: RequestApplySnapshotChunk | undefined; +} + +export interface RequestEcho { + message: string; +} + +export interface RequestFlush { +} + +export interface RequestInfo { + version: string; + block_version: string; + p2p_version: string; +} + +/** nondeterministic */ +export interface RequestSetOption { + key: string; + value: string; +} + +export interface RequestInitChain { + time?: Date; + chain_id: string; + consensus_params?: ConsensusParams; + validators: ValidatorUpdate[]; + app_state_bytes: Uint8Array; + initial_height: string; +} + +export interface RequestQuery { + data: Uint8Array; + path: string; + height: string; + prove: boolean; +} + +export interface RequestBeginBlock { + hash: Uint8Array; + header?: Header; + last_commit_info?: LastCommitInfo; + byzantine_validators: Evidence[]; +} + +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} + +export interface RequestDeliverTx { + tx: Uint8Array; +} + +export interface RequestEndBlock { + height: string; +} + +export interface RequestCommit { +} + +/** lists available snapshots */ +export interface RequestListSnapshots { +} + +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot?: Snapshot; + /** light client-verified app hash for snapshot height */ + app_hash: Uint8Array; +} + +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: string; + format: number; + chunk: number; +} + +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} + +export interface Response { + exception?: ResponseException | undefined; + echo?: ResponseEcho | undefined; + flush?: ResponseFlush | undefined; + info?: ResponseInfo | undefined; + set_option?: ResponseSetOption | undefined; + init_chain?: ResponseInitChain | undefined; + query?: ResponseQuery | undefined; + begin_block?: ResponseBeginBlock | undefined; + check_tx?: ResponseCheckTx | undefined; + deliver_tx?: ResponseDeliverTx | undefined; + end_block?: ResponseEndBlock | undefined; + commit?: ResponseCommit | undefined; + list_snapshots?: ResponseListSnapshots | undefined; + offer_snapshot?: ResponseOfferSnapshot | undefined; + load_snapshot_chunk?: ResponseLoadSnapshotChunk | undefined; + apply_snapshot_chunk?: ResponseApplySnapshotChunk | undefined; +} + +/** nondeterministic */ +export interface ResponseException { + error: string; +} + +export interface ResponseEcho { + message: string; +} + +export interface ResponseFlush { +} + +export interface ResponseInfo { + data: string; + version: string; + app_version: string; + last_block_height: string; + last_block_app_hash: Uint8Array; +} + +/** nondeterministic */ +export interface ResponseSetOption { + code: number; + /** bytes data = 2; */ + log: string; + info: string; +} + +export interface ResponseInitChain { + consensus_params?: ConsensusParams; + validators: ValidatorUpdate[]; + app_hash: Uint8Array; +} + +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: string; + key: Uint8Array; + value: Uint8Array; + proof_ops?: ProofOps; + height: string; + codespace: string; +} + +export interface ResponseBeginBlock { + events: Event[]; +} + +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gas_wanted: string; + gas_used: string; + events: Event[]; + codespace: string; +} + +export interface ResponseDeliverTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gas_wanted: string; + gas_used: string; + events: Event[]; + codespace: string; +} + +export interface ResponseEndBlock { + validator_updates: ValidatorUpdate[]; + consensus_param_updates?: ConsensusParams; + events: Event[]; +} + +export interface ResponseCommit { + /** reserve 1 */ + data: Uint8Array; + retain_height: string; +} + +export interface ResponseListSnapshots { + snapshots: Snapshot[]; +} + +export interface ResponseOfferSnapshot { + result: ResponseOfferSnapshot_Result; +} + +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 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 interface ResponseLoadSnapshotChunk { + chunk: Uint8Array; +} + +export interface ResponseApplySnapshotChunk { + result: ResponseApplySnapshotChunk_Result; + /** Chunks to refetch and reapply */ + refetch_chunks: number[]; + /** Chunk senders to reject and ban */ + reject_senders: string[]; +} + +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 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"; + } +} + +/** + * ConsensusParams contains all consensus-relevant parameters + * that can be adjusted by the abci app + */ +export interface ConsensusParams { + block?: BlockParams; + evidence?: EvidenceParams; + validator?: ValidatorParams; + version?: VersionParams; +} + +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** Note: must be greater than 0 */ + max_bytes: string; + /** Note: must be greater or equal to -1 */ + max_gas: string; +} + +export interface LastCommitInfo { + round: number; + votes: VoteInfo[]; +} + +/** + * Event allows application developers to attach additional information to + * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} + +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: Uint8Array; + value: Uint8Array; + /** nondeterministic */ + index: boolean; +} + +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: string; + index: number; + tx: Uint8Array; + result?: ResponseDeliverTx; +} + +/** Validator */ +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: string; +} + +/** ValidatorUpdate */ +export interface ValidatorUpdate { + pub_key?: PublicKey; + power: string; +} + +/** VoteInfo */ +export interface VoteInfo { + validator?: Validator; + signed_last_block: boolean; +} + +export interface Evidence { + type: EvidenceType; + /** The offending validator */ + validator?: Validator; + /** The height when the offense occurred */ + height: string; + /** 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 + */ + total_voting_power: string; +} + +export interface Snapshot { + /** 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: Uint8Array; + /** Arbitrary application metadata */ + metadata: Uint8Array; +} + +function createBaseRequest(): Request { + return { + echo: undefined, + flush: undefined, + info: undefined, + set_option: undefined, + init_chain: undefined, + query: undefined, + begin_block: undefined, + check_tx: undefined, + deliver_tx: undefined, + end_block: undefined, + commit: undefined, + list_snapshots: undefined, + offer_snapshot: undefined, + load_snapshot_chunk: undefined, + apply_snapshot_chunk: undefined, + }; +} + +export const Request = { + encode(message: Request, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.set_option !== undefined) { + RequestSetOption.encode(message.set_option, writer.uint32(34).fork()).ldelim(); + } + if (message.init_chain !== undefined) { + RequestInitChain.encode(message.init_chain, writer.uint32(42).fork()).ldelim(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim(); + } + if (message.begin_block !== undefined) { + RequestBeginBlock.encode(message.begin_block, writer.uint32(58).fork()).ldelim(); + } + if (message.check_tx !== undefined) { + RequestCheckTx.encode(message.check_tx, writer.uint32(66).fork()).ldelim(); + } + if (message.deliver_tx !== undefined) { + RequestDeliverTx.encode(message.deliver_tx, writer.uint32(74).fork()).ldelim(); + } + if (message.end_block !== undefined) { + RequestEndBlock.encode(message.end_block, writer.uint32(82).fork()).ldelim(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim(); + } + if (message.list_snapshots !== undefined) { + RequestListSnapshots.encode(message.list_snapshots, writer.uint32(98).fork()).ldelim(); + } + if (message.offer_snapshot !== undefined) { + RequestOfferSnapshot.encode(message.offer_snapshot, writer.uint32(106).fork()).ldelim(); + } + if (message.load_snapshot_chunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.load_snapshot_chunk, writer.uint32(114).fork()).ldelim(); + } + if (message.apply_snapshot_chunk !== undefined) { + RequestApplySnapshotChunk.encode(message.apply_snapshot_chunk, writer.uint32(122).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Request { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 4: + message.set_option = RequestSetOption.decode(reader, reader.uint32()); + break; + case 5: + message.init_chain = RequestInitChain.decode(reader, reader.uint32()); + break; + case 6: + message.query = RequestQuery.decode(reader, reader.uint32()); + break; + case 7: + message.begin_block = RequestBeginBlock.decode(reader, reader.uint32()); + break; + case 8: + message.check_tx = RequestCheckTx.decode(reader, reader.uint32()); + break; + case 9: + message.deliver_tx = RequestDeliverTx.decode(reader, reader.uint32()); + break; + case 10: + message.end_block = RequestEndBlock.decode(reader, reader.uint32()); + break; + case 11: + message.commit = RequestCommit.decode(reader, reader.uint32()); + break; + case 12: + message.list_snapshots = RequestListSnapshots.decode(reader, reader.uint32()); + break; + case 13: + message.offer_snapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + break; + case 14: + message.load_snapshot_chunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 15: + message.apply_snapshot_chunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Request { + return { + echo: isSet(object.echo) ? RequestEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) ? RequestFlush.fromJSON(object.flush) : undefined, + info: isSet(object.info) ? RequestInfo.fromJSON(object.info) : undefined, + set_option: isSet(object.set_option) ? RequestSetOption.fromJSON(object.set_option) : undefined, + init_chain: isSet(object.init_chain) ? RequestInitChain.fromJSON(object.init_chain) : undefined, + query: isSet(object.query) ? RequestQuery.fromJSON(object.query) : undefined, + begin_block: isSet(object.begin_block) ? RequestBeginBlock.fromJSON(object.begin_block) : undefined, + check_tx: isSet(object.check_tx) ? RequestCheckTx.fromJSON(object.check_tx) : undefined, + deliver_tx: isSet(object.deliver_tx) ? RequestDeliverTx.fromJSON(object.deliver_tx) : undefined, + end_block: isSet(object.end_block) ? RequestEndBlock.fromJSON(object.end_block) : undefined, + commit: isSet(object.commit) ? RequestCommit.fromJSON(object.commit) : undefined, + list_snapshots: isSet(object.list_snapshots) ? RequestListSnapshots.fromJSON(object.list_snapshots) : undefined, + offer_snapshot: isSet(object.offer_snapshot) ? RequestOfferSnapshot.fromJSON(object.offer_snapshot) : undefined, + load_snapshot_chunk: isSet(object.load_snapshot_chunk) + ? RequestLoadSnapshotChunk.fromJSON(object.load_snapshot_chunk) + : undefined, + apply_snapshot_chunk: isSet(object.apply_snapshot_chunk) + ? RequestApplySnapshotChunk.fromJSON(object.apply_snapshot_chunk) + : undefined, + }; + }, + + toJSON(message: Request): unknown { + const obj: any = {}; + message.echo !== undefined && (obj.echo = message.echo ? RequestEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && (obj.flush = message.flush ? RequestFlush.toJSON(message.flush) : undefined); + message.info !== undefined && (obj.info = message.info ? RequestInfo.toJSON(message.info) : undefined); + message.set_option !== undefined && + (obj.set_option = message.set_option ? RequestSetOption.toJSON(message.set_option) : undefined); + message.init_chain !== undefined && + (obj.init_chain = message.init_chain ? RequestInitChain.toJSON(message.init_chain) : undefined); + message.query !== undefined && (obj.query = message.query ? RequestQuery.toJSON(message.query) : undefined); + message.begin_block !== undefined && + (obj.begin_block = message.begin_block ? RequestBeginBlock.toJSON(message.begin_block) : undefined); + message.check_tx !== undefined && + (obj.check_tx = message.check_tx ? RequestCheckTx.toJSON(message.check_tx) : undefined); + message.deliver_tx !== undefined && + (obj.deliver_tx = message.deliver_tx ? RequestDeliverTx.toJSON(message.deliver_tx) : undefined); + message.end_block !== undefined && + (obj.end_block = message.end_block ? RequestEndBlock.toJSON(message.end_block) : undefined); + message.commit !== undefined && (obj.commit = message.commit ? RequestCommit.toJSON(message.commit) : undefined); + message.list_snapshots !== undefined && + (obj.list_snapshots = message.list_snapshots ? RequestListSnapshots.toJSON(message.list_snapshots) : undefined); + message.offer_snapshot !== undefined && + (obj.offer_snapshot = message.offer_snapshot ? RequestOfferSnapshot.toJSON(message.offer_snapshot) : undefined); + message.load_snapshot_chunk !== undefined && (obj.load_snapshot_chunk = message.load_snapshot_chunk + ? RequestLoadSnapshotChunk.toJSON(message.load_snapshot_chunk) + : undefined); + message.apply_snapshot_chunk !== undefined && (obj.apply_snapshot_chunk = message.apply_snapshot_chunk + ? RequestApplySnapshotChunk.toJSON(message.apply_snapshot_chunk) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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.set_option = (object.set_option !== undefined && object.set_option !== null) + ? RequestSetOption.fromPartial(object.set_option) + : undefined; + message.init_chain = (object.init_chain !== undefined && object.init_chain !== null) + ? RequestInitChain.fromPartial(object.init_chain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? RequestQuery.fromPartial(object.query) + : undefined; + message.begin_block = (object.begin_block !== undefined && object.begin_block !== null) + ? RequestBeginBlock.fromPartial(object.begin_block) + : undefined; + message.check_tx = (object.check_tx !== undefined && object.check_tx !== null) + ? RequestCheckTx.fromPartial(object.check_tx) + : undefined; + message.deliver_tx = (object.deliver_tx !== undefined && object.deliver_tx !== null) + ? RequestDeliverTx.fromPartial(object.deliver_tx) + : undefined; + message.end_block = (object.end_block !== undefined && object.end_block !== null) + ? RequestEndBlock.fromPartial(object.end_block) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? RequestCommit.fromPartial(object.commit) + : undefined; + message.list_snapshots = (object.list_snapshots !== undefined && object.list_snapshots !== null) + ? RequestListSnapshots.fromPartial(object.list_snapshots) + : undefined; + message.offer_snapshot = (object.offer_snapshot !== undefined && object.offer_snapshot !== null) + ? RequestOfferSnapshot.fromPartial(object.offer_snapshot) + : undefined; + message.load_snapshot_chunk = (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) + ? RequestLoadSnapshotChunk.fromPartial(object.load_snapshot_chunk) + : undefined; + message.apply_snapshot_chunk = (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) + ? RequestApplySnapshotChunk.fromPartial(object.apply_snapshot_chunk) + : undefined; + return message; + }, +}; + +function createBaseRequestEcho(): RequestEcho { + return { message: "" }; +} + +export const RequestEcho = { + encode(message: RequestEcho, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): RequestEcho { + return { message: isSet(object.message) ? String(object.message) : "" }; + }, + + toJSON(message: RequestEcho): unknown { + const obj: any = {}; + message.message !== undefined && (obj.message = message.message); + return obj; + }, + + fromPartial, I>>(object: I): RequestEcho { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseRequestFlush(): RequestFlush { + return {}; +} + +export const RequestFlush = { + encode(_: RequestFlush, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): RequestFlush { + return {}; + }, + + toJSON(_: RequestFlush): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, +}; + +function createBaseRequestInfo(): RequestInfo { + return { version: "", block_version: "0", p2p_version: "0" }; +} + +export const RequestInfo = { + encode(message: RequestInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.block_version !== "0") { + writer.uint32(16).uint64(message.block_version); + } + if (message.p2p_version !== "0") { + writer.uint32(24).uint64(message.p2p_version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.block_version = longToString(reader.uint64() as Long); + break; + case 3: + message.p2p_version = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestInfo { + return { + version: isSet(object.version) ? String(object.version) : "", + block_version: isSet(object.block_version) ? String(object.block_version) : "0", + p2p_version: isSet(object.p2p_version) ? String(object.p2p_version) : "0", + }; + }, + + toJSON(message: RequestInfo): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.block_version !== undefined && (obj.block_version = message.block_version); + message.p2p_version !== undefined && (obj.p2p_version = message.p2p_version); + return obj; + }, + + fromPartial, I>>(object: I): RequestInfo { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.block_version = object.block_version ?? "0"; + message.p2p_version = object.p2p_version ?? "0"; + return message; + }, +}; + +function createBaseRequestSetOption(): RequestSetOption { + return { key: "", value: "" }; +} + +export const RequestSetOption = { + encode(message: RequestSetOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestSetOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestSetOption(); + 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; + }, + + fromJSON(object: any): RequestSetOption { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: RequestSetOption): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + fromPartial, I>>(object: I): RequestSetOption { + const message = createBaseRequestSetOption(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseRequestInitChain(): RequestInitChain { + return { + time: undefined, + chain_id: "", + consensus_params: undefined, + validators: [], + app_state_bytes: new Uint8Array(), + initial_height: "0", + }; +} + +export const RequestInitChain = { + encode(message: RequestInitChain, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); + } + if (message.chain_id !== "") { + writer.uint32(18).string(message.chain_id); + } + if (message.consensus_params !== undefined) { + ConsensusParams.encode(message.consensus_params, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.app_state_bytes.length !== 0) { + writer.uint32(42).bytes(message.app_state_bytes); + } + if (message.initial_height !== "0") { + writer.uint32(48).int64(message.initial_height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.chain_id = reader.string(); + break; + case 3: + message.consensus_params = ConsensusParams.decode(reader, reader.uint32()); + break; + case 4: + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 5: + message.app_state_bytes = reader.bytes(); + break; + case 6: + message.initial_height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestInitChain { + return { + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + chain_id: isSet(object.chain_id) ? String(object.chain_id) : "", + consensus_params: isSet(object.consensus_params) ? ConsensusParams.fromJSON(object.consensus_params) : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + app_state_bytes: isSet(object.app_state_bytes) ? bytesFromBase64(object.app_state_bytes) : new Uint8Array(), + initial_height: isSet(object.initial_height) ? String(object.initial_height) : "0", + }; + }, + + toJSON(message: RequestInitChain): unknown { + const obj: any = {}; + message.time !== undefined && (obj.time = message.time.toISOString()); + message.chain_id !== undefined && (obj.chain_id = message.chain_id); + message.consensus_params !== undefined && + (obj.consensus_params = message.consensus_params ? ConsensusParams.toJSON(message.consensus_params) : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? ValidatorUpdate.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.app_state_bytes !== undefined && + (obj.app_state_bytes = base64FromBytes( + message.app_state_bytes !== undefined ? message.app_state_bytes : new Uint8Array(), + )); + message.initial_height !== undefined && (obj.initial_height = message.initial_height); + return obj; + }, + + fromPartial, I>>(object: I): RequestInitChain { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chain_id = object.chain_id ?? ""; + message.consensus_params = (object.consensus_params !== undefined && object.consensus_params !== null) + ? ConsensusParams.fromPartial(object.consensus_params) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.app_state_bytes = object.app_state_bytes ?? new Uint8Array(); + message.initial_height = object.initial_height ?? "0"; + return message; + }, +}; + +function createBaseRequestQuery(): RequestQuery { + return { data: new Uint8Array(), path: "", height: "0", prove: false }; +} + +export const RequestQuery = { + encode(message: RequestQuery, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.height !== "0") { + writer.uint32(24).int64(message.height); + } + if (message.prove === true) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 4: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestQuery { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + path: isSet(object.path) ? String(object.path) : "", + height: isSet(object.height) ? String(object.height) : "0", + prove: isSet(object.prove) ? Boolean(object.prove) : false, + }; + }, + + toJSON(message: RequestQuery): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.path !== undefined && (obj.path = message.path); + message.height !== undefined && (obj.height = message.height); + message.prove !== undefined && (obj.prove = message.prove); + return obj; + }, + + fromPartial, I>>(object: I): RequestQuery { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(); + message.path = object.path ?? ""; + message.height = object.height ?? "0"; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseRequestBeginBlock(): RequestBeginBlock { + return { hash: new Uint8Array(), header: undefined, last_commit_info: undefined, byzantine_validators: [] }; +} + +export const RequestBeginBlock = { + encode(message: RequestBeginBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(18).fork()).ldelim(); + } + if (message.last_commit_info !== undefined) { + LastCommitInfo.encode(message.last_commit_info, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.byzantine_validators) { + Evidence.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestBeginBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.header = Header.decode(reader, reader.uint32()); + break; + case 3: + message.last_commit_info = LastCommitInfo.decode(reader, reader.uint32()); + break; + case 4: + message.byzantine_validators.push(Evidence.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestBeginBlock { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + last_commit_info: isSet(object.last_commit_info) ? LastCommitInfo.fromJSON(object.last_commit_info) : undefined, + byzantine_validators: Array.isArray(object?.byzantine_validators) + ? object.byzantine_validators.map((e: any) => Evidence.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RequestBeginBlock): unknown { + const obj: any = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.last_commit_info !== undefined && + (obj.last_commit_info = message.last_commit_info ? LastCommitInfo.toJSON(message.last_commit_info) : undefined); + if (message.byzantine_validators) { + obj.byzantine_validators = message.byzantine_validators.map((e) => e ? Evidence.toJSON(e) : undefined); + } else { + obj.byzantine_validators = []; + } + return obj; + }, + + fromPartial, I>>(object: I): RequestBeginBlock { + const message = createBaseRequestBeginBlock(); + message.hash = object.hash ?? new Uint8Array(); + message.header = (object.header !== undefined && object.header !== null) + ? Header.fromPartial(object.header) + : undefined; + message.last_commit_info = (object.last_commit_info !== undefined && object.last_commit_info !== null) + ? LastCommitInfo.fromPartial(object.last_commit_info) + : undefined; + message.byzantine_validators = object.byzantine_validators?.map((e) => Evidence.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRequestCheckTx(): RequestCheckTx { + return { tx: new Uint8Array(), type: 0 }; +} + +export const RequestCheckTx = { + encode(message: RequestCheckTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): RequestCheckTx { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + + toJSON(message: RequestCheckTx): unknown { + const obj: any = {}; + message.tx !== undefined && (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + message.type !== undefined && (obj.type = checkTxTypeToJSON(message.type)); + return obj; + }, + + fromPartial, I>>(object: I): RequestCheckTx { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(); + message.type = object.type ?? 0; + return message; + }, +}; + +function createBaseRequestDeliverTx(): RequestDeliverTx { + return { tx: new Uint8Array() }; +} + +export const RequestDeliverTx = { + encode(message: RequestDeliverTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestDeliverTx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestDeliverTx { + return { tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array() }; + }, + + toJSON(message: RequestDeliverTx): unknown { + const obj: any = {}; + message.tx !== undefined && (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): RequestDeliverTx { + const message = createBaseRequestDeliverTx(); + message.tx = object.tx ?? new Uint8Array(); + return message; + }, +}; + +function createBaseRequestEndBlock(): RequestEndBlock { + return { height: "0" }; +} + +export const RequestEndBlock = { + encode(message: RequestEndBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestEndBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestEndBlock { + return { height: isSet(object.height) ? String(object.height) : "0" }; + }, + + toJSON(message: RequestEndBlock): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>(object: I): RequestEndBlock { + const message = createBaseRequestEndBlock(); + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseRequestCommit(): RequestCommit { + return {}; +} + +export const RequestCommit = { + encode(_: RequestCommit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): RequestCommit { + return {}; + }, + + toJSON(_: RequestCommit): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, +}; + +function createBaseRequestListSnapshots(): RequestListSnapshots { + return {}; +} + +export const RequestListSnapshots = { + encode(_: RequestListSnapshots, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): RequestListSnapshots { + return {}; + }, + + toJSON(_: RequestListSnapshots): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; + +function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { + return { snapshot: undefined, app_hash: new Uint8Array() }; +} + +export const RequestOfferSnapshot = { + encode(message: RequestOfferSnapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); + } + if (message.app_hash.length !== 0) { + writer.uint32(18).bytes(message.app_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.app_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestOfferSnapshot { + return { + snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined, + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(), + }; + }, + + toJSON(message: RequestOfferSnapshot): unknown { + const obj: any = {}; + message.snapshot !== undefined && (obj.snapshot = message.snapshot ? Snapshot.toJSON(message.snapshot) : undefined); + message.app_hash !== undefined && + (obj.app_hash = base64FromBytes(message.app_hash !== undefined ? message.app_hash : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) + ? Snapshot.fromPartial(object.snapshot) + : undefined; + message.app_hash = object.app_hash ?? new Uint8Array(); + return message; + }, +}; + +function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { + return { height: "0", format: 0, chunk: 0 }; +} + +export const RequestLoadSnapshotChunk = { + encode(message: RequestLoadSnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "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: _m0.Reader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunk = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestLoadSnapshotChunk { + return { + height: isSet(object.height) ? String(object.height) : "0", + format: isSet(object.format) ? Number(object.format) : 0, + chunk: isSet(object.chunk) ? Number(object.chunk) : 0, + }; + }, + + toJSON(message: RequestLoadSnapshotChunk): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunk !== undefined && (obj.chunk = Math.round(message.chunk)); + return obj; + }, + + fromPartial, I>>(object: I): RequestLoadSnapshotChunk { + const message = createBaseRequestLoadSnapshotChunk(); + message.height = object.height ?? "0"; + message.format = object.format ?? 0; + message.chunk = object.chunk ?? 0; + return message; + }, +}; + +function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { + return { index: 0, chunk: new Uint8Array(), sender: "" }; +} + +export const RequestApplySnapshotChunk = { + encode(message: RequestApplySnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): RequestApplySnapshotChunk { + return { + index: isSet(object.index) ? Number(object.index) : 0, + chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(), + sender: isSet(object.sender) ? String(object.sender) : "", + }; + }, + + toJSON(message: RequestApplySnapshotChunk): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = Math.round(message.index)); + message.chunk !== undefined && + (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); + message.sender !== undefined && (obj.sender = message.sender); + return obj; + }, + + fromPartial, I>>(object: I): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(); + message.sender = object.sender ?? ""; + return message; + }, +}; + +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + set_option: undefined, + init_chain: undefined, + query: undefined, + begin_block: undefined, + check_tx: undefined, + deliver_tx: undefined, + end_block: undefined, + commit: undefined, + list_snapshots: undefined, + offer_snapshot: undefined, + load_snapshot_chunk: undefined, + apply_snapshot_chunk: undefined, + }; +} + +export const Response = { + encode(message: Response, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.set_option !== undefined) { + ResponseSetOption.encode(message.set_option, writer.uint32(42).fork()).ldelim(); + } + if (message.init_chain !== undefined) { + ResponseInitChain.encode(message.init_chain, writer.uint32(50).fork()).ldelim(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(58).fork()).ldelim(); + } + if (message.begin_block !== undefined) { + ResponseBeginBlock.encode(message.begin_block, writer.uint32(66).fork()).ldelim(); + } + if (message.check_tx !== undefined) { + ResponseCheckTx.encode(message.check_tx, writer.uint32(74).fork()).ldelim(); + } + if (message.deliver_tx !== undefined) { + ResponseDeliverTx.encode(message.deliver_tx, writer.uint32(82).fork()).ldelim(); + } + if (message.end_block !== undefined) { + ResponseEndBlock.encode(message.end_block, writer.uint32(90).fork()).ldelim(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(98).fork()).ldelim(); + } + if (message.list_snapshots !== undefined) { + ResponseListSnapshots.encode(message.list_snapshots, writer.uint32(106).fork()).ldelim(); + } + if (message.offer_snapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offer_snapshot, writer.uint32(114).fork()).ldelim(); + } + if (message.load_snapshot_chunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.load_snapshot_chunk, writer.uint32(122).fork()).ldelim(); + } + if (message.apply_snapshot_chunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.apply_snapshot_chunk, writer.uint32(130).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Response { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 5: + message.set_option = ResponseSetOption.decode(reader, reader.uint32()); + break; + case 6: + message.init_chain = ResponseInitChain.decode(reader, reader.uint32()); + break; + case 7: + message.query = ResponseQuery.decode(reader, reader.uint32()); + break; + case 8: + message.begin_block = ResponseBeginBlock.decode(reader, reader.uint32()); + break; + case 9: + message.check_tx = ResponseCheckTx.decode(reader, reader.uint32()); + break; + case 10: + message.deliver_tx = ResponseDeliverTx.decode(reader, reader.uint32()); + break; + case 11: + message.end_block = ResponseEndBlock.decode(reader, reader.uint32()); + break; + case 12: + message.commit = ResponseCommit.decode(reader, reader.uint32()); + break; + case 13: + message.list_snapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + break; + case 14: + message.offer_snapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + break; + case 15: + message.load_snapshot_chunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 16: + message.apply_snapshot_chunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Response { + return { + exception: isSet(object.exception) ? ResponseException.fromJSON(object.exception) : undefined, + echo: isSet(object.echo) ? ResponseEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) ? ResponseFlush.fromJSON(object.flush) : undefined, + info: isSet(object.info) ? ResponseInfo.fromJSON(object.info) : undefined, + set_option: isSet(object.set_option) ? ResponseSetOption.fromJSON(object.set_option) : undefined, + init_chain: isSet(object.init_chain) ? ResponseInitChain.fromJSON(object.init_chain) : undefined, + query: isSet(object.query) ? ResponseQuery.fromJSON(object.query) : undefined, + begin_block: isSet(object.begin_block) ? ResponseBeginBlock.fromJSON(object.begin_block) : undefined, + check_tx: isSet(object.check_tx) ? ResponseCheckTx.fromJSON(object.check_tx) : undefined, + deliver_tx: isSet(object.deliver_tx) ? ResponseDeliverTx.fromJSON(object.deliver_tx) : undefined, + end_block: isSet(object.end_block) ? ResponseEndBlock.fromJSON(object.end_block) : undefined, + commit: isSet(object.commit) ? ResponseCommit.fromJSON(object.commit) : undefined, + list_snapshots: isSet(object.list_snapshots) ? ResponseListSnapshots.fromJSON(object.list_snapshots) : undefined, + offer_snapshot: isSet(object.offer_snapshot) ? ResponseOfferSnapshot.fromJSON(object.offer_snapshot) : undefined, + load_snapshot_chunk: isSet(object.load_snapshot_chunk) + ? ResponseLoadSnapshotChunk.fromJSON(object.load_snapshot_chunk) + : undefined, + apply_snapshot_chunk: isSet(object.apply_snapshot_chunk) + ? ResponseApplySnapshotChunk.fromJSON(object.apply_snapshot_chunk) + : undefined, + }; + }, + + toJSON(message: Response): unknown { + const obj: any = {}; + message.exception !== undefined && + (obj.exception = message.exception ? ResponseException.toJSON(message.exception) : undefined); + message.echo !== undefined && (obj.echo = message.echo ? ResponseEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && (obj.flush = message.flush ? ResponseFlush.toJSON(message.flush) : undefined); + message.info !== undefined && (obj.info = message.info ? ResponseInfo.toJSON(message.info) : undefined); + message.set_option !== undefined && + (obj.set_option = message.set_option ? ResponseSetOption.toJSON(message.set_option) : undefined); + message.init_chain !== undefined && + (obj.init_chain = message.init_chain ? ResponseInitChain.toJSON(message.init_chain) : undefined); + message.query !== undefined && (obj.query = message.query ? ResponseQuery.toJSON(message.query) : undefined); + message.begin_block !== undefined && + (obj.begin_block = message.begin_block ? ResponseBeginBlock.toJSON(message.begin_block) : undefined); + message.check_tx !== undefined && + (obj.check_tx = message.check_tx ? ResponseCheckTx.toJSON(message.check_tx) : undefined); + message.deliver_tx !== undefined && + (obj.deliver_tx = message.deliver_tx ? ResponseDeliverTx.toJSON(message.deliver_tx) : undefined); + message.end_block !== undefined && + (obj.end_block = message.end_block ? ResponseEndBlock.toJSON(message.end_block) : undefined); + message.commit !== undefined && (obj.commit = message.commit ? ResponseCommit.toJSON(message.commit) : undefined); + message.list_snapshots !== undefined && + (obj.list_snapshots = message.list_snapshots ? ResponseListSnapshots.toJSON(message.list_snapshots) : undefined); + message.offer_snapshot !== undefined && + (obj.offer_snapshot = message.offer_snapshot ? ResponseOfferSnapshot.toJSON(message.offer_snapshot) : undefined); + message.load_snapshot_chunk !== undefined && (obj.load_snapshot_chunk = message.load_snapshot_chunk + ? ResponseLoadSnapshotChunk.toJSON(message.load_snapshot_chunk) + : undefined); + message.apply_snapshot_chunk !== undefined && (obj.apply_snapshot_chunk = message.apply_snapshot_chunk + ? ResponseApplySnapshotChunk.toJSON(message.apply_snapshot_chunk) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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.set_option = (object.set_option !== undefined && object.set_option !== null) + ? ResponseSetOption.fromPartial(object.set_option) + : undefined; + message.init_chain = (object.init_chain !== undefined && object.init_chain !== null) + ? ResponseInitChain.fromPartial(object.init_chain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ResponseQuery.fromPartial(object.query) + : undefined; + message.begin_block = (object.begin_block !== undefined && object.begin_block !== null) + ? ResponseBeginBlock.fromPartial(object.begin_block) + : undefined; + message.check_tx = (object.check_tx !== undefined && object.check_tx !== null) + ? ResponseCheckTx.fromPartial(object.check_tx) + : undefined; + message.deliver_tx = (object.deliver_tx !== undefined && object.deliver_tx !== null) + ? ResponseDeliverTx.fromPartial(object.deliver_tx) + : undefined; + message.end_block = (object.end_block !== undefined && object.end_block !== null) + ? ResponseEndBlock.fromPartial(object.end_block) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? ResponseCommit.fromPartial(object.commit) + : undefined; + message.list_snapshots = (object.list_snapshots !== undefined && object.list_snapshots !== null) + ? ResponseListSnapshots.fromPartial(object.list_snapshots) + : undefined; + message.offer_snapshot = (object.offer_snapshot !== undefined && object.offer_snapshot !== null) + ? ResponseOfferSnapshot.fromPartial(object.offer_snapshot) + : undefined; + message.load_snapshot_chunk = (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) + ? ResponseLoadSnapshotChunk.fromPartial(object.load_snapshot_chunk) + : undefined; + message.apply_snapshot_chunk = (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) + ? ResponseApplySnapshotChunk.fromPartial(object.apply_snapshot_chunk) + : undefined; + return message; + }, +}; + +function createBaseResponseException(): ResponseException { + return { error: "" }; +} + +export const ResponseException = { + encode(message: ResponseException, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ResponseException { + return { error: isSet(object.error) ? String(object.error) : "" }; + }, + + toJSON(message: ResponseException): unknown { + const obj: any = {}; + message.error !== undefined && (obj.error = message.error); + return obj; + }, + + fromPartial, I>>(object: I): ResponseException { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; + +function createBaseResponseEcho(): ResponseEcho { + return { message: "" }; +} + +export const ResponseEcho = { + encode(message: ResponseEcho, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ResponseEcho { + return { message: isSet(object.message) ? String(object.message) : "" }; + }, + + toJSON(message: ResponseEcho): unknown { + const obj: any = {}; + message.message !== undefined && (obj.message = message.message); + return obj; + }, + + fromPartial, I>>(object: I): ResponseEcho { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseResponseFlush(): ResponseFlush { + return {}; +} + +export const ResponseFlush = { + encode(_: ResponseFlush, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): ResponseFlush { + return {}; + }, + + toJSON(_: ResponseFlush): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, +}; + +function createBaseResponseInfo(): ResponseInfo { + return { data: "", version: "", app_version: "0", last_block_height: "0", last_block_app_hash: new Uint8Array() }; +} + +export const ResponseInfo = { + encode(message: ResponseInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.app_version !== "0") { + writer.uint32(24).uint64(message.app_version); + } + if (message.last_block_height !== "0") { + writer.uint32(32).int64(message.last_block_height); + } + if (message.last_block_app_hash.length !== 0) { + writer.uint32(42).bytes(message.last_block_app_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.app_version = longToString(reader.uint64() as Long); + break; + case 4: + message.last_block_height = longToString(reader.int64() as Long); + break; + case 5: + message.last_block_app_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseInfo { + return { + data: isSet(object.data) ? String(object.data) : "", + version: isSet(object.version) ? String(object.version) : "", + app_version: isSet(object.app_version) ? String(object.app_version) : "0", + last_block_height: isSet(object.last_block_height) ? String(object.last_block_height) : "0", + last_block_app_hash: isSet(object.last_block_app_hash) + ? bytesFromBase64(object.last_block_app_hash) + : new Uint8Array(), + }; + }, + + toJSON(message: ResponseInfo): unknown { + const obj: any = {}; + message.data !== undefined && (obj.data = message.data); + message.version !== undefined && (obj.version = message.version); + message.app_version !== undefined && (obj.app_version = message.app_version); + message.last_block_height !== undefined && (obj.last_block_height = message.last_block_height); + message.last_block_app_hash !== undefined && + (obj.last_block_app_hash = base64FromBytes( + message.last_block_app_hash !== undefined ? message.last_block_app_hash : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): ResponseInfo { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.app_version = object.app_version ?? "0"; + message.last_block_height = object.last_block_height ?? "0"; + message.last_block_app_hash = object.last_block_app_hash ?? new Uint8Array(); + return message; + }, +}; + +function createBaseResponseSetOption(): ResponseSetOption { + return { code: 0, log: "", info: "" }; +} + +export const ResponseSetOption = { + encode(message: ResponseSetOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseSetOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseSetOption(); + 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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseSetOption { + return { + code: isSet(object.code) ? Number(object.code) : 0, + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + }; + }, + + toJSON(message: ResponseSetOption): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + return obj; + }, + + fromPartial, I>>(object: I): ResponseSetOption { + const message = createBaseResponseSetOption(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + return message; + }, +}; + +function createBaseResponseInitChain(): ResponseInitChain { + return { consensus_params: undefined, validators: [], app_hash: new Uint8Array() }; +} + +export const ResponseInitChain = { + encode(message: ResponseInitChain, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.consensus_params !== undefined) { + ConsensusParams.encode(message.consensus_params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.app_hash.length !== 0) { + writer.uint32(26).bytes(message.app_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.consensus_params = ConsensusParams.decode(reader, reader.uint32()); + break; + case 2: + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 3: + message.app_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseInitChain { + return { + consensus_params: isSet(object.consensus_params) ? ConsensusParams.fromJSON(object.consensus_params) : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(), + }; + }, + + toJSON(message: ResponseInitChain): unknown { + const obj: any = {}; + message.consensus_params !== undefined && + (obj.consensus_params = message.consensus_params ? ConsensusParams.toJSON(message.consensus_params) : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? ValidatorUpdate.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.app_hash !== undefined && + (obj.app_hash = base64FromBytes(message.app_hash !== undefined ? message.app_hash : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): ResponseInitChain { + const message = createBaseResponseInitChain(); + message.consensus_params = (object.consensus_params !== undefined && object.consensus_params !== null) + ? ConsensusParams.fromPartial(object.consensus_params) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.app_hash = object.app_hash ?? new Uint8Array(); + return message; + }, +}; + +function createBaseResponseQuery(): ResponseQuery { + return { + code: 0, + log: "", + info: "", + index: "0", + key: new Uint8Array(), + value: new Uint8Array(), + proof_ops: undefined, + height: "0", + codespace: "", + }; +} + +export const ResponseQuery = { + encode(message: ResponseQuery, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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 !== "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.proof_ops !== undefined) { + ProofOps.encode(message.proof_ops, writer.uint32(66).fork()).ldelim(); + } + if (message.height !== "0") { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 6: + message.key = reader.bytes(); + break; + case 7: + message.value = reader.bytes(); + break; + case 8: + message.proof_ops = ProofOps.decode(reader, reader.uint32()); + break; + case 9: + message.height = longToString(reader.int64() as Long); + break; + case 10: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseQuery { + return { + code: isSet(object.code) ? Number(object.code) : 0, + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + index: isSet(object.index) ? String(object.index) : "0", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + proof_ops: isSet(object.proof_ops) ? ProofOps.fromJSON(object.proof_ops) : undefined, + height: isSet(object.height) ? String(object.height) : "0", + codespace: isSet(object.codespace) ? String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseQuery): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.index !== undefined && (obj.index = message.index); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.proof_ops !== undefined && + (obj.proof_ops = message.proof_ops ? ProofOps.toJSON(message.proof_ops) : undefined); + message.height !== undefined && (obj.height = message.height); + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + + fromPartial, I>>(object: I): ResponseQuery { + const message = createBaseResponseQuery(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index ?? "0"; + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.proof_ops = (object.proof_ops !== undefined && object.proof_ops !== null) + ? ProofOps.fromPartial(object.proof_ops) + : undefined; + message.height = object.height ?? "0"; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseBeginBlock(): ResponseBeginBlock { + return { events: [] }; +} + +export const ResponseBeginBlock = { + encode(message: ResponseBeginBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseBeginBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.events.push(Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseBeginBlock { + return { events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [] }; + }, + + toJSON(message: ResponseBeginBlock): unknown { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ResponseBeginBlock { + const message = createBaseResponseBeginBlock(); + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseResponseCheckTx(): ResponseCheckTx { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gas_wanted: "0", + gas_used: "0", + events: [], + codespace: "", + }; +} + +export const ResponseCheckTx = { + encode(message: ResponseCheckTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.gas_wanted !== "0") { + writer.uint32(40).int64(message.gas_wanted); + } + if (message.gas_used !== "0") { + writer.uint32(48).int64(message.gas_used); + } + 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: _m0.Reader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.gas_wanted = longToString(reader.int64() as Long); + break; + case 6: + message.gas_used = longToString(reader.int64() as Long); + 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; + }, + + fromJSON(object: any): ResponseCheckTx { + return { + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + gas_wanted: isSet(object.gas_wanted) ? String(object.gas_wanted) : "0", + gas_used: isSet(object.gas_used) ? String(object.gas_used) : "0", + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseCheckTx): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gas_wanted !== undefined && (obj.gas_wanted = message.gas_wanted); + message.gas_used !== undefined && (obj.gas_used = message.gas_used); + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + + fromPartial, I>>(object: I): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gas_wanted = object.gas_wanted ?? "0"; + message.gas_used = object.gas_used ?? "0"; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseDeliverTx(): ResponseDeliverTx { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gas_wanted: "0", + gas_used: "0", + events: [], + codespace: "", + }; +} + +export const ResponseDeliverTx = { + encode(message: ResponseDeliverTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.gas_wanted !== "0") { + writer.uint32(40).int64(message.gas_wanted); + } + if (message.gas_used !== "0") { + writer.uint32(48).int64(message.gas_used); + } + 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: _m0.Reader | Uint8Array, length?: number): ResponseDeliverTx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseDeliverTx(); + 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.gas_wanted = longToString(reader.int64() as Long); + break; + case 6: + message.gas_used = longToString(reader.int64() as Long); + 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; + }, + + fromJSON(object: any): ResponseDeliverTx { + return { + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + gas_wanted: isSet(object.gas_wanted) ? String(object.gas_wanted) : "0", + gas_used: isSet(object.gas_used) ? String(object.gas_used) : "0", + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseDeliverTx): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gas_wanted !== undefined && (obj.gas_wanted = message.gas_wanted); + message.gas_used !== undefined && (obj.gas_used = message.gas_used); + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + + fromPartial, I>>(object: I): ResponseDeliverTx { + const message = createBaseResponseDeliverTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gas_wanted = object.gas_wanted ?? "0"; + message.gas_used = object.gas_used ?? "0"; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseEndBlock(): ResponseEndBlock { + return { validator_updates: [], consensus_param_updates: undefined, events: [] }; +} + +export const ResponseEndBlock = { + encode(message: ResponseEndBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validator_updates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.consensus_param_updates !== undefined) { + ConsensusParams.encode(message.consensus_param_updates, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEndBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 2: + message.consensus_param_updates = ConsensusParams.decode(reader, reader.uint32()); + break; + case 3: + message.events.push(Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseEndBlock { + return { + validator_updates: Array.isArray(object?.validator_updates) + ? object.validator_updates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + consensus_param_updates: isSet(object.consensus_param_updates) + ? ConsensusParams.fromJSON(object.consensus_param_updates) + : undefined, + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + }; + }, + + toJSON(message: ResponseEndBlock): unknown { + const obj: any = {}; + if (message.validator_updates) { + obj.validator_updates = message.validator_updates.map((e) => e ? ValidatorUpdate.toJSON(e) : undefined); + } else { + obj.validator_updates = []; + } + message.consensus_param_updates !== undefined && (obj.consensus_param_updates = message.consensus_param_updates + ? ConsensusParams.toJSON(message.consensus_param_updates) + : undefined); + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ResponseEndBlock { + const message = createBaseResponseEndBlock(); + message.validator_updates = object.validator_updates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensus_param_updates = + (object.consensus_param_updates !== undefined && object.consensus_param_updates !== null) + ? ConsensusParams.fromPartial(object.consensus_param_updates) + : undefined; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseResponseCommit(): ResponseCommit { + return { data: new Uint8Array(), retain_height: "0" }; +} + +export const ResponseCommit = { + encode(message: ResponseCommit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.retain_height !== "0") { + writer.uint32(24).int64(message.retain_height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCommit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 2: + message.data = reader.bytes(); + break; + case 3: + message.retain_height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseCommit { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + retain_height: isSet(object.retain_height) ? String(object.retain_height) : "0", + }; + }, + + toJSON(message: ResponseCommit): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.retain_height !== undefined && (obj.retain_height = message.retain_height); + return obj; + }, + + fromPartial, I>>(object: I): ResponseCommit { + const message = createBaseResponseCommit(); + message.data = object.data ?? new Uint8Array(); + message.retain_height = object.retain_height ?? "0"; + return message; + }, +}; + +function createBaseResponseListSnapshots(): ResponseListSnapshots { + return { snapshots: [] }; +} + +export const ResponseListSnapshots = { + encode(message: ResponseListSnapshots, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.snapshots) { + Snapshot.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ResponseListSnapshots { + return { + snapshots: Array.isArray(object?.snapshots) ? object.snapshots.map((e: any) => Snapshot.fromJSON(e)) : [], + }; + }, + + toJSON(message: ResponseListSnapshots): unknown { + const obj: any = {}; + if (message.snapshots) { + obj.snapshots = message.snapshots.map((e) => e ? Snapshot.toJSON(e) : undefined); + } else { + obj.snapshots = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ResponseListSnapshots { + const message = createBaseResponseListSnapshots(); + message.snapshots = object.snapshots?.map((e) => Snapshot.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { + return { result: 0 }; +} + +export const ResponseOfferSnapshot = { + encode(message: ResponseOfferSnapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ResponseOfferSnapshot { + return { result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: ResponseOfferSnapshot): unknown { + const obj: any = {}; + message.result !== undefined && (obj.result = responseOfferSnapshot_ResultToJSON(message.result)); + return obj; + }, + + fromPartial, I>>(object: I): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, +}; + +function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { + return { chunk: new Uint8Array() }; +} + +export const ResponseLoadSnapshotChunk = { + encode(message: ResponseLoadSnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ResponseLoadSnapshotChunk { + return { chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array() }; + }, + + toJSON(message: ResponseLoadSnapshotChunk): unknown { + const obj: any = {}; + message.chunk !== undefined && + (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(); + return message; + }, +}; + +function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { + return { result: 0, refetch_chunks: [], reject_senders: [] }; +} + +export const ResponseApplySnapshotChunk = { + encode(message: ResponseApplySnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetch_chunks) { + writer.uint32(v); + } + writer.ldelim(); + for (const v of message.reject_senders) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.refetch_chunks.push(reader.uint32()); + } + } else { + message.refetch_chunks.push(reader.uint32()); + } + break; + case 3: + message.reject_senders.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseApplySnapshotChunk { + return { + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, + refetch_chunks: Array.isArray(object?.refetch_chunks) ? object.refetch_chunks.map((e: any) => Number(e)) : [], + reject_senders: Array.isArray(object?.reject_senders) ? object.reject_senders.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: ResponseApplySnapshotChunk): unknown { + const obj: any = {}; + message.result !== undefined && (obj.result = responseApplySnapshotChunk_ResultToJSON(message.result)); + if (message.refetch_chunks) { + obj.refetch_chunks = message.refetch_chunks.map((e) => Math.round(e)); + } else { + obj.refetch_chunks = []; + } + if (message.reject_senders) { + obj.reject_senders = message.reject_senders.map((e) => e); + } else { + obj.reject_senders = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetch_chunks = object.refetch_chunks?.map((e) => e) || []; + message.reject_senders = object.reject_senders?.map((e) => e) || []; + return message; + }, +}; + +function createBaseConsensusParams(): ConsensusParams { + return { block: undefined, evidence: undefined, validator: undefined, version: undefined }; +} + +export const ConsensusParams = { + encode(message: ConsensusParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ConsensusParams { + return { + block: isSet(object.block) ? BlockParams.fromJSON(object.block) : undefined, + evidence: isSet(object.evidence) ? EvidenceParams.fromJSON(object.evidence) : undefined, + validator: isSet(object.validator) ? ValidatorParams.fromJSON(object.validator) : undefined, + version: isSet(object.version) ? VersionParams.fromJSON(object.version) : undefined, + }; + }, + + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + message.block !== undefined && (obj.block = message.block ? BlockParams.toJSON(message.block) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? EvidenceParams.toJSON(message.evidence) : undefined); + message.validator !== undefined && + (obj.validator = message.validator ? ValidatorParams.toJSON(message.validator) : undefined); + message.version !== undefined && + (obj.version = message.version ? VersionParams.toJSON(message.version) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + return message; + }, +}; + +function createBaseBlockParams(): BlockParams { + return { max_bytes: "0", max_gas: "0" }; +} + +export const BlockParams = { + encode(message: BlockParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.max_bytes !== "0") { + writer.uint32(8).int64(message.max_bytes); + } + if (message.max_gas !== "0") { + writer.uint32(16).int64(message.max_gas); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.max_bytes = longToString(reader.int64() as Long); + break; + case 2: + message.max_gas = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BlockParams { + return { + max_bytes: isSet(object.max_bytes) ? String(object.max_bytes) : "0", + max_gas: isSet(object.max_gas) ? String(object.max_gas) : "0", + }; + }, + + toJSON(message: BlockParams): unknown { + const obj: any = {}; + message.max_bytes !== undefined && (obj.max_bytes = message.max_bytes); + message.max_gas !== undefined && (obj.max_gas = message.max_gas); + return obj; + }, + + fromPartial, I>>(object: I): BlockParams { + const message = createBaseBlockParams(); + message.max_bytes = object.max_bytes ?? "0"; + message.max_gas = object.max_gas ?? "0"; + return message; + }, +}; + +function createBaseLastCommitInfo(): LastCommitInfo { + return { round: 0, votes: [] }; +} + +export const LastCommitInfo = { + encode(message: LastCommitInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): LastCommitInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLastCommitInfo(); + 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; + }, + + fromJSON(object: any): LastCommitInfo { + return { + round: isSet(object.round) ? Number(object.round) : 0, + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: LastCommitInfo): unknown { + const obj: any = {}; + message.round !== undefined && (obj.round = Math.round(message.round)); + if (message.votes) { + obj.votes = message.votes.map((e) => e ? VoteInfo.toJSON(e) : undefined); + } else { + obj.votes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): LastCommitInfo { + const message = createBaseLastCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEvent(): Event { + return { type: "", attributes: [] }; +} + +export const Event = { + encode(message: Event, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Event { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Event { + return { + type: isSet(object.type) ? String(object.type) : "", + attributes: Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => EventAttribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + if (message.attributes) { + obj.attributes = message.attributes.map((e) => e ? EventAttribute.toJSON(e) : undefined); + } else { + obj.attributes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Event { + const message = createBaseEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map((e) => EventAttribute.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEventAttribute(): EventAttribute { + return { key: new Uint8Array(), value: new Uint8Array(), index: false }; +} + +export const EventAttribute = { + encode(message: EventAttribute, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.index === true) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.index = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventAttribute { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + index: isSet(object.index) ? Boolean(object.index) : false, + }; + }, + + toJSON(message: EventAttribute): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.index !== undefined && (obj.index = message.index); + return obj; + }, + + fromPartial, I>>(object: I): EventAttribute { + const message = createBaseEventAttribute(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.index = object.index ?? false; + return message; + }, +}; + +function createBaseTxResult(): TxResult { + return { height: "0", index: 0, tx: new Uint8Array(), result: undefined }; +} + +export const TxResult = { + encode(message: TxResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "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) { + ResponseDeliverTx.encode(message.result, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.index = reader.uint32(); + break; + case 3: + message.tx = reader.bytes(); + break; + case 4: + message.result = ResponseDeliverTx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TxResult { + return { + height: isSet(object.height) ? String(object.height) : "0", + index: isSet(object.index) ? Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + result: isSet(object.result) ? ResponseDeliverTx.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: TxResult): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.index !== undefined && (obj.index = Math.round(message.index)); + message.tx !== undefined && (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + message.result !== undefined && + (obj.result = message.result ? ResponseDeliverTx.toJSON(message.result) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): TxResult { + const message = createBaseTxResult(); + message.height = object.height ?? "0"; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(); + message.result = (object.result !== undefined && object.result !== null) + ? ResponseDeliverTx.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(), power: "0" }; +} + +export const Validator = { + encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.power !== "0") { + writer.uint32(24).int64(message.power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Validator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(), + power: isSet(object.power) ? String(object.power) : "0", + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + message.address !== undefined && + (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); + message.power !== undefined && (obj.power = message.power); + return obj; + }, + + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.power = object.power ?? "0"; + return message; + }, +}; + +function createBaseValidatorUpdate(): ValidatorUpdate { + return { pub_key: undefined, power: "0" }; +} + +export const ValidatorUpdate = { + encode(message: ValidatorUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pub_key !== undefined) { + PublicKey.encode(message.pub_key, writer.uint32(10).fork()).ldelim(); + } + if (message.power !== "0") { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.pub_key = PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.power = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorUpdate { + return { + pub_key: isSet(object.pub_key) ? PublicKey.fromJSON(object.pub_key) : undefined, + power: isSet(object.power) ? String(object.power) : "0", + }; + }, + + toJSON(message: ValidatorUpdate): unknown { + const obj: any = {}; + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? PublicKey.toJSON(message.pub_key) : undefined); + message.power !== undefined && (obj.power = message.power); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? PublicKey.fromPartial(object.pub_key) + : undefined; + message.power = object.power ?? "0"; + return message; + }, +}; + +function createBaseVoteInfo(): VoteInfo { + return { validator: undefined, signed_last_block: false }; +} + +export const VoteInfo = { + encode(message: VoteInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.signed_last_block === true) { + writer.uint32(16).bool(message.signed_last_block); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 2: + message.signed_last_block = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): VoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + signed_last_block: isSet(object.signed_last_block) ? Boolean(object.signed_last_block) : false, + }; + }, + + toJSON(message: VoteInfo): unknown { + const obj: any = {}; + message.validator !== undefined && + (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); + message.signed_last_block !== undefined && (obj.signed_last_block = message.signed_last_block); + return obj; + }, + + fromPartial, I>>(object: I): VoteInfo { + const message = createBaseVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.signed_last_block = object.signed_last_block ?? false; + return message; + }, +}; + +function createBaseEvidence(): Evidence { + return { type: 0, validator: undefined, height: "0", time: undefined, total_voting_power: "0" }; +} + +export const Evidence = { + encode(message: Evidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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 !== "0") { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.total_voting_power !== "0") { + writer.uint32(40).int64(message.total_voting_power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Evidence { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.type = reader.int32() as any; + break; + case 2: + message.validator = Validator.decode(reader, reader.uint32()); + break; + case 3: + message.height = longToString(reader.int64() as Long); + break; + case 4: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.total_voting_power = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Evidence { + return { + type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : 0, + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + height: isSet(object.height) ? String(object.height) : "0", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + total_voting_power: isSet(object.total_voting_power) ? String(object.total_voting_power) : "0", + }; + }, + + toJSON(message: Evidence): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = evidenceTypeToJSON(message.type)); + message.validator !== undefined && + (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); + message.height !== undefined && (obj.height = message.height); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.total_voting_power !== undefined && (obj.total_voting_power = message.total_voting_power); + return obj; + }, + + fromPartial, I>>(object: I): Evidence { + const message = createBaseEvidence(); + message.type = object.type ?? 0; + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.height = object.height ?? "0"; + message.time = object.time ?? undefined; + message.total_voting_power = object.total_voting_power ?? "0"; + return message; + }, +}; + +function createBaseSnapshot(): Snapshot { + return { height: "0", format: 0, chunks: 0, hash: new Uint8Array(), metadata: new Uint8Array() }; +} + +export const Snapshot = { + encode(message: Snapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "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: _m0.Reader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? String(object.height) : "0", + format: isSet(object.format) ? Number(object.format) : 0, + chunks: isSet(object.chunks) ? Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + metadata: isSet(object.metadata) ? bytesFromBase64(object.metadata) : new Uint8Array(), + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunks !== undefined && (obj.chunks = Math.round(message.chunks)); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.metadata !== undefined && + (obj.metadata = base64FromBytes(message.metadata !== undefined ? message.metadata : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): Snapshot { + const message = createBaseSnapshot(); + message.height = object.height ?? "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; + }, +}; + +export interface ABCIApplication { + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + SetOption(request: RequestSetOption): Promise; + DeliverTx(request: RequestDeliverTx): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + BeginBlock(request: RequestBeginBlock): Promise; + EndBlock(request: RequestEndBlock): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; +} + +export class ABCIApplicationClientImpl implements ABCIApplication { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "tendermint.abci.ABCIApplication"; + this.rpc = rpc; + this.Echo = this.Echo.bind(this); + this.Flush = this.Flush.bind(this); + this.Info = this.Info.bind(this); + this.SetOption = this.SetOption.bind(this); + this.DeliverTx = this.DeliverTx.bind(this); + this.CheckTx = this.CheckTx.bind(this); + this.Query = this.Query.bind(this); + this.Commit = this.Commit.bind(this); + this.InitChain = this.InitChain.bind(this); + this.BeginBlock = this.BeginBlock.bind(this); + this.EndBlock = this.EndBlock.bind(this); + this.ListSnapshots = this.ListSnapshots.bind(this); + this.OfferSnapshot = this.OfferSnapshot.bind(this); + this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); + this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + } + Echo(request: RequestEcho): Promise { + const data = RequestEcho.encode(request).finish(); + const promise = this.rpc.request(this.service, "Echo", data); + return promise.then((data) => ResponseEcho.decode(new _m0.Reader(data))); + } + + Flush(request: RequestFlush): Promise { + const data = RequestFlush.encode(request).finish(); + const promise = this.rpc.request(this.service, "Flush", data); + return promise.then((data) => ResponseFlush.decode(new _m0.Reader(data))); + } + + Info(request: RequestInfo): Promise { + const data = RequestInfo.encode(request).finish(); + const promise = this.rpc.request(this.service, "Info", data); + return promise.then((data) => ResponseInfo.decode(new _m0.Reader(data))); + } + + SetOption(request: RequestSetOption): Promise { + const data = RequestSetOption.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetOption", data); + return promise.then((data) => ResponseSetOption.decode(new _m0.Reader(data))); + } + + DeliverTx(request: RequestDeliverTx): Promise { + const data = RequestDeliverTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeliverTx", data); + return promise.then((data) => ResponseDeliverTx.decode(new _m0.Reader(data))); + } + + CheckTx(request: RequestCheckTx): Promise { + const data = RequestCheckTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "CheckTx", data); + return promise.then((data) => ResponseCheckTx.decode(new _m0.Reader(data))); + } + + Query(request: RequestQuery): Promise { + const data = RequestQuery.encode(request).finish(); + const promise = this.rpc.request(this.service, "Query", data); + return promise.then((data) => ResponseQuery.decode(new _m0.Reader(data))); + } + + Commit(request: RequestCommit): Promise { + const data = RequestCommit.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commit", data); + return promise.then((data) => ResponseCommit.decode(new _m0.Reader(data))); + } + + InitChain(request: RequestInitChain): Promise { + const data = RequestInitChain.encode(request).finish(); + const promise = this.rpc.request(this.service, "InitChain", data); + return promise.then((data) => ResponseInitChain.decode(new _m0.Reader(data))); + } + + BeginBlock(request: RequestBeginBlock): Promise { + const data = RequestBeginBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "BeginBlock", data); + return promise.then((data) => ResponseBeginBlock.decode(new _m0.Reader(data))); + } + + EndBlock(request: RequestEndBlock): Promise { + const data = RequestEndBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "EndBlock", data); + return promise.then((data) => ResponseEndBlock.decode(new _m0.Reader(data))); + } + + ListSnapshots(request: RequestListSnapshots): Promise { + const data = RequestListSnapshots.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListSnapshots", data); + return promise.then((data) => ResponseListSnapshots.decode(new _m0.Reader(data))); + } + + OfferSnapshot(request: RequestOfferSnapshot): Promise { + const data = RequestOfferSnapshot.encode(request).finish(); + const promise = this.rpc.request(this.service, "OfferSnapshot", data); + return promise.then((data) => ResponseOfferSnapshot.decode(new _m0.Reader(data))); + } + + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise { + const data = RequestLoadSnapshotChunk.encode(request).finish(); + const promise = this.rpc.request(this.service, "LoadSnapshotChunk", data); + return promise.then((data) => ResponseLoadSnapshotChunk.decode(new _m0.Reader(data))); + } + + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise { + const data = RequestApplySnapshotChunk.encode(request).finish(); + const promise = this.rpc.request(this.service, "ApplySnapshotChunk", data); + return promise.then((data) => ResponseApplySnapshotChunk.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/crypto/keys.ts b/common/types/src/client/tendermint/crypto/keys.ts new file mode 100644 index 00000000..a3f5f88f --- /dev/null +++ b/common/types/src/client/tendermint/crypto/keys.ts @@ -0,0 +1,129 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "tendermint.crypto"; + +/** PublicKey defines the keys available for use with Tendermint Validators */ +export interface PublicKey { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; +} + +function createBasePublicKey(): PublicKey { + return { ed25519: undefined, secp256k1: undefined }; +} + +export const PublicKey = { + encode(message: PublicKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PublicKey { + return { + ed25519: isSet(object.ed25519) ? bytesFromBase64(object.ed25519) : undefined, + secp256k1: isSet(object.secp256k1) ? bytesFromBase64(object.secp256k1) : undefined, + }; + }, + + toJSON(message: PublicKey): unknown { + const obj: any = {}; + message.ed25519 !== undefined && + (obj.ed25519 = message.ed25519 !== undefined ? base64FromBytes(message.ed25519) : undefined); + message.secp256k1 !== undefined && + (obj.secp256k1 = message.secp256k1 !== undefined ? base64FromBytes(message.secp256k1) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): PublicKey { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/crypto/proof.ts b/common/types/src/client/tendermint/crypto/proof.ts new file mode 100644 index 00000000..5c9e78de --- /dev/null +++ b/common/types/src/client/tendermint/crypto/proof.ts @@ -0,0 +1,436 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "tendermint.crypto"; + +export interface Proof { + total: string; + index: string; + leaf_hash: Uint8Array; + aunts: Uint8Array[]; +} + +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof?: Proof; +} + +export interface DominoOp { + key: string; + input: string; + output: string; +} + +/** + * 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; +} + +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOps { + ops: ProofOp[]; +} + +function createBaseProof(): Proof { + return { total: "0", index: "0", leaf_hash: new Uint8Array(), aunts: [] }; +} + +export const Proof = { + encode(message: Proof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.total !== "0") { + writer.uint32(8).int64(message.total); + } + if (message.index !== "0") { + writer.uint32(16).int64(message.index); + } + if (message.leaf_hash.length !== 0) { + writer.uint32(26).bytes(message.leaf_hash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Proof { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.index = longToString(reader.int64() as Long); + break; + case 3: + message.leaf_hash = reader.bytes(); + break; + case 4: + message.aunts.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Proof { + return { + total: isSet(object.total) ? String(object.total) : "0", + index: isSet(object.index) ? String(object.index) : "0", + leaf_hash: isSet(object.leaf_hash) ? bytesFromBase64(object.leaf_hash) : new Uint8Array(), + aunts: Array.isArray(object?.aunts) ? object.aunts.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Proof): unknown { + const obj: any = {}; + message.total !== undefined && (obj.total = message.total); + message.index !== undefined && (obj.index = message.index); + message.leaf_hash !== undefined && + (obj.leaf_hash = base64FromBytes(message.leaf_hash !== undefined ? message.leaf_hash : new Uint8Array())); + if (message.aunts) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.aunts = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Proof { + const message = createBaseProof(); + message.total = object.total ?? "0"; + message.index = object.index ?? "0"; + message.leaf_hash = object.leaf_hash ?? new Uint8Array(); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValueOp(): ValueOp { + return { key: new Uint8Array(), proof: undefined }; +} + +export const ValueOp = { + encode(message: ValueOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ValueOp { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: ValueOp): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseDominoOp(): DominoOp { + return { key: "", input: "", output: "" }; +} + +export const DominoOp = { + encode(message: DominoOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DominoOp { + return { + key: isSet(object.key) ? String(object.key) : "", + input: isSet(object.input) ? String(object.input) : "", + output: isSet(object.output) ? String(object.output) : "", + }; + }, + + toJSON(message: DominoOp): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.input !== undefined && (obj.input = message.input); + message.output !== undefined && (obj.output = message.output); + return obj; + }, + + fromPartial, I>>(object: I): DominoOp { + const message = createBaseDominoOp(); + message.key = object.key ?? ""; + message.input = object.input ?? ""; + message.output = object.output ?? ""; + return message; + }, +}; + +function createBaseProofOp(): ProofOp { + return { type: "", key: new Uint8Array(), data: new Uint8Array() }; +} + +export const ProofOp = { + encode(message: ProofOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps = { + encode(message: ProofOps, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ProofOps { + return { ops: Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops) { + obj.ops = message.ops.map((e) => e ? ProofOp.toJSON(e) : undefined); + } else { + obj.ops = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/libs/bits/types.ts b/common/types/src/client/tendermint/libs/bits/types.ts new file mode 100644 index 00000000..ddef8ae2 --- /dev/null +++ b/common/types/src/client/tendermint/libs/bits/types.ts @@ -0,0 +1,105 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "tendermint.libs.bits"; + +export interface BitArray { + bits: string; + elems: string[]; +} + +function createBaseBitArray(): BitArray { + return { bits: "0", elems: [] }; +} + +export const BitArray = { + encode(message: BitArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bits !== "0") { + writer.uint32(8).int64(message.bits); + } + writer.uint32(18).fork(); + for (const v of message.elems) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BitArray { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bits = longToString(reader.int64() as Long); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.elems.push(longToString(reader.uint64() as Long)); + } + } else { + message.elems.push(longToString(reader.uint64() as Long)); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BitArray { + return { + bits: isSet(object.bits) ? String(object.bits) : "0", + elems: Array.isArray(object?.elems) ? object.elems.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: BitArray): unknown { + const obj: any = {}; + message.bits !== undefined && (obj.bits = message.bits); + if (message.elems) { + obj.elems = message.elems.map((e) => e); + } else { + obj.elems = []; + } + return obj; + }, + + fromPartial, I>>(object: I): BitArray { + const message = createBaseBitArray(); + message.bits = object.bits ?? "0"; + message.elems = object.elems?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/p2p/types.ts b/common/types/src/client/tendermint/p2p/types.ts new file mode 100644 index 00000000..8c8f4f0c --- /dev/null +++ b/common/types/src/client/tendermint/p2p/types.ts @@ -0,0 +1,532 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; + +export const protobufPackage = "tendermint.p2p"; + +export interface ProtocolVersion { + p2p: string; + block: string; + app: string; +} + +export interface NodeInfo { + protocol_version?: ProtocolVersion; + node_id: string; + listen_addr: string; + network: string; + version: string; + channels: Uint8Array; + moniker: string; + other?: NodeInfoOther; +} + +export interface NodeInfoOther { + tx_index: string; + rpc_address: string; +} + +export interface PeerInfo { + id: string; + address_info: PeerAddressInfo[]; + last_connected?: Date; +} + +export interface PeerAddressInfo { + address: string; + last_dial_success?: Date; + last_dial_failure?: Date; + dial_failures: number; +} + +function createBaseProtocolVersion(): ProtocolVersion { + return { p2p: "0", block: "0", app: "0" }; +} + +export const ProtocolVersion = { + encode(message: ProtocolVersion, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.p2p !== "0") { + writer.uint32(8).uint64(message.p2p); + } + if (message.block !== "0") { + writer.uint32(16).uint64(message.block); + } + if (message.app !== "0") { + writer.uint32(24).uint64(message.app); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProtocolVersion { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProtocolVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.p2p = longToString(reader.uint64() as Long); + break; + case 2: + message.block = longToString(reader.uint64() as Long); + break; + case 3: + message.app = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ProtocolVersion { + return { + p2p: isSet(object.p2p) ? String(object.p2p) : "0", + block: isSet(object.block) ? String(object.block) : "0", + app: isSet(object.app) ? String(object.app) : "0", + }; + }, + + toJSON(message: ProtocolVersion): unknown { + const obj: any = {}; + message.p2p !== undefined && (obj.p2p = message.p2p); + message.block !== undefined && (obj.block = message.block); + message.app !== undefined && (obj.app = message.app); + return obj; + }, + + fromPartial, I>>(object: I): ProtocolVersion { + const message = createBaseProtocolVersion(); + message.p2p = object.p2p ?? "0"; + message.block = object.block ?? "0"; + message.app = object.app ?? "0"; + return message; + }, +}; + +function createBaseNodeInfo(): NodeInfo { + return { + protocol_version: undefined, + node_id: "", + listen_addr: "", + network: "", + version: "", + channels: new Uint8Array(), + moniker: "", + other: undefined, + }; +} + +export const NodeInfo = { + encode(message: NodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.protocol_version !== undefined) { + ProtocolVersion.encode(message.protocol_version, writer.uint32(10).fork()).ldelim(); + } + if (message.node_id !== "") { + writer.uint32(18).string(message.node_id); + } + if (message.listen_addr !== "") { + writer.uint32(26).string(message.listen_addr); + } + if (message.network !== "") { + writer.uint32(34).string(message.network); + } + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + if (message.channels.length !== 0) { + writer.uint32(50).bytes(message.channels); + } + if (message.moniker !== "") { + writer.uint32(58).string(message.moniker); + } + if (message.other !== undefined) { + NodeInfoOther.encode(message.other, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NodeInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.protocol_version = ProtocolVersion.decode(reader, reader.uint32()); + break; + case 2: + message.node_id = reader.string(); + break; + case 3: + message.listen_addr = reader.string(); + break; + case 4: + message.network = reader.string(); + break; + case 5: + message.version = reader.string(); + break; + case 6: + message.channels = reader.bytes(); + break; + case 7: + message.moniker = reader.string(); + break; + case 8: + message.other = NodeInfoOther.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NodeInfo { + return { + protocol_version: isSet(object.protocol_version) ? ProtocolVersion.fromJSON(object.protocol_version) : undefined, + node_id: isSet(object.node_id) ? String(object.node_id) : "", + listen_addr: isSet(object.listen_addr) ? String(object.listen_addr) : "", + network: isSet(object.network) ? String(object.network) : "", + version: isSet(object.version) ? String(object.version) : "", + channels: isSet(object.channels) ? bytesFromBase64(object.channels) : new Uint8Array(), + moniker: isSet(object.moniker) ? String(object.moniker) : "", + other: isSet(object.other) ? NodeInfoOther.fromJSON(object.other) : undefined, + }; + }, + + toJSON(message: NodeInfo): unknown { + const obj: any = {}; + message.protocol_version !== undefined && + (obj.protocol_version = message.protocol_version ? ProtocolVersion.toJSON(message.protocol_version) : undefined); + message.node_id !== undefined && (obj.node_id = message.node_id); + message.listen_addr !== undefined && (obj.listen_addr = message.listen_addr); + message.network !== undefined && (obj.network = message.network); + message.version !== undefined && (obj.version = message.version); + message.channels !== undefined && + (obj.channels = base64FromBytes(message.channels !== undefined ? message.channels : new Uint8Array())); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.other !== undefined && (obj.other = message.other ? NodeInfoOther.toJSON(message.other) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): NodeInfo { + const message = createBaseNodeInfo(); + message.protocol_version = (object.protocol_version !== undefined && object.protocol_version !== null) + ? ProtocolVersion.fromPartial(object.protocol_version) + : undefined; + message.node_id = object.node_id ?? ""; + message.listen_addr = object.listen_addr ?? ""; + message.network = object.network ?? ""; + message.version = object.version ?? ""; + message.channels = object.channels ?? new Uint8Array(); + message.moniker = object.moniker ?? ""; + message.other = (object.other !== undefined && object.other !== null) + ? NodeInfoOther.fromPartial(object.other) + : undefined; + return message; + }, +}; + +function createBaseNodeInfoOther(): NodeInfoOther { + return { tx_index: "", rpc_address: "" }; +} + +export const NodeInfoOther = { + encode(message: NodeInfoOther, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx_index !== "") { + writer.uint32(10).string(message.tx_index); + } + if (message.rpc_address !== "") { + writer.uint32(18).string(message.rpc_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NodeInfoOther { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeInfoOther(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx_index = reader.string(); + break; + case 2: + message.rpc_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NodeInfoOther { + return { + tx_index: isSet(object.tx_index) ? String(object.tx_index) : "", + rpc_address: isSet(object.rpc_address) ? String(object.rpc_address) : "", + }; + }, + + toJSON(message: NodeInfoOther): unknown { + const obj: any = {}; + message.tx_index !== undefined && (obj.tx_index = message.tx_index); + message.rpc_address !== undefined && (obj.rpc_address = message.rpc_address); + return obj; + }, + + fromPartial, I>>(object: I): NodeInfoOther { + const message = createBaseNodeInfoOther(); + message.tx_index = object.tx_index ?? ""; + message.rpc_address = object.rpc_address ?? ""; + return message; + }, +}; + +function createBasePeerInfo(): PeerInfo { + return { id: "", address_info: [], last_connected: undefined }; +} + +export const PeerInfo = { + encode(message: PeerInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + for (const v of message.address_info) { + PeerAddressInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.last_connected !== undefined) { + Timestamp.encode(toTimestamp(message.last_connected), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PeerInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.address_info.push(PeerAddressInfo.decode(reader, reader.uint32())); + break; + case 3: + message.last_connected = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PeerInfo { + return { + id: isSet(object.id) ? String(object.id) : "", + address_info: Array.isArray(object?.address_info) + ? object.address_info.map((e: any) => PeerAddressInfo.fromJSON(e)) + : [], + last_connected: isSet(object.last_connected) ? fromJsonTimestamp(object.last_connected) : undefined, + }; + }, + + toJSON(message: PeerInfo): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + if (message.address_info) { + obj.address_info = message.address_info.map((e) => e ? PeerAddressInfo.toJSON(e) : undefined); + } else { + obj.address_info = []; + } + message.last_connected !== undefined && (obj.last_connected = message.last_connected.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): PeerInfo { + const message = createBasePeerInfo(); + message.id = object.id ?? ""; + message.address_info = object.address_info?.map((e) => PeerAddressInfo.fromPartial(e)) || []; + message.last_connected = object.last_connected ?? undefined; + return message; + }, +}; + +function createBasePeerAddressInfo(): PeerAddressInfo { + return { address: "", last_dial_success: undefined, last_dial_failure: undefined, dial_failures: 0 }; +} + +export const PeerAddressInfo = { + encode(message: PeerAddressInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.last_dial_success !== undefined) { + Timestamp.encode(toTimestamp(message.last_dial_success), writer.uint32(18).fork()).ldelim(); + } + if (message.last_dial_failure !== undefined) { + Timestamp.encode(toTimestamp(message.last_dial_failure), writer.uint32(26).fork()).ldelim(); + } + if (message.dial_failures !== 0) { + writer.uint32(32).uint32(message.dial_failures); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PeerAddressInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeerAddressInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.last_dial_success = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.last_dial_failure = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 4: + message.dial_failures = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PeerAddressInfo { + return { + address: isSet(object.address) ? String(object.address) : "", + last_dial_success: isSet(object.last_dial_success) ? fromJsonTimestamp(object.last_dial_success) : undefined, + last_dial_failure: isSet(object.last_dial_failure) ? fromJsonTimestamp(object.last_dial_failure) : undefined, + dial_failures: isSet(object.dial_failures) ? Number(object.dial_failures) : 0, + }; + }, + + toJSON(message: PeerAddressInfo): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.last_dial_success !== undefined && (obj.last_dial_success = message.last_dial_success.toISOString()); + message.last_dial_failure !== undefined && (obj.last_dial_failure = message.last_dial_failure.toISOString()); + message.dial_failures !== undefined && (obj.dial_failures = Math.round(message.dial_failures)); + return obj; + }, + + fromPartial, I>>(object: I): PeerAddressInfo { + const message = createBasePeerAddressInfo(); + message.address = object.address ?? ""; + message.last_dial_success = object.last_dial_success ?? undefined; + message.last_dial_failure = object.last_dial_failure ?? undefined; + message.dial_failures = object.dial_failures ?? 0; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/types/block.ts b/common/types/src/client/tendermint/types/block.ts new file mode 100644 index 00000000..beb4c40b --- /dev/null +++ b/common/types/src/client/tendermint/types/block.ts @@ -0,0 +1,112 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { EvidenceList } from "./evidence"; +import { Commit, Data, Header } from "./types"; + +export const protobufPackage = "tendermint.types"; + +export interface Block { + header?: Header; + data?: Data; + evidence?: EvidenceList; + last_commit?: Commit; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, last_commit: undefined }; +} + +export const Block = { + encode(message: Block, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.last_commit !== undefined) { + Commit.encode(message.last_commit, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Block { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.last_commit = Commit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Block { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + data: isSet(object.data) ? Data.fromJSON(object.data) : undefined, + evidence: isSet(object.evidence) ? EvidenceList.fromJSON(object.evidence) : undefined, + last_commit: isSet(object.last_commit) ? Commit.fromJSON(object.last_commit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.data !== undefined && (obj.data = message.data ? Data.toJSON(message.data) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? EvidenceList.toJSON(message.evidence) : undefined); + message.last_commit !== undefined && + (obj.last_commit = message.last_commit ? Commit.toJSON(message.last_commit) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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.last_commit = (object.last_commit !== undefined && object.last_commit !== null) + ? Commit.fromPartial(object.last_commit) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/types/evidence.ts b/common/types/src/client/tendermint/types/evidence.ts new file mode 100644 index 00000000..d4d5ed66 --- /dev/null +++ b/common/types/src/client/tendermint/types/evidence.ts @@ -0,0 +1,394 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { LightBlock, Vote } from "./types"; +import { Validator } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +export interface Evidence { + duplicate_vote_evidence?: DuplicateVoteEvidence | undefined; + light_client_attack_evidence?: LightClientAttackEvidence | undefined; +} + +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidence { + vote_a?: Vote; + vote_b?: Vote; + total_voting_power: string; + validator_power: string; + timestamp?: Date; +} + +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidence { + conflicting_block?: LightBlock; + common_height: string; + byzantine_validators: Validator[]; + total_voting_power: string; + timestamp?: Date; +} + +export interface EvidenceList { + evidence: Evidence[]; +} + +function createBaseEvidence(): Evidence { + return { duplicate_vote_evidence: undefined, light_client_attack_evidence: undefined }; +} + +export const Evidence = { + encode(message: Evidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.duplicate_vote_evidence !== undefined) { + DuplicateVoteEvidence.encode(message.duplicate_vote_evidence, writer.uint32(10).fork()).ldelim(); + } + if (message.light_client_attack_evidence !== undefined) { + LightClientAttackEvidence.encode(message.light_client_attack_evidence, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Evidence { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.duplicate_vote_evidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); + break; + case 2: + message.light_client_attack_evidence = LightClientAttackEvidence.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Evidence { + return { + duplicate_vote_evidence: isSet(object.duplicate_vote_evidence) + ? DuplicateVoteEvidence.fromJSON(object.duplicate_vote_evidence) + : undefined, + light_client_attack_evidence: isSet(object.light_client_attack_evidence) + ? LightClientAttackEvidence.fromJSON(object.light_client_attack_evidence) + : undefined, + }; + }, + + toJSON(message: Evidence): unknown { + const obj: any = {}; + message.duplicate_vote_evidence !== undefined && (obj.duplicate_vote_evidence = message.duplicate_vote_evidence + ? DuplicateVoteEvidence.toJSON(message.duplicate_vote_evidence) + : undefined); + message.light_client_attack_evidence !== undefined && + (obj.light_client_attack_evidence = message.light_client_attack_evidence + ? LightClientAttackEvidence.toJSON(message.light_client_attack_evidence) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Evidence { + const message = createBaseEvidence(); + message.duplicate_vote_evidence = + (object.duplicate_vote_evidence !== undefined && object.duplicate_vote_evidence !== null) + ? DuplicateVoteEvidence.fromPartial(object.duplicate_vote_evidence) + : undefined; + message.light_client_attack_evidence = + (object.light_client_attack_evidence !== undefined && object.light_client_attack_evidence !== null) + ? LightClientAttackEvidence.fromPartial(object.light_client_attack_evidence) + : undefined; + return message; + }, +}; + +function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { + return { vote_a: undefined, vote_b: undefined, total_voting_power: "0", validator_power: "0", timestamp: undefined }; +} + +export const DuplicateVoteEvidence = { + encode(message: DuplicateVoteEvidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vote_a !== undefined) { + Vote.encode(message.vote_a, writer.uint32(10).fork()).ldelim(); + } + if (message.vote_b !== undefined) { + Vote.encode(message.vote_b, writer.uint32(18).fork()).ldelim(); + } + if (message.total_voting_power !== "0") { + writer.uint32(24).int64(message.total_voting_power); + } + if (message.validator_power !== "0") { + writer.uint32(32).int64(message.validator_power); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.vote_a = Vote.decode(reader, reader.uint32()); + break; + case 2: + message.vote_b = Vote.decode(reader, reader.uint32()); + break; + case 3: + message.total_voting_power = longToString(reader.int64() as Long); + break; + case 4: + message.validator_power = longToString(reader.int64() as Long); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DuplicateVoteEvidence { + return { + vote_a: isSet(object.vote_a) ? Vote.fromJSON(object.vote_a) : undefined, + vote_b: isSet(object.vote_b) ? Vote.fromJSON(object.vote_b) : undefined, + total_voting_power: isSet(object.total_voting_power) ? String(object.total_voting_power) : "0", + validator_power: isSet(object.validator_power) ? String(object.validator_power) : "0", + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: DuplicateVoteEvidence): unknown { + const obj: any = {}; + message.vote_a !== undefined && (obj.vote_a = message.vote_a ? Vote.toJSON(message.vote_a) : undefined); + message.vote_b !== undefined && (obj.vote_b = message.vote_b ? Vote.toJSON(message.vote_b) : undefined); + message.total_voting_power !== undefined && (obj.total_voting_power = message.total_voting_power); + message.validator_power !== undefined && (obj.validator_power = message.validator_power); + message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + message.vote_a = (object.vote_a !== undefined && object.vote_a !== null) + ? Vote.fromPartial(object.vote_a) + : undefined; + message.vote_b = (object.vote_b !== undefined && object.vote_b !== null) + ? Vote.fromPartial(object.vote_b) + : undefined; + message.total_voting_power = object.total_voting_power ?? "0"; + message.validator_power = object.validator_power ?? "0"; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { + return { + conflicting_block: undefined, + common_height: "0", + byzantine_validators: [], + total_voting_power: "0", + timestamp: undefined, + }; +} + +export const LightClientAttackEvidence = { + encode(message: LightClientAttackEvidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.conflicting_block !== undefined) { + LightBlock.encode(message.conflicting_block, writer.uint32(10).fork()).ldelim(); + } + if (message.common_height !== "0") { + writer.uint32(16).int64(message.common_height); + } + for (const v of message.byzantine_validators) { + Validator.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.total_voting_power !== "0") { + writer.uint32(32).int64(message.total_voting_power); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.conflicting_block = LightBlock.decode(reader, reader.uint32()); + break; + case 2: + message.common_height = longToString(reader.int64() as Long); + break; + case 3: + message.byzantine_validators.push(Validator.decode(reader, reader.uint32())); + break; + case 4: + message.total_voting_power = longToString(reader.int64() as Long); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LightClientAttackEvidence { + return { + conflicting_block: isSet(object.conflicting_block) ? LightBlock.fromJSON(object.conflicting_block) : undefined, + common_height: isSet(object.common_height) ? String(object.common_height) : "0", + byzantine_validators: Array.isArray(object?.byzantine_validators) + ? object.byzantine_validators.map((e: any) => Validator.fromJSON(e)) + : [], + total_voting_power: isSet(object.total_voting_power) ? String(object.total_voting_power) : "0", + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: LightClientAttackEvidence): unknown { + const obj: any = {}; + message.conflicting_block !== undefined && + (obj.conflicting_block = message.conflicting_block ? LightBlock.toJSON(message.conflicting_block) : undefined); + message.common_height !== undefined && (obj.common_height = message.common_height); + if (message.byzantine_validators) { + obj.byzantine_validators = message.byzantine_validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.byzantine_validators = []; + } + message.total_voting_power !== undefined && (obj.total_voting_power = message.total_voting_power); + message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + message.conflicting_block = (object.conflicting_block !== undefined && object.conflicting_block !== null) + ? LightBlock.fromPartial(object.conflicting_block) + : undefined; + message.common_height = object.common_height ?? "0"; + message.byzantine_validators = object.byzantine_validators?.map((e) => Validator.fromPartial(e)) || []; + message.total_voting_power = object.total_voting_power ?? "0"; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseEvidenceList(): EvidenceList { + return { evidence: [] }; +} + +export const EvidenceList = { + encode(message: EvidenceList, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.evidence) { + Evidence.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): EvidenceList { + return { evidence: Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Evidence.fromJSON(e)) : [] }; + }, + + toJSON(message: EvidenceList): unknown { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map((e) => e ? Evidence.toJSON(e) : undefined); + } else { + obj.evidence = []; + } + return obj; + }, + + fromPartial, I>>(object: I): EvidenceList { + const message = createBaseEvidenceList(); + message.evidence = object.evidence?.map((e) => Evidence.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/types/params.ts b/common/types/src/client/tendermint/types/params.ts new file mode 100644 index 00000000..c5e07f0b --- /dev/null +++ b/common/types/src/client/tendermint/types/params.ts @@ -0,0 +1,492 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "tendermint.types"; + +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParams { + block?: BlockParams; + evidence?: EvidenceParams; + validator?: ValidatorParams; + version?: VersionParams; +} + +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * 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; + /** + * Minimum time increment between consecutive blocks (in milliseconds) If the + * block header timestamp is ahead of the system clock, decrease this value. + * + * Not exposed to the application. + */ + time_iota_ms: string; +} + +/** 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}. + */ + 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?: 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 + */ + max_bytes: string; +} + +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pub_key_types: string[]; +} + +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app_version: string; +} + +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + block_max_bytes: string; + block_max_gas: string; +} + +function createBaseConsensusParams(): ConsensusParams { + return { block: undefined, evidence: undefined, validator: undefined, version: undefined }; +} + +export const ConsensusParams = { + encode(message: ConsensusParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ConsensusParams { + return { + block: isSet(object.block) ? BlockParams.fromJSON(object.block) : undefined, + evidence: isSet(object.evidence) ? EvidenceParams.fromJSON(object.evidence) : undefined, + validator: isSet(object.validator) ? ValidatorParams.fromJSON(object.validator) : undefined, + version: isSet(object.version) ? VersionParams.fromJSON(object.version) : undefined, + }; + }, + + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + message.block !== undefined && (obj.block = message.block ? BlockParams.toJSON(message.block) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? EvidenceParams.toJSON(message.evidence) : undefined); + message.validator !== undefined && + (obj.validator = message.validator ? ValidatorParams.toJSON(message.validator) : undefined); + message.version !== undefined && + (obj.version = message.version ? VersionParams.toJSON(message.version) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + return message; + }, +}; + +function createBaseBlockParams(): BlockParams { + return { max_bytes: "0", max_gas: "0", time_iota_ms: "0" }; +} + +export const BlockParams = { + encode(message: BlockParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.max_bytes !== "0") { + writer.uint32(8).int64(message.max_bytes); + } + if (message.max_gas !== "0") { + writer.uint32(16).int64(message.max_gas); + } + if (message.time_iota_ms !== "0") { + writer.uint32(24).int64(message.time_iota_ms); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.max_bytes = longToString(reader.int64() as Long); + break; + case 2: + message.max_gas = longToString(reader.int64() as Long); + break; + case 3: + message.time_iota_ms = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BlockParams { + return { + max_bytes: isSet(object.max_bytes) ? String(object.max_bytes) : "0", + max_gas: isSet(object.max_gas) ? String(object.max_gas) : "0", + time_iota_ms: isSet(object.time_iota_ms) ? String(object.time_iota_ms) : "0", + }; + }, + + toJSON(message: BlockParams): unknown { + const obj: any = {}; + message.max_bytes !== undefined && (obj.max_bytes = message.max_bytes); + message.max_gas !== undefined && (obj.max_gas = message.max_gas); + message.time_iota_ms !== undefined && (obj.time_iota_ms = message.time_iota_ms); + return obj; + }, + + fromPartial, I>>(object: I): BlockParams { + const message = createBaseBlockParams(); + message.max_bytes = object.max_bytes ?? "0"; + message.max_gas = object.max_gas ?? "0"; + message.time_iota_ms = object.time_iota_ms ?? "0"; + return message; + }, +}; + +function createBaseEvidenceParams(): EvidenceParams { + return { max_age_num_blocks: "0", max_age_duration: undefined, max_bytes: "0" }; +} + +export const EvidenceParams = { + encode(message: EvidenceParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.max_age_num_blocks !== "0") { + writer.uint32(8).int64(message.max_age_num_blocks); + } + if (message.max_age_duration !== undefined) { + Duration.encode(message.max_age_duration, writer.uint32(18).fork()).ldelim(); + } + if (message.max_bytes !== "0") { + writer.uint32(24).int64(message.max_bytes); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.max_age_num_blocks = longToString(reader.int64() as Long); + break; + case 2: + message.max_age_duration = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.max_bytes = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EvidenceParams { + return { + max_age_num_blocks: isSet(object.max_age_num_blocks) ? String(object.max_age_num_blocks) : "0", + max_age_duration: isSet(object.max_age_duration) ? Duration.fromJSON(object.max_age_duration) : undefined, + max_bytes: isSet(object.max_bytes) ? String(object.max_bytes) : "0", + }; + }, + + toJSON(message: EvidenceParams): unknown { + const obj: any = {}; + message.max_age_num_blocks !== undefined && (obj.max_age_num_blocks = message.max_age_num_blocks); + message.max_age_duration !== undefined && + (obj.max_age_duration = message.max_age_duration ? Duration.toJSON(message.max_age_duration) : undefined); + message.max_bytes !== undefined && (obj.max_bytes = message.max_bytes); + return obj; + }, + + fromPartial, I>>(object: I): EvidenceParams { + const message = createBaseEvidenceParams(); + message.max_age_num_blocks = object.max_age_num_blocks ?? "0"; + message.max_age_duration = (object.max_age_duration !== undefined && object.max_age_duration !== null) + ? Duration.fromPartial(object.max_age_duration) + : undefined; + message.max_bytes = object.max_bytes ?? "0"; + return message; + }, +}; + +function createBaseValidatorParams(): ValidatorParams { + return { pub_key_types: [] }; +} + +export const ValidatorParams = { + encode(message: ValidatorParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pub_key_types) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.pub_key_types.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorParams { + return { + pub_key_types: Array.isArray(object?.pub_key_types) ? object.pub_key_types.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: ValidatorParams): unknown { + const obj: any = {}; + if (message.pub_key_types) { + obj.pub_key_types = message.pub_key_types.map((e) => e); + } else { + obj.pub_key_types = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ValidatorParams { + const message = createBaseValidatorParams(); + message.pub_key_types = object.pub_key_types?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVersionParams(): VersionParams { + return { app_version: "0" }; +} + +export const VersionParams = { + encode(message: VersionParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.app_version !== "0") { + writer.uint32(8).uint64(message.app_version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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_version = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): VersionParams { + return { app_version: isSet(object.app_version) ? String(object.app_version) : "0" }; + }, + + toJSON(message: VersionParams): unknown { + const obj: any = {}; + message.app_version !== undefined && (obj.app_version = message.app_version); + return obj; + }, + + fromPartial, I>>(object: I): VersionParams { + const message = createBaseVersionParams(); + message.app_version = object.app_version ?? "0"; + return message; + }, +}; + +function createBaseHashedParams(): HashedParams { + return { block_max_bytes: "0", block_max_gas: "0" }; +} + +export const HashedParams = { + encode(message: HashedParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_max_bytes !== "0") { + writer.uint32(8).int64(message.block_max_bytes); + } + if (message.block_max_gas !== "0") { + writer.uint32(16).int64(message.block_max_gas); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.block_max_bytes = longToString(reader.int64() as Long); + break; + case 2: + message.block_max_gas = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): HashedParams { + return { + block_max_bytes: isSet(object.block_max_bytes) ? String(object.block_max_bytes) : "0", + block_max_gas: isSet(object.block_max_gas) ? String(object.block_max_gas) : "0", + }; + }, + + toJSON(message: HashedParams): unknown { + const obj: any = {}; + message.block_max_bytes !== undefined && (obj.block_max_bytes = message.block_max_bytes); + message.block_max_gas !== undefined && (obj.block_max_gas = message.block_max_gas); + return obj; + }, + + fromPartial, I>>(object: I): HashedParams { + const message = createBaseHashedParams(); + message.block_max_bytes = object.block_max_bytes ?? "0"; + message.block_max_gas = object.block_max_gas ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/types/types.ts b/common/types/src/client/tendermint/types/types.ts new file mode 100644 index 00000000..9cad789b --- /dev/null +++ b/common/types/src/client/tendermint/types/types.ts @@ -0,0 +1,1445 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Proof } from "../crypto/proof"; +import { Consensus } from "../version/types"; +import { ValidatorSet } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +/** BlockIdFlag indicates which BlcokID the signature is for */ +export enum BlockIDFlag { + BLOCK_ID_FLAG_UNKNOWN = 0, + BLOCK_ID_FLAG_ABSENT = 1, + BLOCK_ID_FLAG_COMMIT = 2, + BLOCK_ID_FLAG_NIL = 3, + UNRECOGNIZED = -1, +} + +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"; + } +} + +/** 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 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 Part { + index: number; + bytes: Uint8Array; + proof?: Proof; +} + +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + part_set_header?: PartSetHeader; +} + +/** Header defines the structure of a Tendermint block header. */ +export interface Header { + /** basic block info */ + version?: Consensus; + chain_id: string; + height: string; + time?: Date; + /** prev block info */ + last_block_id?: BlockID; + /** hashes of block data */ + last_commit_hash: Uint8Array; + /** transactions */ + data_hash: Uint8Array; + /** hashes from the app output from the prev block */ + validators_hash: Uint8Array; + /** validators for the next block */ + next_validators_hash: Uint8Array; + /** consensus params for current block */ + consensus_hash: Uint8Array; + /** state after txs from the previous block */ + app_hash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + last_results_hash: Uint8Array; + /** consensus info */ + evidence_hash: Uint8Array; + /** original proposer of the block */ + proposer_address: Uint8Array; +} + +/** 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[]; +} + +/** + * Vote represents a prevote, precommit, or commit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: string; + round: number; + /** zero if vote is nil. */ + block_id?: BlockID; + timestamp?: Date; + validator_address: Uint8Array; + validator_index: number; + signature: Uint8Array; +} + +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: string; + round: number; + block_id?: BlockID; + signatures: CommitSig[]; +} + +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + block_id_flag: BlockIDFlag; + validator_address: Uint8Array; + timestamp?: Date; + signature: Uint8Array; +} + +export interface Proposal { + type: SignedMsgType; + height: string; + round: number; + pol_round: number; + block_id?: BlockID; + timestamp?: Date; + signature: Uint8Array; +} + +export interface SignedHeader { + header?: Header; + commit?: Commit; +} + +export interface LightBlock { + signed_header?: SignedHeader; + validator_set?: ValidatorSet; +} + +export interface BlockMeta { + block_id?: BlockID; + block_size: string; + header?: Header; + num_txs: string; +} + +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + root_hash: Uint8Array; + data: Uint8Array; + proof?: Proof; +} + +function createBasePartSetHeader(): PartSetHeader { + return { total: 0, hash: new Uint8Array() }; +} + +export const PartSetHeader = { + encode(message: PartSetHeader, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PartSetHeader { + return { + total: isSet(object.total) ? Number(object.total) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + }; + }, + + toJSON(message: PartSetHeader): unknown { + const obj: any = {}; + message.total !== undefined && (obj.total = Math.round(message.total)); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PartSetHeader { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(); + return message; + }, +}; + +function createBasePart(): Part { + return { index: 0, bytes: new Uint8Array(), proof: undefined }; +} + +export const Part = { + encode(message: Part, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Part { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Part { + return { + index: isSet(object.index) ? Number(object.index) : 0, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: Part): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = Math.round(message.index)); + message.bytes !== undefined && + (obj.bytes = base64FromBytes(message.bytes !== undefined ? message.bytes : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseBlockID(): BlockID { + return { hash: new Uint8Array(), part_set_header: undefined }; +} + +export const BlockID = { + encode(message: BlockID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.part_set_header !== undefined) { + PartSetHeader.encode(message.part_set_header, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BlockID { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.part_set_header = PartSetHeader.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BlockID { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + part_set_header: isSet(object.part_set_header) ? PartSetHeader.fromJSON(object.part_set_header) : undefined, + }; + }, + + toJSON(message: BlockID): unknown { + const obj: any = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.part_set_header !== undefined && + (obj.part_set_header = message.part_set_header ? PartSetHeader.toJSON(message.part_set_header) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): BlockID { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(); + message.part_set_header = (object.part_set_header !== undefined && object.part_set_header !== null) + ? PartSetHeader.fromPartial(object.part_set_header) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chain_id: "", + height: "0", + time: undefined, + last_block_id: undefined, + last_commit_hash: new Uint8Array(), + data_hash: new Uint8Array(), + validators_hash: new Uint8Array(), + next_validators_hash: new Uint8Array(), + consensus_hash: new Uint8Array(), + app_hash: new Uint8Array(), + last_results_hash: new Uint8Array(), + evidence_hash: new Uint8Array(), + proposer_address: new Uint8Array(), + }; +} + +export const Header = { + encode(message: Header, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); + } + if (message.chain_id !== "") { + writer.uint32(18).string(message.chain_id); + } + if (message.height !== "0") { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.last_block_id !== undefined) { + BlockID.encode(message.last_block_id, writer.uint32(42).fork()).ldelim(); + } + if (message.last_commit_hash.length !== 0) { + writer.uint32(50).bytes(message.last_commit_hash); + } + if (message.data_hash.length !== 0) { + writer.uint32(58).bytes(message.data_hash); + } + if (message.validators_hash.length !== 0) { + writer.uint32(66).bytes(message.validators_hash); + } + if (message.next_validators_hash.length !== 0) { + writer.uint32(74).bytes(message.next_validators_hash); + } + if (message.consensus_hash.length !== 0) { + writer.uint32(82).bytes(message.consensus_hash); + } + if (message.app_hash.length !== 0) { + writer.uint32(90).bytes(message.app_hash); + } + if (message.last_results_hash.length !== 0) { + writer.uint32(98).bytes(message.last_results_hash); + } + if (message.evidence_hash.length !== 0) { + writer.uint32(106).bytes(message.evidence_hash); + } + if (message.proposer_address.length !== 0) { + writer.uint32(114).bytes(message.proposer_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Header { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.chain_id = reader.string(); + break; + case 3: + message.height = longToString(reader.int64() as Long); + break; + case 4: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.last_block_id = BlockID.decode(reader, reader.uint32()); + break; + case 6: + message.last_commit_hash = reader.bytes(); + break; + case 7: + message.data_hash = reader.bytes(); + break; + case 8: + message.validators_hash = reader.bytes(); + break; + case 9: + message.next_validators_hash = reader.bytes(); + break; + case 10: + message.consensus_hash = reader.bytes(); + break; + case 11: + message.app_hash = reader.bytes(); + break; + case 12: + message.last_results_hash = reader.bytes(); + break; + case 13: + message.evidence_hash = reader.bytes(); + break; + case 14: + message.proposer_address = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chain_id: isSet(object.chain_id) ? String(object.chain_id) : "", + height: isSet(object.height) ? String(object.height) : "0", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + last_block_id: isSet(object.last_block_id) ? BlockID.fromJSON(object.last_block_id) : undefined, + last_commit_hash: isSet(object.last_commit_hash) ? bytesFromBase64(object.last_commit_hash) : new Uint8Array(), + data_hash: isSet(object.data_hash) ? bytesFromBase64(object.data_hash) : new Uint8Array(), + validators_hash: isSet(object.validators_hash) ? bytesFromBase64(object.validators_hash) : new Uint8Array(), + next_validators_hash: isSet(object.next_validators_hash) + ? bytesFromBase64(object.next_validators_hash) + : new Uint8Array(), + consensus_hash: isSet(object.consensus_hash) ? bytesFromBase64(object.consensus_hash) : new Uint8Array(), + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(), + last_results_hash: isSet(object.last_results_hash) ? bytesFromBase64(object.last_results_hash) : new Uint8Array(), + evidence_hash: isSet(object.evidence_hash) ? bytesFromBase64(object.evidence_hash) : new Uint8Array(), + proposer_address: isSet(object.proposer_address) ? bytesFromBase64(object.proposer_address) : new Uint8Array(), + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version ? Consensus.toJSON(message.version) : undefined); + message.chain_id !== undefined && (obj.chain_id = message.chain_id); + message.height !== undefined && (obj.height = message.height); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.last_block_id !== undefined && + (obj.last_block_id = message.last_block_id ? BlockID.toJSON(message.last_block_id) : undefined); + message.last_commit_hash !== undefined && + (obj.last_commit_hash = base64FromBytes( + message.last_commit_hash !== undefined ? message.last_commit_hash : new Uint8Array(), + )); + message.data_hash !== undefined && + (obj.data_hash = base64FromBytes(message.data_hash !== undefined ? message.data_hash : new Uint8Array())); + message.validators_hash !== undefined && + (obj.validators_hash = base64FromBytes( + message.validators_hash !== undefined ? message.validators_hash : new Uint8Array(), + )); + message.next_validators_hash !== undefined && + (obj.next_validators_hash = base64FromBytes( + message.next_validators_hash !== undefined ? message.next_validators_hash : new Uint8Array(), + )); + message.consensus_hash !== undefined && + (obj.consensus_hash = base64FromBytes( + message.consensus_hash !== undefined ? message.consensus_hash : new Uint8Array(), + )); + message.app_hash !== undefined && + (obj.app_hash = base64FromBytes(message.app_hash !== undefined ? message.app_hash : new Uint8Array())); + message.last_results_hash !== undefined && + (obj.last_results_hash = base64FromBytes( + message.last_results_hash !== undefined ? message.last_results_hash : new Uint8Array(), + )); + message.evidence_hash !== undefined && + (obj.evidence_hash = base64FromBytes( + message.evidence_hash !== undefined ? message.evidence_hash : new Uint8Array(), + )); + message.proposer_address !== undefined && + (obj.proposer_address = base64FromBytes( + message.proposer_address !== undefined ? message.proposer_address : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chain_id = object.chain_id ?? ""; + message.height = object.height ?? "0"; + message.time = object.time ?? undefined; + message.last_block_id = (object.last_block_id !== undefined && object.last_block_id !== null) + ? BlockID.fromPartial(object.last_block_id) + : undefined; + message.last_commit_hash = object.last_commit_hash ?? new Uint8Array(); + message.data_hash = object.data_hash ?? new Uint8Array(); + message.validators_hash = object.validators_hash ?? new Uint8Array(); + message.next_validators_hash = object.next_validators_hash ?? new Uint8Array(); + message.consensus_hash = object.consensus_hash ?? new Uint8Array(); + message.app_hash = object.app_hash ?? new Uint8Array(); + message.last_results_hash = object.last_results_hash ?? new Uint8Array(); + message.evidence_hash = object.evidence_hash ?? new Uint8Array(); + message.proposer_address = object.proposer_address ?? new Uint8Array(); + return message; + }, +}; + +function createBaseData(): Data { + return { txs: [] }; +} + +export const Data = { + encode(message: Data, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Data { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Data { + return { txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: Data): unknown { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.txs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Data { + const message = createBaseData(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVote(): Vote { + return { + type: 0, + height: "0", + round: 0, + block_id: undefined, + timestamp: undefined, + validator_address: new Uint8Array(), + validator_index: 0, + signature: new Uint8Array(), + }; +} + +export const Vote = { + encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== "0") { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(34).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + if (message.validator_address.length !== 0) { + writer.uint32(50).bytes(message.validator_address); + } + if (message.validator_index !== 0) { + writer.uint32(56).int32(message.validator_index); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Vote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.block_id = BlockID.decode(reader, reader.uint32()); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.validator_address = reader.bytes(); + break; + case 7: + message.validator_index = reader.int32(); + break; + case 8: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Vote { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? String(object.height) : "0", + round: isSet(object.round) ? Number(object.round) : 0, + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + validator_address: isSet(object.validator_address) ? bytesFromBase64(object.validator_address) : new Uint8Array(), + validator_index: isSet(object.validator_index) ? Number(object.validator_index) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = message.height); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); + message.validator_address !== undefined && + (obj.validator_address = base64FromBytes( + message.validator_address !== undefined ? message.validator_address : new Uint8Array(), + )); + message.validator_index !== undefined && (obj.validator_index = Math.round(message.validator_index)); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height ?? "0"; + message.round = object.round ?? 0; + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validator_address = object.validator_address ?? new Uint8Array(); + message.validator_index = object.validator_index ?? 0; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; + +function createBaseCommit(): Commit { + return { height: "0", round: 0, block_id: undefined, signatures: [] }; +} + +export const Commit = { + encode(message: Commit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.signatures) { + CommitSig.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Commit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.block_id = 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; + }, + + fromJSON(object: any): Commit { + return { + height: isSet(object.height) ? String(object.height) : "0", + round: isSet(object.round) ? Number(object.round) : 0, + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => CommitSig.fromJSON(e)) : [], + }; + }, + + toJSON(message: Commit): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => e ? CommitSig.toJSON(e) : undefined); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Commit { + const message = createBaseCommit(); + message.height = object.height ?? "0"; + message.round = object.round ?? 0; + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.signatures = object.signatures?.map((e) => CommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommitSig(): CommitSig { + return { block_id_flag: 0, validator_address: new Uint8Array(), timestamp: undefined, signature: new Uint8Array() }; +} + +export const CommitSig = { + encode(message: CommitSig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_id_flag !== 0) { + writer.uint32(8).int32(message.block_id_flag); + } + if (message.validator_address.length !== 0) { + writer.uint32(18).bytes(message.validator_address); + } + 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: _m0.Reader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.block_id_flag = reader.int32() as any; + break; + case 2: + message.validator_address = 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; + }, + + fromJSON(object: any): CommitSig { + return { + block_id_flag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : 0, + validator_address: isSet(object.validator_address) ? bytesFromBase64(object.validator_address) : new Uint8Array(), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + }; + }, + + toJSON(message: CommitSig): unknown { + const obj: any = {}; + message.block_id_flag !== undefined && (obj.block_id_flag = blockIDFlagToJSON(message.block_id_flag)); + message.validator_address !== undefined && + (obj.validator_address = base64FromBytes( + message.validator_address !== undefined ? message.validator_address : new Uint8Array(), + )); + message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): CommitSig { + const message = createBaseCommitSig(); + message.block_id_flag = object.block_id_flag ?? 0; + message.validator_address = object.validator_address ?? new Uint8Array(); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + type: 0, + height: "0", + round: 0, + pol_round: 0, + block_id: undefined, + timestamp: undefined, + signature: new Uint8Array(), + }; +} + +export const Proposal = { + encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== "0") { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.pol_round !== 0) { + writer.uint32(32).int32(message.pol_round); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, 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: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.pol_round = reader.int32(); + break; + case 5: + message.block_id = 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; + }, + + fromJSON(object: any): Proposal { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? String(object.height) : "0", + round: isSet(object.round) ? Number(object.round) : 0, + pol_round: isSet(object.pol_round) ? Number(object.pol_round) : 0, + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = message.height); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.pol_round !== undefined && (obj.pol_round = Math.round(message.pol_round)); + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height ?? "0"; + message.round = object.round ?? 0; + message.pol_round = object.pol_round ?? 0; + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; + +function createBaseSignedHeader(): SignedHeader { + return { header: undefined, commit: undefined }; +} + +export const SignedHeader = { + encode(message: SignedHeader, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SignedHeader { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + commit: isSet(object.commit) ? Commit.fromJSON(object.commit) : undefined, + }; + }, + + toJSON(message: SignedHeader): unknown { + const obj: any = {}; + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.commit !== undefined && (obj.commit = message.commit ? Commit.toJSON(message.commit) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseLightBlock(): LightBlock { + return { signed_header: undefined, validator_set: undefined }; +} + +export const LightBlock = { + encode(message: LightBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.signed_header !== undefined) { + SignedHeader.encode(message.signed_header, writer.uint32(10).fork()).ldelim(); + } + if (message.validator_set !== undefined) { + ValidatorSet.encode(message.validator_set, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.signed_header = SignedHeader.decode(reader, reader.uint32()); + break; + case 2: + message.validator_set = ValidatorSet.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LightBlock { + return { + signed_header: isSet(object.signed_header) ? SignedHeader.fromJSON(object.signed_header) : undefined, + validator_set: isSet(object.validator_set) ? ValidatorSet.fromJSON(object.validator_set) : undefined, + }; + }, + + toJSON(message: LightBlock): unknown { + const obj: any = {}; + message.signed_header !== undefined && + (obj.signed_header = message.signed_header ? SignedHeader.toJSON(message.signed_header) : undefined); + message.validator_set !== undefined && + (obj.validator_set = message.validator_set ? ValidatorSet.toJSON(message.validator_set) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): LightBlock { + const message = createBaseLightBlock(); + message.signed_header = (object.signed_header !== undefined && object.signed_header !== null) + ? SignedHeader.fromPartial(object.signed_header) + : undefined; + message.validator_set = (object.validator_set !== undefined && object.validator_set !== null) + ? ValidatorSet.fromPartial(object.validator_set) + : undefined; + return message; + }, +}; + +function createBaseBlockMeta(): BlockMeta { + return { block_id: undefined, block_size: "0", header: undefined, num_txs: "0" }; +} + +export const BlockMeta = { + encode(message: BlockMeta, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(10).fork()).ldelim(); + } + if (message.block_size !== "0") { + writer.uint32(16).int64(message.block_size); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).ldelim(); + } + if (message.num_txs !== "0") { + writer.uint32(32).int64(message.num_txs); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.block_id = BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.block_size = longToString(reader.int64() as Long); + break; + case 3: + message.header = Header.decode(reader, reader.uint32()); + break; + case 4: + message.num_txs = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BlockMeta { + return { + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block_size: isSet(object.block_size) ? String(object.block_size) : "0", + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + num_txs: isSet(object.num_txs) ? String(object.num_txs) : "0", + }; + }, + + toJSON(message: BlockMeta): unknown { + const obj: any = {}; + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.block_size !== undefined && (obj.block_size = message.block_size); + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.num_txs !== undefined && (obj.num_txs = message.num_txs); + return obj; + }, + + fromPartial, I>>(object: I): BlockMeta { + const message = createBaseBlockMeta(); + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.block_size = object.block_size ?? "0"; + message.header = (object.header !== undefined && object.header !== null) + ? Header.fromPartial(object.header) + : undefined; + message.num_txs = object.num_txs ?? "0"; + return message; + }, +}; + +function createBaseTxProof(): TxProof { + return { root_hash: new Uint8Array(), data: new Uint8Array(), proof: undefined }; +} + +export const TxProof = { + encode(message: TxProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.root_hash.length !== 0) { + writer.uint32(10).bytes(message.root_hash); + } + 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: _m0.Reader | Uint8Array, length?: number): TxProof { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.root_hash = 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; + }, + + fromJSON(object: any): TxProof { + return { + root_hash: isSet(object.root_hash) ? bytesFromBase64(object.root_hash) : new Uint8Array(), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: TxProof): unknown { + const obj: any = {}; + message.root_hash !== undefined && + (obj.root_hash = base64FromBytes(message.root_hash !== undefined ? message.root_hash : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): TxProof { + const message = createBaseTxProof(); + message.root_hash = object.root_hash ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/types/validator.ts b/common/types/src/client/tendermint/types/validator.ts new file mode 100644 index 00000000..41b2d2dc --- /dev/null +++ b/common/types/src/client/tendermint/types/validator.ts @@ -0,0 +1,305 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PublicKey } from "../crypto/keys"; + +export const protobufPackage = "tendermint.types"; + +export interface ValidatorSet { + validators: Validator[]; + proposer?: Validator; + total_voting_power: string; +} + +export interface Validator { + address: Uint8Array; + pub_key?: PublicKey; + voting_power: string; + proposer_priority: string; +} + +export interface SimpleValidator { + pub_key?: PublicKey; + voting_power: string; +} + +function createBaseValidatorSet(): ValidatorSet { + return { validators: [], proposer: undefined, total_voting_power: "0" }; +} + +export const ValidatorSet = { + encode(message: ValidatorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.total_voting_power !== "0") { + writer.uint32(24).int64(message.total_voting_power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.total_voting_power = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + proposer: isSet(object.proposer) ? Validator.fromJSON(object.proposer) : undefined, + total_voting_power: isSet(object.total_voting_power) ? String(object.total_voting_power) : "0", + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.proposer !== undefined && + (obj.proposer = message.proposer ? Validator.toJSON(message.proposer) : undefined); + message.total_voting_power !== undefined && (obj.total_voting_power = message.total_voting_power); + return obj; + }, + + fromPartial, I>>(object: I): 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.total_voting_power = object.total_voting_power ?? "0"; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(), pub_key: undefined, voting_power: "0", proposer_priority: "0" }; +} + +export const Validator = { + encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pub_key !== undefined) { + PublicKey.encode(message.pub_key, writer.uint32(18).fork()).ldelim(); + } + if (message.voting_power !== "0") { + writer.uint32(24).int64(message.voting_power); + } + if (message.proposer_priority !== "0") { + writer.uint32(32).int64(message.proposer_priority); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Validator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.pub_key = PublicKey.decode(reader, reader.uint32()); + break; + case 3: + message.voting_power = longToString(reader.int64() as Long); + break; + case 4: + message.proposer_priority = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(), + pub_key: isSet(object.pub_key) ? PublicKey.fromJSON(object.pub_key) : undefined, + voting_power: isSet(object.voting_power) ? String(object.voting_power) : "0", + proposer_priority: isSet(object.proposer_priority) ? String(object.proposer_priority) : "0", + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + message.address !== undefined && + (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? PublicKey.toJSON(message.pub_key) : undefined); + message.voting_power !== undefined && (obj.voting_power = message.voting_power); + message.proposer_priority !== undefined && (obj.proposer_priority = message.proposer_priority); + return obj; + }, + + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? PublicKey.fromPartial(object.pub_key) + : undefined; + message.voting_power = object.voting_power ?? "0"; + message.proposer_priority = object.proposer_priority ?? "0"; + return message; + }, +}; + +function createBaseSimpleValidator(): SimpleValidator { + return { pub_key: undefined, voting_power: "0" }; +} + +export const SimpleValidator = { + encode(message: SimpleValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pub_key !== undefined) { + PublicKey.encode(message.pub_key, writer.uint32(10).fork()).ldelim(); + } + if (message.voting_power !== "0") { + writer.uint32(16).int64(message.voting_power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.pub_key = PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.voting_power = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SimpleValidator { + return { + pub_key: isSet(object.pub_key) ? PublicKey.fromJSON(object.pub_key) : undefined, + voting_power: isSet(object.voting_power) ? String(object.voting_power) : "0", + }; + }, + + toJSON(message: SimpleValidator): unknown { + const obj: any = {}; + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? PublicKey.toJSON(message.pub_key) : undefined); + message.voting_power !== undefined && (obj.voting_power = message.voting_power); + return obj; + }, + + fromPartial, I>>(object: I): SimpleValidator { + const message = createBaseSimpleValidator(); + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? PublicKey.fromPartial(object.pub_key) + : undefined; + message.voting_power = object.voting_power ?? "0"; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/client/tendermint/version/types.ts b/common/types/src/client/tendermint/version/types.ts new file mode 100644 index 00000000..3eda3af6 --- /dev/null +++ b/common/types/src/client/tendermint/version/types.ts @@ -0,0 +1,165 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "tendermint.version"; + +/** + * 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: string; + software: string; +} + +/** + * 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: string; + app: string; +} + +function createBaseApp(): App { + return { protocol: "0", software: "" }; +} + +export const App = { + encode(message: App, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.protocol !== "0") { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): App { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.software = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): App { + return { + protocol: isSet(object.protocol) ? String(object.protocol) : "0", + software: isSet(object.software) ? String(object.software) : "", + }; + }, + + toJSON(message: App): unknown { + const obj: any = {}; + message.protocol !== undefined && (obj.protocol = message.protocol); + message.software !== undefined && (obj.software = message.software); + return obj; + }, + + fromPartial, I>>(object: I): App { + const message = createBaseApp(); + message.protocol = object.protocol ?? "0"; + message.software = object.software ?? ""; + return message; + }, +}; + +function createBaseConsensus(): Consensus { + return { block: "0", app: "0" }; +} + +export const Consensus = { + encode(message: Consensus, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block !== "0") { + writer.uint32(8).uint64(message.block); + } + if (message.app !== "0") { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Consensus { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.app = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Consensus { + return { + block: isSet(object.block) ? String(object.block) : "0", + app: isSet(object.app) ? String(object.app) : "0", + }; + }, + + toJSON(message: Consensus): unknown { + const obj: any = {}; + message.block !== undefined && (obj.block = message.block); + message.app !== undefined && (obj.app = message.app); + return obj; + }, + + fromPartial, I>>(object: I): Consensus { + const message = createBaseConsensus(); + message.block = object.block ?? "0"; + message.app = object.app ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/app/v1alpha1/config.ts b/common/types/src/lcd/cosmos/app/v1alpha1/config.ts new file mode 100644 index 00000000..2a4ecfb5 --- /dev/null +++ b/common/types/src/lcd/cosmos/app/v1alpha1/config.ts @@ -0,0 +1,167 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.app.v1alpha1"; + +/** + * Config represents the configuration for a Cosmos SDK ABCI app. + * It is intended that all state machine logic including the version of + * baseapp and tx handlers (and possibly even Tendermint) that an app needs + * can be described in a config object. For compatibility, the framework should + * allow a mixture of declarative and imperative app wiring, however, apps + * that strive for the maximum ease of maintainability should be able to describe + * their state machine with a config object alone. + */ +export interface Config { + /** modules are the module configurations for the app. */ + modules: ModuleConfig[]; +} + +/** ModuleConfig is a module configuration for an app. */ +export interface ModuleConfig { + /** + * name is the unique name of the module within the app. It should be a name + * that persists between different versions of a module so that modules + * can be smoothly upgraded to new versions. + * + * For example, for the module cosmos.bank.module.v1.Module, we may chose + * to simply name the module "bank" in the app. When we upgrade to + * cosmos.bank.module.v2.Module, the app-specific name "bank" stays the same + * and the framework knows that the v2 module should receive all the same state + * that the v1 module had. Note: modules should provide info on which versions + * they can migrate from in the ModuleDescriptor.can_migration_from field. + */ + name: string; + /** + * config is the config object for the module. Module config messages should + * define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension. + */ + config?: Any; +} + +function createBaseConfig(): Config { + return { modules: [] }; +} + +export const Config = { + encode(message: Config, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.modules) { + ModuleConfig.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Config { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.modules.push(ModuleConfig.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Config { + return { modules: Array.isArray(object?.modules) ? object.modules.map((e: any) => ModuleConfig.fromJSON(e)) : [] }; + }, + + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.modules) { + obj.modules = message.modules.map((e) => e ? ModuleConfig.toJSON(e) : undefined); + } else { + obj.modules = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Config { + const message = createBaseConfig(); + message.modules = object.modules?.map((e) => ModuleConfig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseModuleConfig(): ModuleConfig { + return { name: "", config: undefined }; +} + +export const ModuleConfig = { + encode(message: ModuleConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.config !== undefined) { + Any.encode(message.config, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleConfig { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.config = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleConfig { + return { + name: isSet(object.name) ? String(object.name) : "", + config: isSet(object.config) ? Any.fromJSON(object.config) : undefined, + }; + }, + + toJSON(message: ModuleConfig): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.config !== undefined && (obj.config = message.config ? Any.toJSON(message.config) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): ModuleConfig { + const message = createBaseModuleConfig(); + message.name = object.name ?? ""; + message.config = (object.config !== undefined && object.config !== null) + ? Any.fromPartial(object.config) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/app/v1alpha1/module.ts b/common/types/src/lcd/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..eaebc57e --- /dev/null +++ b/common/types/src/lcd/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,288 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.app.v1alpha1"; + +/** ModuleDescriptor describes an app module. */ +export interface ModuleDescriptor { + /** + * go_import names the package that should be imported by an app to load the + * module in the runtime module registry. Either go_import must be defined here + * or the go_package option must be defined at the file level to indicate + * to users where to location the module implementation. go_import takes + * precedence over go_package when both are defined. + */ + go_import: string; + /** + * use_package refers to a protobuf package that this module + * uses and exposes to the world. In an app, only one module should "use" + * or own a single protobuf package. It is assumed that the module uses + * all of the .proto files in a single package. + */ + use_package: PackageReference[]; + /** + * can_migrate_from defines which module versions this module can migrate + * state from. The framework will check that one module version is able to + * migrate from a previous module version before attempting to update its + * config. It is assumed that modules can transitively migrate from earlier + * versions. For instance if v3 declares it can migrate from v2, and v2 + * declares it can migrate from v1, the framework knows how to migrate + * from v1 to v3, assuming all 3 module versions are registered at runtime. + */ + can_migrate_from: MigrateFromInfo[]; +} + +/** PackageReference is a reference to a protobuf package used by a module. */ +export interface PackageReference { + /** name is the fully-qualified name of the package. */ + name: string; + /** + * revision is the optional revision of the package that is being used. + * Protobuf packages used in Cosmos should generally have a major version + * as the last part of the package name, ex. foo.bar.baz.v1. + * The revision of a package can be thought of as the minor version of a + * package which has additional backwards compatible definitions that weren't + * present in a previous version. + * + * A package should indicate its revision with a source code comment + * above the package declaration in one of its fields containing the + * test "Revision N" where N is an integer revision. All packages start + * at revision 0 the first time they are released in a module. + * + * When a new version of a module is released and items are added to existing + * .proto files, these definitions should contain comments of the form + * "Since Revision N" where N is an integer revision. + * + * When the module runtime starts up, it will check the pinned proto + * image and panic if there are runtime protobuf definitions that are not + * in the pinned descriptor which do not have + * a "Since Revision N" comment or have a "Since Revision N" comment where + * N is <= to the revision specified here. This indicates that the protobuf + * files have been updated, but the pinned file descriptor hasn't. + * + * If there are items in the pinned file descriptor with a revision + * greater than the value indicated here, this will also cause a panic + * as it may mean that the pinned descriptor for a legacy module has been + * improperly updated or that there is some other versioning discrepancy. + * Runtime protobuf definitions will also be checked for compatibility + * with pinned file descriptors to make sure there are no incompatible changes. + * + * This behavior ensures that: + * * pinned proto images are up-to-date + * * protobuf files are carefully annotated with revision comments which + * are important good client UX + * * protobuf files are changed in backwards and forwards compatible ways + */ + revision: number; +} + +/** + * MigrateFromInfo is information on a module version that a newer module + * can migrate from. + */ +export interface MigrateFromInfo { + /** + * module is the fully-qualified protobuf name of the module config object + * for the previous module version, ex: "cosmos.group.module.v1.Module". + */ + module: string; +} + +function createBaseModuleDescriptor(): ModuleDescriptor { + return { go_import: "", use_package: [], can_migrate_from: [] }; +} + +export const ModuleDescriptor = { + encode(message: ModuleDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.go_import !== "") { + writer.uint32(10).string(message.go_import); + } + for (const v of message.use_package) { + PackageReference.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.can_migrate_from) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.go_import = reader.string(); + break; + case 2: + message.use_package.push(PackageReference.decode(reader, reader.uint32())); + break; + case 3: + message.can_migrate_from.push(MigrateFromInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleDescriptor { + return { + go_import: isSet(object.go_import) ? String(object.go_import) : "", + use_package: Array.isArray(object?.use_package) + ? object.use_package.map((e: any) => PackageReference.fromJSON(e)) + : [], + can_migrate_from: Array.isArray(object?.can_migrate_from) + ? object.can_migrate_from.map((e: any) => MigrateFromInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ModuleDescriptor): unknown { + const obj: any = {}; + message.go_import !== undefined && (obj.go_import = message.go_import); + if (message.use_package) { + obj.use_package = message.use_package.map((e) => e ? PackageReference.toJSON(e) : undefined); + } else { + obj.use_package = []; + } + if (message.can_migrate_from) { + obj.can_migrate_from = message.can_migrate_from.map((e) => e ? MigrateFromInfo.toJSON(e) : undefined); + } else { + obj.can_migrate_from = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.go_import = object.go_import ?? ""; + message.use_package = object.use_package?.map((e) => PackageReference.fromPartial(e)) || []; + message.can_migrate_from = object.can_migrate_from?.map((e) => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePackageReference(): PackageReference { + return { name: "", revision: 0 }; +} + +export const PackageReference = { + encode(message: PackageReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePackageReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.revision = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PackageReference { + return { + name: isSet(object.name) ? String(object.name) : "", + revision: isSet(object.revision) ? Number(object.revision) : 0, + }; + }, + + toJSON(message: PackageReference): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.revision !== undefined && (obj.revision = Math.round(message.revision)); + return obj; + }, + + fromPartial, I>>(object: I): PackageReference { + const message = createBasePackageReference(); + message.name = object.name ?? ""; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseMigrateFromInfo(): MigrateFromInfo { + return { module: "" }; +} + +export const MigrateFromInfo = { + encode(message: MigrateFromInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMigrateFromInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.module = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MigrateFromInfo { + return { module: isSet(object.module) ? String(object.module) : "" }; + }, + + toJSON(message: MigrateFromInfo): unknown { + const obj: any = {}; + message.module !== undefined && (obj.module = message.module); + return obj; + }, + + fromPartial, I>>(object: I): MigrateFromInfo { + const message = createBaseMigrateFromInfo(); + message.module = object.module ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/app/v1alpha1/query.ts b/common/types/src/lcd/cosmos/app/v1alpha1/query.ts new file mode 100644 index 00000000..bffe40f9 --- /dev/null +++ b/common/types/src/lcd/cosmos/app/v1alpha1/query.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Config } from "./config"; + +export const protobufPackage = "cosmos.app.v1alpha1"; + +/** QueryConfigRequest is the Query/Config request type. */ +export interface QueryConfigRequest { +} + +/** QueryConfigRequest is the Query/Config response type. */ +export interface QueryConfigResponse { + /** config is the current app config. */ + config?: Config; +} + +function createBaseQueryConfigRequest(): QueryConfigRequest { + return {}; +} + +export const QueryConfigRequest = { + encode(_: QueryConfigRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryConfigRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryConfigRequest { + return {}; + }, + + toJSON(_: QueryConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryConfigRequest { + const message = createBaseQueryConfigRequest(); + return message; + }, +}; + +function createBaseQueryConfigResponse(): QueryConfigResponse { + return { config: undefined }; +} + +export const QueryConfigResponse = { + encode(message: QueryConfigResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.config !== undefined) { + Config.encode(message.config, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryConfigResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.config = Config.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryConfigResponse { + return { config: isSet(object.config) ? Config.fromJSON(object.config) : undefined }; + }, + + toJSON(message: QueryConfigResponse): unknown { + const obj: any = {}; + message.config !== undefined && (obj.config = message.config ? Config.toJSON(message.config) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryConfigResponse { + const message = createBaseQueryConfigResponse(); + message.config = (object.config !== undefined && object.config !== null) + ? Config.fromPartial(object.config) + : undefined; + return message; + }, +}; + +/** Query is the app module query service. */ +export interface Query { + /** Config returns the current app config. */ + Config(request: QueryConfigRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.app.v1alpha1.Query"; + this.rpc = rpc; + this.Config = this.Config.bind(this); + } + Config(request: QueryConfigRequest): Promise { + const data = QueryConfigRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Config", data); + return promise.then((data) => QueryConfigResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/auth/v1beta1/auth.ts b/common/types/src/lcd/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 00000000..7f0c9d19 --- /dev/null +++ b/common/types/src/lcd/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,304 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** + * 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; + pub_key?: Any; + account_number: string; + sequence: string; +} + +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccount { + base_account?: BaseAccount; + name: string; + permissions: string[]; +} + +/** Params defines the parameters for the auth module. */ +export interface Params { + max_memo_characters: string; + tx_sig_limit: string; + tx_size_cost_per_byte: string; + sig_verify_cost_ed25519: string; + sig_verify_cost_secp256k1: string; +} + +function createBaseBaseAccount(): BaseAccount { + return { address: "", pub_key: undefined, account_number: "0", sequence: "0" }; +} + +export const BaseAccount = { + encode(message: BaseAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pub_key !== undefined) { + Any.encode(message.pub_key, writer.uint32(18).fork()).ldelim(); + } + if (message.account_number !== "0") { + writer.uint32(24).uint64(message.account_number); + } + if (message.sequence !== "0") { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.pub_key = Any.decode(reader, reader.uint32()); + break; + case 3: + message.account_number = longToString(reader.uint64() as Long); + break; + case 4: + message.sequence = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BaseAccount { + return { + address: isSet(object.address) ? String(object.address) : "", + pub_key: isSet(object.pub_key) ? Any.fromJSON(object.pub_key) : undefined, + account_number: isSet(object.account_number) ? String(object.account_number) : "0", + sequence: isSet(object.sequence) ? String(object.sequence) : "0", + }; + }, + + toJSON(message: BaseAccount): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? Any.toJSON(message.pub_key) : undefined); + message.account_number !== undefined && (obj.account_number = message.account_number); + message.sequence !== undefined && (obj.sequence = message.sequence); + return obj; + }, + + fromPartial, I>>(object: I): BaseAccount { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? Any.fromPartial(object.pub_key) + : undefined; + message.account_number = object.account_number ?? "0"; + message.sequence = object.sequence ?? "0"; + return message; + }, +}; + +function createBaseModuleAccount(): ModuleAccount { + return { base_account: undefined, name: "", permissions: [] }; +} + +export const ModuleAccount = { + encode(message: ModuleAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_account !== undefined) { + BaseAccount.encode(message.base_account, 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: _m0.Reader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_account = 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; + }, + + fromJSON(object: any): ModuleAccount { + return { + base_account: isSet(object.base_account) ? BaseAccount.fromJSON(object.base_account) : undefined, + name: isSet(object.name) ? String(object.name) : "", + permissions: Array.isArray(object?.permissions) ? object.permissions.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: ModuleAccount): unknown { + const obj: any = {}; + message.base_account !== undefined && + (obj.base_account = message.base_account ? BaseAccount.toJSON(message.base_account) : undefined); + message.name !== undefined && (obj.name = message.name); + if (message.permissions) { + obj.permissions = message.permissions.map((e) => e); + } else { + obj.permissions = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ModuleAccount { + const message = createBaseModuleAccount(); + message.base_account = (object.base_account !== undefined && object.base_account !== null) + ? BaseAccount.fromPartial(object.base_account) + : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + max_memo_characters: "0", + tx_sig_limit: "0", + tx_size_cost_per_byte: "0", + sig_verify_cost_ed25519: "0", + sig_verify_cost_secp256k1: "0", + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.max_memo_characters !== "0") { + writer.uint32(8).uint64(message.max_memo_characters); + } + if (message.tx_sig_limit !== "0") { + writer.uint32(16).uint64(message.tx_sig_limit); + } + if (message.tx_size_cost_per_byte !== "0") { + writer.uint32(24).uint64(message.tx_size_cost_per_byte); + } + if (message.sig_verify_cost_ed25519 !== "0") { + writer.uint32(32).uint64(message.sig_verify_cost_ed25519); + } + if (message.sig_verify_cost_secp256k1 !== "0") { + writer.uint32(40).uint64(message.sig_verify_cost_secp256k1); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.max_memo_characters = longToString(reader.uint64() as Long); + break; + case 2: + message.tx_sig_limit = longToString(reader.uint64() as Long); + break; + case 3: + message.tx_size_cost_per_byte = longToString(reader.uint64() as Long); + break; + case 4: + message.sig_verify_cost_ed25519 = longToString(reader.uint64() as Long); + break; + case 5: + message.sig_verify_cost_secp256k1 = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + max_memo_characters: isSet(object.max_memo_characters) ? String(object.max_memo_characters) : "0", + tx_sig_limit: isSet(object.tx_sig_limit) ? String(object.tx_sig_limit) : "0", + tx_size_cost_per_byte: isSet(object.tx_size_cost_per_byte) ? String(object.tx_size_cost_per_byte) : "0", + sig_verify_cost_ed25519: isSet(object.sig_verify_cost_ed25519) ? String(object.sig_verify_cost_ed25519) : "0", + sig_verify_cost_secp256k1: isSet(object.sig_verify_cost_secp256k1) + ? String(object.sig_verify_cost_secp256k1) + : "0", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.max_memo_characters !== undefined && (obj.max_memo_characters = message.max_memo_characters); + message.tx_sig_limit !== undefined && (obj.tx_sig_limit = message.tx_sig_limit); + message.tx_size_cost_per_byte !== undefined && (obj.tx_size_cost_per_byte = message.tx_size_cost_per_byte); + message.sig_verify_cost_ed25519 !== undefined && (obj.sig_verify_cost_ed25519 = message.sig_verify_cost_ed25519); + message.sig_verify_cost_secp256k1 !== undefined && + (obj.sig_verify_cost_secp256k1 = message.sig_verify_cost_secp256k1); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.max_memo_characters = object.max_memo_characters ?? "0"; + message.tx_sig_limit = object.tx_sig_limit ?? "0"; + message.tx_size_cost_per_byte = object.tx_size_cost_per_byte ?? "0"; + message.sig_verify_cost_ed25519 = object.sig_verify_cost_ed25519 ?? "0"; + message.sig_verify_cost_secp256k1 = object.sig_verify_cost_secp256k1 ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/auth/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/auth/v1beta1/genesis.ts new file mode 100644 index 00000000..c67683fe --- /dev/null +++ b/common/types/src/lcd/cosmos/auth/v1beta1/genesis.ts @@ -0,0 +1,93 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Params } from "./auth"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** GenesisState defines the auth module's genesis state. */ +export interface GenesisState { + /** params defines all the paramaters of the module. */ + params?: Params; + /** accounts are the accounts present at genesis. */ + accounts: Any[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, accounts: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.accounts.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.accounts) { + obj.accounts = message.accounts.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.accounts = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/auth/v1beta1/query.ts b/common/types/src/lcd/cosmos/auth/v1beta1/query.ts new file mode 100644 index 00000000..4fe0cbf9 --- /dev/null +++ b/common/types/src/lcd/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,900 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Params } from "./auth"; + +export const protobufPackage = "cosmos.auth.v1beta1"; + +/** + * 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; +} + +/** + * 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: Any[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + /** address defines the address to query for. */ + address: string; +} + +/** QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. */ +export interface QueryModuleAccountsRequest { +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponse { + /** account defines the account of the corresponding address. */ + account?: Any; +} + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. */ +export interface QueryModuleAccountsResponse { + accounts: Any[]; +} + +/** Bech32PrefixRequest is the request type for Bech32Prefix rpc method */ +export interface Bech32PrefixRequest { +} + +/** Bech32PrefixResponse is the response type for Bech32Prefix rpc method */ +export interface Bech32PrefixResponse { + bech32_prefix: string; +} + +/** AddressBytesToStringRequest is the request type for AddressString rpc method */ +export interface AddressBytesToStringRequest { + address_bytes: Uint8Array; +} + +/** AddressBytesToStringResponse is the response type for AddressString rpc method */ +export interface AddressBytesToStringResponse { + address_string: string; +} + +/** AddressStringToBytesRequest is the request type for AccountBytes rpc method */ +export interface AddressStringToBytesRequest { + address_string: string; +} + +/** AddressStringToBytesResponse is the response type for AddressBytes rpc method */ +export interface AddressStringToBytesResponse { + address_bytes: Uint8Array; +} + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +export const QueryAccountsRequest = { + encode(message: QueryAccountsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountsResponse(): QueryAccountsResponse { + return { accounts: [], pagination: undefined }; +} + +export const QueryAccountsResponse = { + encode(message: QueryAccountsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(Any.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountsResponse { + return { + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAccountsResponse): unknown { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.accounts = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountsResponse { + const message = createBaseQueryAccountsResponse(); + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountRequest(): QueryAccountRequest { + return { address: "" }; +} + +export const QueryAccountRequest = { + encode(message: QueryAccountRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { + return {}; +} + +export const QueryModuleAccountsRequest = { + encode(_: QueryModuleAccountsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleAccountsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryModuleAccountsRequest { + return {}; + }, + + toJSON(_: QueryModuleAccountsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountResponse(): QueryAccountResponse { + return { account: undefined }; +} + +export const QueryAccountResponse = { + encode(message: QueryAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryAccountResponse): unknown { + const obj: any = {}; + message.account !== undefined && (obj.account = message.account ? Any.toJSON(message.account) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountResponse { + const message = createBaseQueryAccountResponse(); + message.account = (object.account !== undefined && object.account !== null) + ? Any.fromPartial(object.account) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { + return { accounts: [] }; +} + +export const QueryModuleAccountsResponse = { + encode(message: QueryModuleAccountsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleAccountsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryModuleAccountsResponse { + return { accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryModuleAccountsResponse): unknown { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.accounts = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBech32PrefixRequest(): Bech32PrefixRequest { + return {}; +} + +export const Bech32PrefixRequest = { + encode(_: Bech32PrefixRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Bech32PrefixRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): Bech32PrefixRequest { + return {}; + }, + + toJSON(_: Bech32PrefixRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, +}; + +function createBaseBech32PrefixResponse(): Bech32PrefixResponse { + return { bech32_prefix: "" }; +} + +export const Bech32PrefixResponse = { + encode(message: Bech32PrefixResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bech32_prefix !== "") { + writer.uint32(10).string(message.bech32_prefix); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Bech32PrefixResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.bech32_prefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Bech32PrefixResponse { + return { bech32_prefix: isSet(object.bech32_prefix) ? String(object.bech32_prefix) : "" }; + }, + + toJSON(message: Bech32PrefixResponse): unknown { + const obj: any = {}; + message.bech32_prefix !== undefined && (obj.bech32_prefix = message.bech32_prefix); + return obj; + }, + + fromPartial, I>>(object: I): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + message.bech32_prefix = object.bech32_prefix ?? ""; + return message; + }, +}; + +function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { + return { address_bytes: new Uint8Array() }; +} + +export const AddressBytesToStringRequest = { + encode(message: AddressBytesToStringRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address_bytes.length !== 0) { + writer.uint32(10).bytes(message.address_bytes); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddressBytesToStringRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address_bytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringRequest { + return { address_bytes: isSet(object.address_bytes) ? bytesFromBase64(object.address_bytes) : new Uint8Array() }; + }, + + toJSON(message: AddressBytesToStringRequest): unknown { + const obj: any = {}; + message.address_bytes !== undefined && + (obj.address_bytes = base64FromBytes( + message.address_bytes !== undefined ? message.address_bytes : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + message.address_bytes = object.address_bytes ?? new Uint8Array(); + return message; + }, +}; + +function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { + return { address_string: "" }; +} + +export const AddressBytesToStringResponse = { + encode(message: AddressBytesToStringResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address_string !== "") { + writer.uint32(10).string(message.address_string); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddressBytesToStringResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address_string = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AddressBytesToStringResponse { + return { address_string: isSet(object.address_string) ? String(object.address_string) : "" }; + }, + + toJSON(message: AddressBytesToStringResponse): unknown { + const obj: any = {}; + message.address_string !== undefined && (obj.address_string = message.address_string); + return obj; + }, + + fromPartial, I>>(object: I): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + message.address_string = object.address_string ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { + return { address_string: "" }; +} + +export const AddressStringToBytesRequest = { + encode(message: AddressStringToBytesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address_string !== "") { + writer.uint32(10).string(message.address_string); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddressStringToBytesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address_string = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesRequest { + return { address_string: isSet(object.address_string) ? String(object.address_string) : "" }; + }, + + toJSON(message: AddressStringToBytesRequest): unknown { + const obj: any = {}; + message.address_string !== undefined && (obj.address_string = message.address_string); + return obj; + }, + + fromPartial, I>>(object: I): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + message.address_string = object.address_string ?? ""; + return message; + }, +}; + +function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { + return { address_bytes: new Uint8Array() }; +} + +export const AddressStringToBytesResponse = { + encode(message: AddressStringToBytesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address_bytes.length !== 0) { + writer.uint32(10).bytes(message.address_bytes); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddressStringToBytesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address_bytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AddressStringToBytesResponse { + return { address_bytes: isSet(object.address_bytes) ? bytesFromBase64(object.address_bytes) : new Uint8Array() }; + }, + + toJSON(message: AddressStringToBytesResponse): unknown { + const obj: any = {}; + message.address_bytes !== undefined && + (obj.address_bytes = base64FromBytes( + message.address_bytes !== undefined ? message.address_bytes : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + message.address_bytes = object.address_bytes ?? new Uint8Array(); + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Accounts returns all the existing accounts + * + * Since: cosmos-sdk 0.43 + */ + Accounts(request: QueryAccountsRequest): Promise; + /** Account returns account details based on address. */ + Account(request: QueryAccountRequest): Promise; + /** Params queries all parameters. */ + Params(request: QueryParamsRequest): Promise; + /** ModuleAccounts returns all the existing module accounts. */ + ModuleAccounts(request: QueryModuleAccountsRequest): Promise; + /** Bech32 queries bech32Prefix */ + Bech32Prefix(request: Bech32PrefixRequest): Promise; + /** AddressBytesToString converts Account Address bytes to string */ + AddressBytesToString(request: AddressBytesToStringRequest): Promise; + /** AddressStringToBytes converts Address string to bytes */ + AddressStringToBytes(request: AddressStringToBytesRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.auth.v1beta1.Query"; + this.rpc = rpc; + this.Accounts = this.Accounts.bind(this); + this.Account = this.Account.bind(this); + this.Params = this.Params.bind(this); + this.ModuleAccounts = this.ModuleAccounts.bind(this); + this.Bech32Prefix = this.Bech32Prefix.bind(this); + this.AddressBytesToString = this.AddressBytesToString.bind(this); + this.AddressStringToBytes = this.AddressStringToBytes.bind(this); + } + Accounts(request: QueryAccountsRequest): Promise { + const data = QueryAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Accounts", data); + return promise.then((data) => QueryAccountsResponse.decode(new _m0.Reader(data))); + } + + Account(request: QueryAccountRequest): Promise { + const data = QueryAccountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Account", data); + return promise.then((data) => QueryAccountResponse.decode(new _m0.Reader(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + ModuleAccounts(request: QueryModuleAccountsRequest): Promise { + const data = QueryModuleAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ModuleAccounts", data); + return promise.then((data) => QueryModuleAccountsResponse.decode(new _m0.Reader(data))); + } + + Bech32Prefix(request: Bech32PrefixRequest): Promise { + const data = Bech32PrefixRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Bech32Prefix", data); + return promise.then((data) => Bech32PrefixResponse.decode(new _m0.Reader(data))); + } + + AddressBytesToString(request: AddressBytesToStringRequest): Promise { + const data = AddressBytesToStringRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AddressBytesToString", data); + return promise.then((data) => AddressBytesToStringResponse.decode(new _m0.Reader(data))); + } + + AddressStringToBytes(request: AddressStringToBytesRequest): Promise { + const data = AddressStringToBytesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AddressStringToBytes", data); + return promise.then((data) => AddressStringToBytesResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/authz/v1beta1/authz.ts b/common/types/src/lcd/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 00000000..13d9662e --- /dev/null +++ b/common/types/src/lcd/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,325 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.authz.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** + * 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; +} + +/** + * Grant gives permissions to execute + * the provide method with expiration time. + */ +export interface Grant { + authorization?: Any; + /** + * 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; +} + +/** + * 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?: Any; + expiration?: Date; +} + +/** 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. */ + msg_type_urls: string[]; +} + +function createBaseGenericAuthorization(): GenericAuthorization { + return { msg: "" }; +} + +export const GenericAuthorization = { + encode(message: GenericAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): GenericAuthorization { + return { msg: isSet(object.msg) ? String(object.msg) : "" }; + }, + + toJSON(message: GenericAuthorization): unknown { + const obj: any = {}; + message.msg !== undefined && (obj.msg = message.msg); + return obj; + }, + + fromPartial, I>>(object: I): GenericAuthorization { + const message = createBaseGenericAuthorization(); + message.msg = object.msg ?? ""; + return message; + }, +}; + +function createBaseGrant(): Grant { + return { authorization: undefined, expiration: undefined }; +} + +export const Grant = { + encode(message: Grant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authorization !== undefined) { + Any.encode(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: _m0.Reader | Uint8Array, length?: number): Grant { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + case 2: + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Grant { + return { + authorization: isSet(object.authorization) ? Any.fromJSON(object.authorization) : undefined, + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: Grant): unknown { + const obj: any = {}; + message.authorization !== undefined && + (obj.authorization = message.authorization ? Any.toJSON(message.authorization) : undefined); + message.expiration !== undefined && (obj.expiration = message.expiration.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): Grant { + const message = createBaseGrant(); + message.authorization = (object.authorization !== undefined && object.authorization !== null) + ? Any.fromPartial(object.authorization) + : undefined; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBaseGrantAuthorization(): GrantAuthorization { + return { granter: "", grantee: "", authorization: undefined, expiration: undefined }; +} + +export const GrantAuthorization = { + encode(message: GrantAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + Any.encode(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: _m0.Reader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + case 4: + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GrantAuthorization { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + authorization: isSet(object.authorization) ? Any.fromJSON(object.authorization) : undefined, + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: GrantAuthorization): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.authorization !== undefined && + (obj.authorization = message.authorization ? Any.toJSON(message.authorization) : undefined); + message.expiration !== undefined && (obj.expiration = message.expiration.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): GrantAuthorization { + const message = createBaseGrantAuthorization(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.authorization = (object.authorization !== undefined && object.authorization !== null) + ? Any.fromPartial(object.authorization) + : undefined; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBaseGrantQueueItem(): GrantQueueItem { + return { msg_type_urls: [] }; +} + +export const GrantQueueItem = { + encode(message: GrantQueueItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.msg_type_urls) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GrantQueueItem { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_type_urls.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GrantQueueItem { + return { + msg_type_urls: Array.isArray(object?.msg_type_urls) ? object.msg_type_urls.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: GrantQueueItem): unknown { + const obj: any = {}; + if (message.msg_type_urls) { + obj.msg_type_urls = message.msg_type_urls.map((e) => e); + } else { + obj.msg_type_urls = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msg_type_urls = object.msg_type_urls?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/authz/v1beta1/event.ts b/common/types/src/lcd/cosmos/authz/v1beta1/event.ts new file mode 100644 index 00000000..6a9f5469 --- /dev/null +++ b/common/types/src/lcd/cosmos/authz/v1beta1/event.ts @@ -0,0 +1,175 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.authz.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** EventGrant is emitted on Msg/Grant */ +export interface EventGrant { + /** Msg type URL for which an autorization is granted */ + msg_type_url: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} + +/** EventRevoke is emitted on Msg/Revoke */ +export interface EventRevoke { + /** Msg type URL for which an autorization is revoked */ + msg_type_url: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} + +function createBaseEventGrant(): EventGrant { + return { msg_type_url: "", granter: "", grantee: "" }; +} + +export const EventGrant = { + encode(message: EventGrant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg_type_url !== "") { + writer.uint32(18).string(message.msg_type_url); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventGrant { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.msg_type_url = reader.string(); + break; + case 3: + message.granter = reader.string(); + break; + case 4: + message.grantee = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventGrant { + return { + msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "", + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + }; + }, + + toJSON(message: EventGrant): unknown { + const obj: any = {}; + message.msg_type_url !== undefined && (obj.msg_type_url = message.msg_type_url); + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + return obj; + }, + + fromPartial, I>>(object: I): EventGrant { + const message = createBaseEventGrant(); + message.msg_type_url = object.msg_type_url ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseEventRevoke(): EventRevoke { + return { msg_type_url: "", granter: "", grantee: "" }; +} + +export const EventRevoke = { + encode(message: EventRevoke, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg_type_url !== "") { + writer.uint32(18).string(message.msg_type_url); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventRevoke { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.msg_type_url = reader.string(); + break; + case 3: + message.granter = reader.string(); + break; + case 4: + message.grantee = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventRevoke { + return { + msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "", + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + }; + }, + + toJSON(message: EventRevoke): unknown { + const obj: any = {}; + message.msg_type_url !== undefined && (obj.msg_type_url = message.msg_type_url); + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + return obj; + }, + + fromPartial, I>>(object: I): EventRevoke { + const message = createBaseEventRevoke(); + message.msg_type_url = object.msg_type_url ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/authz/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/authz/v1beta1/genesis.ts new file mode 100644 index 00000000..5eb22427 --- /dev/null +++ b/common/types/src/lcd/cosmos/authz/v1beta1/genesis.ts @@ -0,0 +1,78 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { GrantAuthorization } from "./authz"; + +export const protobufPackage = "cosmos.authz.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** GenesisState defines the authz module's genesis state. */ +export interface GenesisState { + authorization: GrantAuthorization[]; +} + +function createBaseGenesisState(): GenesisState { + return { authorization: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.authorization) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authorization.push(GrantAuthorization.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + authorization: Array.isArray(object?.authorization) + ? object.authorization.map((e: any) => GrantAuthorization.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.authorization) { + obj.authorization = message.authorization.map((e) => e ? GrantAuthorization.toJSON(e) : undefined); + } else { + obj.authorization = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.authorization = object.authorization?.map((e) => GrantAuthorization.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/lcd/cosmos/authz/v1beta1/query.ts b/common/types/src/lcd/cosmos/authz/v1beta1/query.ts new file mode 100644 index 00000000..f8fa6414 --- /dev/null +++ b/common/types/src/lcd/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,518 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantAuthorization } from "./authz"; + +export const protobufPackage = "cosmos.authz.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ +export interface QueryGrantsRequest { + granter: string; + grantee: string; + /** Optional, msg_type_url, when set, will query only grants matching given msg type. */ + msg_type_url: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGrantsResponse is the response type for the Query/Authorizations RPC method. */ +export interface QueryGrantsResponse { + /** authorizations is a list of grants granted for grantee by granter. */ + grants: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +/** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsResponse { + /** grants is a list of grants granted by the granter. */ + grants: GrantAuthorization[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ +export interface QueryGranteeGrantsRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsResponse { + /** grants is a list of grants granted to the grantee. */ + grants: GrantAuthorization[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +function createBaseQueryGrantsRequest(): QueryGrantsRequest { + return { granter: "", grantee: "", msg_type_url: "", pagination: undefined }; +} + +export const QueryGrantsRequest = { + encode(message: QueryGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msg_type_url !== "") { + writer.uint32(26).string(message.msg_type_url); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGrantsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGrantsRequest(); + 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.msg_type_url = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGrantsRequest { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsRequest): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.msg_type_url !== undefined && (obj.msg_type_url = message.msg_type_url); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGrantsRequest { + const message = createBaseQueryGrantsRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msg_type_url = object.msg_type_url ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGrantsResponse(): QueryGrantsResponse { + return { grants: [], pagination: undefined }; +} + +export const QueryGrantsResponse = { + encode(message: QueryGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.grants) { + Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGrantsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(Grant.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGrantsResponse { + return { + grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => Grant.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsResponse): unknown { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => e ? Grant.toJSON(e) : undefined); + } else { + obj.grants = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGrantsResponse { + const message = createBaseQueryGrantsResponse(); + message.grants = object.grants?.map((e) => Grant.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest { + return { granter: "", pagination: undefined }; +} + +export const QueryGranterGrantsRequest = { + encode(message: QueryGranterGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranterGrantsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranterGrantsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsRequest { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsRequest): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGranterGrantsRequest { + const message = createBaseQueryGranterGrantsRequest(); + message.granter = object.granter ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse { + return { grants: [], pagination: undefined }; +} + +export const QueryGranterGrantsResponse = { + encode(message: QueryGranterGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranterGrantsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranterGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsResponse { + return { + grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => GrantAuthorization.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsResponse): unknown { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => e ? GrantAuthorization.toJSON(e) : undefined); + } else { + obj.grants = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGranterGrantsResponse { + const message = createBaseQueryGranterGrantsResponse(); + message.grants = object.grants?.map((e) => GrantAuthorization.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest { + return { grantee: "", pagination: undefined }; +} + +export const QueryGranteeGrantsRequest = { + encode(message: QueryGranteeGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranteeGrantsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranteeGrantsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grantee = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsRequest { + return { + grantee: isSet(object.grantee) ? String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsRequest): unknown { + const obj: any = {}; + message.grantee !== undefined && (obj.grantee = message.grantee); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGranteeGrantsRequest { + const message = createBaseQueryGranteeGrantsRequest(); + message.grantee = object.grantee ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse { + return { grants: [], pagination: undefined }; +} + +export const QueryGranteeGrantsResponse = { + encode(message: QueryGranteeGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranteeGrantsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranteeGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsResponse { + return { + grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => GrantAuthorization.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsResponse): unknown { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => e ? GrantAuthorization.toJSON(e) : undefined); + } else { + obj.grants = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGranteeGrantsResponse { + const message = createBaseQueryGranteeGrantsResponse(); + message.grants = object.grants?.map((e) => GrantAuthorization.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Returns list of `Authorization`, granted to the grantee by the granter. */ + Grants(request: QueryGrantsRequest): Promise; + /** + * GranterGrants returns list of `GrantAuthorization`, granted by granter. + * + * Since: cosmos-sdk 0.46 + */ + GranterGrants(request: QueryGranterGrantsRequest): Promise; + /** + * GranteeGrants returns a list of `GrantAuthorization` by grantee. + * + * Since: cosmos-sdk 0.46 + */ + GranteeGrants(request: QueryGranteeGrantsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.authz.v1beta1.Query"; + this.rpc = rpc; + this.Grants = this.Grants.bind(this); + this.GranterGrants = this.GranterGrants.bind(this); + this.GranteeGrants = this.GranteeGrants.bind(this); + } + Grants(request: QueryGrantsRequest): Promise { + const data = QueryGrantsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Grants", data); + return promise.then((data) => QueryGrantsResponse.decode(new _m0.Reader(data))); + } + + GranterGrants(request: QueryGranterGrantsRequest): Promise { + const data = QueryGranterGrantsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GranterGrants", data); + return promise.then((data) => QueryGranterGrantsResponse.decode(new _m0.Reader(data))); + } + + GranteeGrants(request: QueryGranteeGrantsRequest): Promise { + const data = QueryGranteeGrantsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GranteeGrants", data); + return promise.then((data) => QueryGranteeGrantsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/authz/v1beta1/tx.ts b/common/types/src/lcd/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 00000000..8341fcff --- /dev/null +++ b/common/types/src/lcd/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,495 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Grant } from "./authz"; + +export const protobufPackage = "cosmos.authz.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** + * 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; +} + +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} + +/** + * 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; + /** + * Authorization Msg requests to execute. Each msg must implement Authorization interface + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: Any[]; +} + +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse { +} + +/** + * 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; + msg_type_url: string; +} + +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponse { +} + +function createBaseMsgGrant(): MsgGrant { + return { granter: "", grantee: "", grant: undefined }; +} + +export const MsgGrant = { + encode(message: MsgGrant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgGrant { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined, + }; + }, + + toJSON(message: MsgGrant): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.grant !== undefined && (obj.grant = message.grant ? Grant.toJSON(message.grant) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return { results: [] }; +} + +export const MsgExecResponse = { + encode(message: MsgExecResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgExecResponse { + return { results: Array.isArray(object?.results) ? object.results.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.results = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { grantee: "", msgs: [] }; +} + +export const MsgExec = { + encode(message: MsgExec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + grantee: isSet(object.grantee) ? String(object.grantee) : "", + msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + message.grantee !== undefined && (obj.grantee = message.grantee); + if (message.msgs) { + obj.msgs = message.msgs.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.msgs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} + +export const MsgGrantResponse = { + encode(_: MsgGrantResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgGrantResponse { + return {}; + }, + + toJSON(_: MsgGrantResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, +}; + +function createBaseMsgRevoke(): MsgRevoke { + return { granter: "", grantee: "", msg_type_url: "" }; +} + +export const MsgRevoke = { + encode(message: MsgRevoke, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msg_type_url !== "") { + writer.uint32(26).string(message.msg_type_url); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_type_url = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgRevoke { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "", + }; + }, + + toJSON(message: MsgRevoke): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.msg_type_url !== undefined && (obj.msg_type_url = message.msg_type_url); + return obj; + }, + + fromPartial, I>>(object: I): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msg_type_url = object.msg_type_url ?? ""; + return message; + }, +}; + +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} + +export const MsgRevokeResponse = { + encode(_: MsgRevokeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgRevokeResponse { + return {}; + }, + + toJSON(_: MsgRevokeResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgRevokeResponse { + const message = createBaseMsgRevokeResponse(); + return message; + }, +}; + +/** Msg defines the authz Msg service. */ +export interface Msg { + /** + * Grant grants the provided authorization to the grantee on the granter's + * account with the provided expiration time. If there is already a grant + * for the given (granter, grantee, Authorization) triple, then the grant + * will be overwritten. + */ + Grant(request: MsgGrant): Promise; + /** + * Exec 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. + */ + Exec(request: MsgExec): Promise; + /** + * Revoke revokes any authorization corresponding to the provided method name on the + * granter's account that has been granted to the grantee. + */ + Revoke(request: MsgRevoke): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.authz.v1beta1.Msg"; + this.rpc = rpc; + this.Grant = this.Grant.bind(this); + this.Exec = this.Exec.bind(this); + this.Revoke = this.Revoke.bind(this); + } + Grant(request: MsgGrant): Promise { + const data = MsgGrant.encode(request).finish(); + const promise = this.rpc.request(this.service, "Grant", data); + return promise.then((data) => MsgGrantResponse.decode(new _m0.Reader(data))); + } + + Exec(request: MsgExec): Promise { + const data = MsgExec.encode(request).finish(); + const promise = this.rpc.request(this.service, "Exec", data); + return promise.then((data) => MsgExecResponse.decode(new _m0.Reader(data))); + } + + Revoke(request: MsgRevoke): Promise { + const data = MsgRevoke.encode(request).finish(); + const promise = this.rpc.request(this.service, "Revoke", data); + return promise.then((data) => MsgRevokeResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/bank/v1beta1/authz.ts b/common/types/src/lcd/cosmos/bank/v1beta1/authz.ts new file mode 100644 index 00000000..ddcc3b3f --- /dev/null +++ b/common/types/src/lcd/cosmos/bank/v1beta1/authz.ts @@ -0,0 +1,79 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** + * SendAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account. + * + * Since: cosmos-sdk 0.43 + */ +export interface SendAuthorization { + spend_limit: Coin[]; +} + +function createBaseSendAuthorization(): SendAuthorization { + return { spend_limit: [] }; +} + +export const SendAuthorization = { + encode(message: SendAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.spend_limit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SendAuthorization { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.spend_limit.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SendAuthorization { + return { + spend_limit: Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: SendAuthorization): unknown { + const obj: any = {}; + if (message.spend_limit) { + obj.spend_limit = message.spend_limit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.spend_limit = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spend_limit = object.spend_limit?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/lcd/cosmos/bank/v1beta1/bank.ts b/common/types/src/lcd/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 00000000..6ad552cf --- /dev/null +++ b/common/types/src/lcd/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,604 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** Params defines the parameters for the bank module. */ +export interface Params { + send_enabled: SendEnabled[]; + default_send_enabled: boolean; +} + +/** + * SendEnabled maps coin denom to a send_enabled status (whether a denom is + * sendable). + */ +export interface SendEnabled { + denom: string; + enabled: boolean; +} + +/** Input models transaction input. */ +export interface Input { + address: string; + coins: Coin[]; +} + +/** Output models transaction outputs. */ +export interface Output { + address: string; + coins: Coin[]; +} + +/** + * 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[]; +} + +/** + * 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[]; +} + +/** + * 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 */ + denom_units: 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 + */ + uri_hash: string; +} + +function createBaseParams(): Params { + return { send_enabled: [], default_send_enabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.send_enabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.default_send_enabled === true) { + writer.uint32(16).bool(message.default_send_enabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.send_enabled.push(SendEnabled.decode(reader, reader.uint32())); + break; + case 2: + message.default_send_enabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + send_enabled: Array.isArray(object?.send_enabled) + ? object.send_enabled.map((e: any) => SendEnabled.fromJSON(e)) + : [], + default_send_enabled: isSet(object.default_send_enabled) ? Boolean(object.default_send_enabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.send_enabled) { + obj.send_enabled = message.send_enabled.map((e) => e ? SendEnabled.toJSON(e) : undefined); + } else { + obj.send_enabled = []; + } + message.default_send_enabled !== undefined && (obj.default_send_enabled = message.default_send_enabled); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.send_enabled = object.send_enabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.default_send_enabled = object.default_send_enabled ?? false; + return message; + }, +}; + +function createBaseSendEnabled(): SendEnabled { + return { denom: "", enabled: false }; +} + +export const SendEnabled = { + encode(message: SendEnabled, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled === true) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SendEnabled { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + enabled: isSet(object.enabled) ? Boolean(object.enabled) : false, + }; + }, + + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.enabled !== undefined && (obj.enabled = message.enabled); + return obj; + }, + + fromPartial, I>>(object: I): SendEnabled { + const message = createBaseSendEnabled(); + message.denom = object.denom ?? ""; + message.enabled = object.enabled ?? false; + return message; + }, +}; + +function createBaseInput(): Input { + return { address: "", coins: [] }; +} + +export const Input = { + encode(message: Input, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Input { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Input { + return { + address: isSet(object.address) ? String(object.address) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Input): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.coins = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Input { + const message = createBaseInput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseOutput(): Output { + return { address: "", coins: [] }; +} + +export const Output = { + encode(message: Output, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Output { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Output { + return { + address: isSet(object.address) ? String(object.address) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Output): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.coins = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Output { + const message = createBaseOutput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSupply(): Supply { + return { total: [] }; +} + +export const Supply = { + encode(message: Supply, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Supply { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Supply { + return { total: Array.isArray(object?.total) ? object.total.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: Supply): unknown { + const obj: any = {}; + if (message.total) { + obj.total = message.total.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.total = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Supply { + const message = createBaseSupply(); + message.total = object.total?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDenomUnit(): DenomUnit { + return { denom: "", exponent: 0, aliases: [] }; +} + +export const DenomUnit = { + encode(message: DenomUnit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DenomUnit { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + exponent: isSet(object.exponent) ? Number(object.exponent) : 0, + aliases: Array.isArray(object?.aliases) ? object.aliases.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.exponent !== undefined && (obj.exponent = Math.round(message.exponent)); + if (message.aliases) { + obj.aliases = message.aliases.map((e) => e); + } else { + obj.aliases = []; + } + return obj; + }, + + fromPartial, I>>(object: I): DenomUnit { + const message = createBaseDenomUnit(); + message.denom = object.denom ?? ""; + message.exponent = object.exponent ?? 0; + message.aliases = object.aliases?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMetadata(): Metadata { + return { description: "", denom_units: [], base: "", display: "", name: "", symbol: "", uri: "", uri_hash: "" }; +} + +export const Metadata = { + encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denom_units) { + 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.uri_hash !== "") { + writer.uint32(66).string(message.uri_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Metadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.denom_units.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.uri_hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + description: isSet(object.description) ? String(object.description) : "", + denom_units: Array.isArray(object?.denom_units) ? object.denom_units.map((e: any) => DenomUnit.fromJSON(e)) : [], + base: isSet(object.base) ? String(object.base) : "", + display: isSet(object.display) ? String(object.display) : "", + name: isSet(object.name) ? String(object.name) : "", + symbol: isSet(object.symbol) ? String(object.symbol) : "", + uri: isSet(object.uri) ? String(object.uri) : "", + uri_hash: isSet(object.uri_hash) ? String(object.uri_hash) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + message.description !== undefined && (obj.description = message.description); + if (message.denom_units) { + obj.denom_units = message.denom_units.map((e) => e ? DenomUnit.toJSON(e) : undefined); + } else { + obj.denom_units = []; + } + message.base !== undefined && (obj.base = message.base); + message.display !== undefined && (obj.display = message.display); + message.name !== undefined && (obj.name = message.name); + message.symbol !== undefined && (obj.symbol = message.symbol); + message.uri !== undefined && (obj.uri = message.uri); + message.uri_hash !== undefined && (obj.uri_hash = message.uri_hash); + return obj; + }, + + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denom_units = object.denom_units?.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.uri_hash = object.uri_hash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/bank/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/bank/v1beta1/genesis.ts new file mode 100644 index 00000000..b0a000e9 --- /dev/null +++ b/common/types/src/lcd/cosmos/bank/v1beta1/genesis.ts @@ -0,0 +1,201 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisState { + /** params defines all the paramaters of the module. */ + params?: Params; + /** balances is an array containing the balances of all the accounts. */ + balances: Balance[]; + /** + * supply represents the total supply. If it is left empty, then supply will be calculated based on the provided + * balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. + */ + supply: Coin[]; + /** denom_metadata defines the metadata of the differents coins. */ + denom_metadata: Metadata[]; +} + +/** + * Balance defines an account address and balance pair used in the bank module's + * genesis state. + */ +export interface Balance { + /** address is the address of the balance holder. */ + address: string; + /** coins defines the different coins this balance holds. */ + coins: Coin[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, balances: [], supply: [], denom_metadata: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.balances) { + Balance.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.denom_metadata) { + Metadata.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.balances.push(Balance.decode(reader, reader.uint32())); + break; + case 3: + message.supply.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.denom_metadata.push(Metadata.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + balances: Array.isArray(object?.balances) ? object.balances.map((e: any) => Balance.fromJSON(e)) : [], + supply: Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + denom_metadata: Array.isArray(object?.denom_metadata) + ? object.denom_metadata.map((e: any) => Metadata.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.balances) { + obj.balances = message.balances.map((e) => e ? Balance.toJSON(e) : undefined); + } else { + obj.balances = []; + } + if (message.supply) { + obj.supply = message.supply.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.supply = []; + } + if (message.denom_metadata) { + obj.denom_metadata = message.denom_metadata.map((e) => e ? Metadata.toJSON(e) : undefined); + } else { + obj.denom_metadata = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.balances = object.balances?.map((e) => Balance.fromPartial(e)) || []; + message.supply = object.supply?.map((e) => Coin.fromPartial(e)) || []; + message.denom_metadata = object.denom_metadata?.map((e) => Metadata.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBalance(): Balance { + return { address: "", coins: [] }; +} + +export const Balance = { + encode(message: Balance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Balance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBalance(); + 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; + }, + + fromJSON(object: any): Balance { + return { + address: isSet(object.address) ? String(object.address) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Balance): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.coins = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Balance { + const message = createBaseBalance(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/bank/v1beta1/query.ts b/common/types/src/lcd/cosmos/bank/v1beta1/query.ts new file mode 100644 index 00000000..5f7176bd --- /dev/null +++ b/common/types/src/lcd/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,1356 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Coin } from "../../base/v1beta1/coin"; +import { Metadata, Params } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** 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; +} + +/** QueryBalanceResponse is the response type for the Query/Balance RPC method. */ +export interface QueryBalanceResponse { + /** balance is the balance of the coin. */ + balance?: Coin; +} + +/** 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; +} + +/** + * 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; +} + +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + */ +export interface QuerySpendableBalancesRequest { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + */ +export interface QuerySpendableBalancesResponse { + /** balances is the spendable balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * 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; +} + +/** + * 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; +} + +/** 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; +} + +/** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfResponse { + /** amount is the supply of the coin. */ + amount?: Coin; +} + +/** QueryParamsRequest defines the request type for querying x/bank parameters. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse defines the response type for querying x/bank parameters. */ +export interface QueryParamsResponse { + params?: Params; +} + +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * 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; +} + +/** 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; +} + +/** + * 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; +} + +/** + * 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; +} + +/** + * 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. + */ +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; +} + +/** QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. */ +export interface QueryDenomOwnersResponse { + denom_owners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { address: "", denom: "" }; +} + +export const QueryBalanceRequest = { + encode(message: QueryBalanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + denom: isSet(object.denom) ? String(object.denom) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + + fromPartial, I>>(object: I): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { balance: undefined }; +} + +export const QueryBalanceResponse = { + encode(message: QueryBalanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + message.balance !== undefined && (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.balance = (object.balance !== undefined && object.balance !== null) + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; + +function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { + return { address: "", pagination: undefined }; +} + +export const QueryAllBalancesRequest = { + encode(message: QueryAllBalancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllBalancesRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllBalancesRequest { + const message = createBaseQueryAllBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { + return { balances: [], pagination: undefined }; +} + +export const QueryAllBalancesResponse = { + encode(message: QueryAllBalancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryAllBalancesResponse { + return { + balances: Array.isArray(object?.balances) ? object.balances.map((e: any) => Coin.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllBalancesResponse): unknown { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.balances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesRequest { + return { address: "", pagination: undefined }; +} + +export const QuerySpendableBalancesRequest = { + encode(message: QuerySpendableBalancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QuerySpendableBalancesRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QuerySpendableBalancesRequest { + const message = createBaseQuerySpendableBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesResponse { + return { balances: [], pagination: undefined }; +} + +export const QuerySpendableBalancesResponse = { + encode(message: QuerySpendableBalancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QuerySpendableBalancesResponse { + return { + balances: Array.isArray(object?.balances) ? object.balances.map((e: any) => Coin.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesResponse): unknown { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.balances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): 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; + }, +}; + +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { pagination: undefined }; +} + +export const QueryTotalSupplyRequest = { + encode(message: QueryTotalSupplyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryTotalSupplyRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryTotalSupplyRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryTotalSupplyRequest { + const message = createBaseQueryTotalSupplyRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { + return { supply: [], pagination: undefined }; +} + +export const QueryTotalSupplyResponse = { + encode(message: QueryTotalSupplyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryTotalSupplyResponse { + return { + supply: Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryTotalSupplyResponse): unknown { + const obj: any = {}; + if (message.supply) { + obj.supply = message.supply.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.supply = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest { + return { denom: "" }; +} + +export const QuerySupplyOfRequest = { + encode(message: QuerySupplyOfRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QuerySupplyOfRequest { + return { denom: isSet(object.denom) ? String(object.denom) : "" }; + }, + + toJSON(message: QuerySupplyOfRequest): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + + fromPartial, I>>(object: I): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { + return { amount: undefined }; +} + +export const QuerySupplyOfResponse = { + encode(message: QuerySupplyOfResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QuerySupplyOfResponse { + return { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; + }, + + toJSON(message: QuerySupplyOfResponse): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QuerySupplyOfResponse { + const message = createBaseQuerySupplyOfResponse(); + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { + return { pagination: undefined }; +} + +export const QueryDenomsMetadataRequest = { + encode(message: QueryDenomsMetadataRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDenomsMetadataRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDenomsMetadataRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDenomsMetadataRequest { + const message = createBaseQueryDenomsMetadataRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse { + return { metadatas: [], pagination: undefined }; +} + +export const QueryDenomsMetadataResponse = { + encode(message: QueryDenomsMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDenomsMetadataResponse { + return { + metadatas: Array.isArray(object?.metadatas) ? object.metadatas.map((e: any) => Metadata.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomsMetadataResponse): unknown { + const obj: any = {}; + if (message.metadatas) { + obj.metadatas = message.metadatas.map((e) => e ? Metadata.toJSON(e) : undefined); + } else { + obj.metadatas = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { + return { denom: "" }; +} + +export const QueryDenomMetadataRequest = { + encode(message: QueryDenomMetadataRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDenomMetadataRequest { + return { denom: isSet(object.denom) ? String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataRequest): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + + fromPartial, I>>(object: I): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { metadata: undefined }; +} + +export const QueryDenomMetadataResponse = { + encode(message: QueryDenomMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDenomMetadataResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataResponse): unknown { + const obj: any = {}; + message.metadata !== undefined && (obj.metadata = message.metadata ? Metadata.toJSON(message.metadata) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest { + return { denom: "", pagination: undefined }; +} + +export const QueryDenomOwnersRequest = { + encode(message: QueryDenomOwnersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryDenomOwnersRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDenomOwnersRequest { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersRequest): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDenomOwnersRequest { + const message = createBaseQueryDenomOwnersRequest(); + message.denom = object.denom ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseDenomOwner(): DenomOwner { + return { address: "", balance: undefined }; +} + +export const DenomOwner = { + encode(message: DenomOwner, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): DenomOwner { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DenomOwner { + return { + address: isSet(object.address) ? String(object.address) : "", + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, + }; + }, + + toJSON(message: DenomOwner): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.balance !== undefined && (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DenomOwner { + const message = createBaseDenomOwner(); + message.address = object.address ?? ""; + message.balance = (object.balance !== undefined && object.balance !== null) + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; + +function createBaseQueryDenomOwnersResponse(): QueryDenomOwnersResponse { + return { denom_owners: [], pagination: undefined }; +} + +export const QueryDenomOwnersResponse = { + encode(message: QueryDenomOwnersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.denom_owners) { + 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: _m0.Reader | Uint8Array, length?: number): QueryDenomOwnersResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.denom_owners.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; + }, + + fromJSON(object: any): QueryDenomOwnersResponse { + return { + denom_owners: Array.isArray(object?.denom_owners) + ? object.denom_owners.map((e: any) => DenomOwner.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomOwnersResponse): unknown { + const obj: any = {}; + if (message.denom_owners) { + obj.denom_owners = message.denom_owners.map((e) => e ? DenomOwner.toJSON(e) : undefined); + } else { + obj.denom_owners = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denom_owners = object.denom_owners?.map((e) => DenomOwner.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Balance queries the balance of a single coin for a single account. */ + Balance(request: QueryBalanceRequest): Promise; + /** AllBalances queries the balance of all coins for a single account. */ + AllBalances(request: QueryAllBalancesRequest): Promise; + /** + * SpendableBalances queries the spenable balance of all coins for a single + * account. + */ + SpendableBalances(request: QuerySpendableBalancesRequest): Promise; + /** TotalSupply queries the total supply of all coins. */ + TotalSupply(request: QueryTotalSupplyRequest): Promise; + /** SupplyOf queries the supply of a single coin. */ + SupplyOf(request: QuerySupplyOfRequest): Promise; + /** Params queries the parameters of x/bank module. */ + Params(request: QueryParamsRequest): Promise; + /** DenomsMetadata queries the client metadata of a given coin denomination. */ + DenomMetadata(request: QueryDenomMetadataRequest): Promise; + /** + * DenomsMetadata queries the client metadata for all registered coin + * denominations. + */ + DenomsMetadata(request: QueryDenomsMetadataRequest): Promise; + /** + * DenomOwners queries for all account addresses that own a particular token + * denomination. + */ + DenomOwners(request: QueryDenomOwnersRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.bank.v1beta1.Query"; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.AllBalances = this.AllBalances.bind(this); + this.SpendableBalances = this.SpendableBalances.bind(this); + this.TotalSupply = this.TotalSupply.bind(this); + this.SupplyOf = this.SupplyOf.bind(this); + this.Params = this.Params.bind(this); + this.DenomMetadata = this.DenomMetadata.bind(this); + this.DenomsMetadata = this.DenomsMetadata.bind(this); + this.DenomOwners = this.DenomOwners.bind(this); + } + Balance(request: QueryBalanceRequest): Promise { + const data = QueryBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Balance", data); + return promise.then((data) => QueryBalanceResponse.decode(new _m0.Reader(data))); + } + + AllBalances(request: QueryAllBalancesRequest): Promise { + const data = QueryAllBalancesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AllBalances", data); + return promise.then((data) => QueryAllBalancesResponse.decode(new _m0.Reader(data))); + } + + SpendableBalances(request: QuerySpendableBalancesRequest): Promise { + const data = QuerySpendableBalancesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SpendableBalances", data); + return promise.then((data) => QuerySpendableBalancesResponse.decode(new _m0.Reader(data))); + } + + TotalSupply(request: QueryTotalSupplyRequest): Promise { + const data = QueryTotalSupplyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TotalSupply", data); + return promise.then((data) => QueryTotalSupplyResponse.decode(new _m0.Reader(data))); + } + + SupplyOf(request: QuerySupplyOfRequest): Promise { + const data = QuerySupplyOfRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SupplyOf", data); + return promise.then((data) => QuerySupplyOfResponse.decode(new _m0.Reader(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + DenomMetadata(request: QueryDenomMetadataRequest): Promise { + const data = QueryDenomMetadataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomMetadata", data); + return promise.then((data) => QueryDenomMetadataResponse.decode(new _m0.Reader(data))); + } + + DenomsMetadata(request: QueryDenomsMetadataRequest): Promise { + const data = QueryDenomsMetadataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomsMetadata", data); + return promise.then((data) => QueryDenomsMetadataResponse.decode(new _m0.Reader(data))); + } + + DenomOwners(request: QueryDenomOwnersRequest): Promise { + const data = QueryDenomOwnersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DenomOwners", data); + return promise.then((data) => QueryDenomOwnersResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/bank/v1beta1/tx.ts b/common/types/src/lcd/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 00000000..034e8c6e --- /dev/null +++ b/common/types/src/lcd/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,291 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Input, Output } from "./bank"; + +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSend { + from_address: string; + to_address: string; + amount: Coin[]; +} + +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponse { +} + +/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ +export interface MsgMultiSend { + inputs: Input[]; + outputs: Output[]; +} + +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponse { +} + +function createBaseMsgSend(): MsgSend { + return { from_address: "", to_address: "", amount: [] }; +} + +export const MsgSend = { + encode(message: MsgSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.from_address = reader.string(); + break; + case 2: + message.to_address = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + from_address: isSet(object.from_address) ? String(object.from_address) : "", + to_address: isSet(object.to_address) ? String(object.to_address) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + message.from_address !== undefined && (obj.from_address = message.from_address); + message.to_address !== undefined && (obj.to_address = message.to_address); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse = { + encode(_: MsgSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +function createBaseMsgMultiSend(): MsgMultiSend { + return { inputs: [], outputs: [] }; +} + +export const MsgMultiSend = { + encode(message: MsgMultiSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgMultiSend { + return { + inputs: Array.isArray(object?.inputs) ? object.inputs.map((e: any) => Input.fromJSON(e)) : [], + outputs: Array.isArray(object?.outputs) ? object.outputs.map((e: any) => Output.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgMultiSend): unknown { + const obj: any = {}; + if (message.inputs) { + obj.inputs = message.inputs.map((e) => e ? Input.toJSON(e) : undefined); + } else { + obj.inputs = []; + } + if (message.outputs) { + obj.outputs = message.outputs.map((e) => e ? Output.toJSON(e) : undefined); + } else { + obj.outputs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgMultiSend { + const message = createBaseMsgMultiSend(); + message.inputs = object.inputs?.map((e) => Input.fromPartial(e)) || []; + message.outputs = object.outputs?.map((e) => Output.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgMultiSendResponse(): MsgMultiSendResponse { + return {}; +} + +export const MsgMultiSendResponse = { + encode(_: MsgMultiSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgMultiSendResponse { + return {}; + }, + + toJSON(_: MsgMultiSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** Send defines a method for sending coins from one account to another account. */ + Send(request: MsgSend): Promise; + /** MultiSend defines a method for sending coins from some accounts to other accounts. */ + MultiSend(request: MsgMultiSend): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.bank.v1beta1.Msg"; + this.rpc = rpc; + this.Send = this.Send.bind(this); + this.MultiSend = this.MultiSend.bind(this); + } + Send(request: MsgSend): Promise { + const data = MsgSend.encode(request).finish(); + const promise = this.rpc.request(this.service, "Send", data); + return promise.then((data) => MsgSendResponse.decode(new _m0.Reader(data))); + } + + MultiSend(request: MsgMultiSend): Promise { + const data = MsgMultiSend.encode(request).finish(); + const promise = this.rpc.request(this.service, "MultiSend", data); + return promise.then((data) => MsgMultiSendResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/base/abci/v1beta1/abci.ts b/common/types/src/lcd/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 00000000..b3aaa489 --- /dev/null +++ b/common/types/src/lcd/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,1035 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../../google/protobuf/any"; +import { Event } from "../../../../tendermint/abci/types"; + +export const protobufPackage = "cosmos.base.abci.v1beta1"; + +/** + * 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: 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: ABCIMessageLog[]; + /** 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?: 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 handler. 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[]; +} + +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLog { + msg_index: number; + log: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events: StringEvent[]; +} + +/** + * 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[]; +} + +/** + * Attribute defines an attribute wrapper where the key and value are + * strings instead of raw bytes. + */ +export interface Attribute { + key: string; + value: string; +} + +/** GasInfo defines tx execution gas context. */ +export interface GasInfo { + /** 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; +} + +/** 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 + */ + msg_responses: Any[]; +} + +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponse { + gas_info?: GasInfo; + result?: Result; +} + +/** + * MsgData defines the data returned in a Result object during message + * execution. + * + * @deprecated + */ +export interface MsgData { + msg_type: string; + data: Uint8Array; +} + +/** + * 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 + */ + msg_responses: Any[]; +} + +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResult { + /** 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: TxResponse[]; +} + +function createBaseTxResponse(): TxResponse { + return { + height: "0", + txhash: "", + codespace: "", + code: 0, + data: "", + raw_log: "", + logs: [], + info: "", + gas_wanted: "0", + gas_used: "0", + tx: undefined, + timestamp: "", + events: [], + }; +} + +export const TxResponse = { + encode(message: TxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "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.raw_log !== "") { + writer.uint32(50).string(message.raw_log); + } + 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.gas_wanted !== "0") { + writer.uint32(72).int64(message.gas_wanted); + } + if (message.gas_used !== "0") { + writer.uint32(80).int64(message.gas_used); + } + 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: _m0.Reader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + 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.raw_log = reader.string(); + break; + case 7: + message.logs.push(ABCIMessageLog.decode(reader, reader.uint32())); + break; + case 8: + message.info = reader.string(); + break; + case 9: + message.gas_wanted = longToString(reader.int64() as Long); + break; + case 10: + message.gas_used = longToString(reader.int64() as Long); + 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; + }, + + fromJSON(object: any): TxResponse { + return { + height: isSet(object.height) ? String(object.height) : "0", + txhash: isSet(object.txhash) ? String(object.txhash) : "", + codespace: isSet(object.codespace) ? String(object.codespace) : "", + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) ? String(object.data) : "", + raw_log: isSet(object.raw_log) ? String(object.raw_log) : "", + logs: Array.isArray(object?.logs) ? object.logs.map((e: any) => ABCIMessageLog.fromJSON(e)) : [], + info: isSet(object.info) ? String(object.info) : "", + gas_wanted: isSet(object.gas_wanted) ? String(object.gas_wanted) : "0", + gas_used: isSet(object.gas_used) ? String(object.gas_used) : "0", + tx: isSet(object.tx) ? Any.fromJSON(object.tx) : undefined, + timestamp: isSet(object.timestamp) ? String(object.timestamp) : "", + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxResponse): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.txhash !== undefined && (obj.txhash = message.txhash); + message.codespace !== undefined && (obj.codespace = message.codespace); + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && (obj.data = message.data); + message.raw_log !== undefined && (obj.raw_log = message.raw_log); + if (message.logs) { + obj.logs = message.logs.map((e) => e ? ABCIMessageLog.toJSON(e) : undefined); + } else { + obj.logs = []; + } + message.info !== undefined && (obj.info = message.info); + message.gas_wanted !== undefined && (obj.gas_wanted = message.gas_wanted); + message.gas_used !== undefined && (obj.gas_used = message.gas_used); + message.tx !== undefined && (obj.tx = message.tx ? Any.toJSON(message.tx) : undefined); + message.timestamp !== undefined && (obj.timestamp = message.timestamp); + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): TxResponse { + const message = createBaseTxResponse(); + message.height = object.height ?? "0"; + message.txhash = object.txhash ?? ""; + message.codespace = object.codespace ?? ""; + message.code = object.code ?? 0; + message.data = object.data ?? ""; + message.raw_log = object.raw_log ?? ""; + message.logs = object.logs?.map((e) => ABCIMessageLog.fromPartial(e)) || []; + message.info = object.info ?? ""; + message.gas_wanted = object.gas_wanted ?? "0"; + message.gas_used = object.gas_used ?? "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; + }, +}; + +function createBaseABCIMessageLog(): ABCIMessageLog { + return { msg_index: 0, log: "", events: [] }; +} + +export const ABCIMessageLog = { + encode(message: ABCIMessageLog, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg_index !== 0) { + writer.uint32(8).uint32(message.msg_index); + } + 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: _m0.Reader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_index = 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; + }, + + fromJSON(object: any): ABCIMessageLog { + return { + msg_index: isSet(object.msg_index) ? Number(object.msg_index) : 0, + log: isSet(object.log) ? String(object.log) : "", + events: Array.isArray(object?.events) ? object.events.map((e: any) => StringEvent.fromJSON(e)) : [], + }; + }, + + toJSON(message: ABCIMessageLog): unknown { + const obj: any = {}; + message.msg_index !== undefined && (obj.msg_index = Math.round(message.msg_index)); + message.log !== undefined && (obj.log = message.log); + if (message.events) { + obj.events = message.events.map((e) => e ? StringEvent.toJSON(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + message.msg_index = object.msg_index ?? 0; + message.log = object.log ?? ""; + message.events = object.events?.map((e) => StringEvent.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStringEvent(): StringEvent { + return { type: "", attributes: [] }; +} + +export const StringEvent = { + encode(message: StringEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): StringEvent { + return { + type: isSet(object.type) ? String(object.type) : "", + attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [], + }; + }, + + toJSON(message: StringEvent): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + if (message.attributes) { + obj.attributes = message.attributes.map((e) => e ? Attribute.toJSON(e) : undefined); + } else { + obj.attributes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): StringEvent { + const message = createBaseStringEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map((e) => Attribute.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAttribute(): Attribute { + return { key: "", value: "" }; +} + +export const Attribute = { + encode(message: Attribute, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Attribute { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Attribute { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: Attribute): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + fromPartial, I>>(object: I): Attribute { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseGasInfo(): GasInfo { + return { gas_wanted: "0", gas_used: "0" }; +} + +export const GasInfo = { + encode(message: GasInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.gas_wanted !== "0") { + writer.uint32(8).uint64(message.gas_wanted); + } + if (message.gas_used !== "0") { + writer.uint32(16).uint64(message.gas_used); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.gas_wanted = longToString(reader.uint64() as Long); + break; + case 2: + message.gas_used = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GasInfo { + return { + gas_wanted: isSet(object.gas_wanted) ? String(object.gas_wanted) : "0", + gas_used: isSet(object.gas_used) ? String(object.gas_used) : "0", + }; + }, + + toJSON(message: GasInfo): unknown { + const obj: any = {}; + message.gas_wanted !== undefined && (obj.gas_wanted = message.gas_wanted); + message.gas_used !== undefined && (obj.gas_used = message.gas_used); + return obj; + }, + + fromPartial, I>>(object: I): GasInfo { + const message = createBaseGasInfo(); + message.gas_wanted = object.gas_wanted ?? "0"; + message.gas_used = object.gas_used ?? "0"; + return message; + }, +}; + +function createBaseResult(): Result { + return { data: new Uint8Array(), log: "", events: [], msg_responses: [] }; +} + +export const Result = { + encode(message: Result, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.msg_responses) { + Any.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Result { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_responses.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Result { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + msg_responses: Array.isArray(object?.msg_responses) ? object.msg_responses.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: Result): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + if (message.msg_responses) { + obj.msg_responses = message.msg_responses.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.msg_responses = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Result { + const message = createBaseResult(); + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.msg_responses = object.msg_responses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSimulationResponse(): SimulationResponse { + return { gas_info: undefined, result: undefined }; +} + +export const SimulationResponse = { + encode(message: SimulationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.gas_info !== undefined) { + GasInfo.encode(message.gas_info, writer.uint32(10).fork()).ldelim(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.gas_info = GasInfo.decode(reader, reader.uint32()); + break; + case 2: + message.result = Result.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SimulationResponse { + return { + gas_info: isSet(object.gas_info) ? GasInfo.fromJSON(object.gas_info) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulationResponse): unknown { + const obj: any = {}; + message.gas_info !== undefined && (obj.gas_info = message.gas_info ? GasInfo.toJSON(message.gas_info) : undefined); + message.result !== undefined && (obj.result = message.result ? Result.toJSON(message.result) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): SimulationResponse { + const message = createBaseSimulationResponse(); + message.gas_info = (object.gas_info !== undefined && object.gas_info !== null) + ? GasInfo.fromPartial(object.gas_info) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseMsgData(): MsgData { + return { msg_type: "", data: new Uint8Array() }; +} + +export const MsgData = { + encode(message: MsgData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg_type !== "") { + writer.uint32(10).string(message.msg_type); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_type = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgData { + return { + msg_type: isSet(object.msg_type) ? String(object.msg_type) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + }; + }, + + toJSON(message: MsgData): unknown { + const obj: any = {}; + message.msg_type !== undefined && (obj.msg_type = message.msg_type); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): MsgData { + const message = createBaseMsgData(); + message.msg_type = object.msg_type ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; + +function createBaseTxMsgData(): TxMsgData { + return { data: [], msg_responses: [] }; +} + +export const TxMsgData = { + encode(message: TxMsgData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.data) { + MsgData.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.msg_responses) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.msg_responses.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TxMsgData { + return { + data: Array.isArray(object?.data) ? object.data.map((e: any) => MsgData.fromJSON(e)) : [], + msg_responses: Array.isArray(object?.msg_responses) ? object.msg_responses.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxMsgData): unknown { + const obj: any = {}; + if (message.data) { + obj.data = message.data.map((e) => e ? MsgData.toJSON(e) : undefined); + } else { + obj.data = []; + } + if (message.msg_responses) { + obj.msg_responses = message.msg_responses.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.msg_responses = []; + } + return obj; + }, + + fromPartial, I>>(object: I): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map((e) => MsgData.fromPartial(e)) || []; + message.msg_responses = object.msg_responses?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSearchTxsResult(): SearchTxsResult { + return { total_count: "0", count: "0", page_number: "0", page_total: "0", limit: "0", txs: [] }; +} + +export const SearchTxsResult = { + encode(message: SearchTxsResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.total_count !== "0") { + writer.uint32(8).uint64(message.total_count); + } + if (message.count !== "0") { + writer.uint32(16).uint64(message.count); + } + if (message.page_number !== "0") { + writer.uint32(24).uint64(message.page_number); + } + if (message.page_total !== "0") { + writer.uint32(32).uint64(message.page_total); + } + if (message.limit !== "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: _m0.Reader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.total_count = longToString(reader.uint64() as Long); + break; + case 2: + message.count = longToString(reader.uint64() as Long); + break; + case 3: + message.page_number = longToString(reader.uint64() as Long); + break; + case 4: + message.page_total = longToString(reader.uint64() as Long); + break; + case 5: + message.limit = longToString(reader.uint64() as Long); + break; + case 6: + message.txs.push(TxResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SearchTxsResult { + return { + total_count: isSet(object.total_count) ? String(object.total_count) : "0", + count: isSet(object.count) ? String(object.count) : "0", + page_number: isSet(object.page_number) ? String(object.page_number) : "0", + page_total: isSet(object.page_total) ? String(object.page_total) : "0", + limit: isSet(object.limit) ? String(object.limit) : "0", + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => TxResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchTxsResult): unknown { + const obj: any = {}; + message.total_count !== undefined && (obj.total_count = message.total_count); + message.count !== undefined && (obj.count = message.count); + message.page_number !== undefined && (obj.page_number = message.page_number); + message.page_total !== undefined && (obj.page_total = message.page_total); + message.limit !== undefined && (obj.limit = message.limit); + if (message.txs) { + obj.txs = message.txs.map((e) => e ? TxResponse.toJSON(e) : undefined); + } else { + obj.txs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SearchTxsResult { + const message = createBaseSearchTxsResult(); + message.total_count = object.total_count ?? "0"; + message.count = object.count ?? "0"; + message.page_number = object.page_number ?? "0"; + message.page_total = object.page_total ?? "0"; + message.limit = object.limit ?? "0"; + message.txs = object.txs?.map((e) => TxResponse.fromPartial(e)) || []; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/base/kv/v1beta1/kv.ts b/common/types/src/lcd/cosmos/base/kv/v1beta1/kv.ts new file mode 100644 index 00000000..c9269e4c --- /dev/null +++ b/common/types/src/lcd/cosmos/base/kv/v1beta1/kv.ts @@ -0,0 +1,185 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.kv.v1beta1"; + +/** Pairs defines a repeated slice of Pair objects. */ +export interface Pairs { + pairs: Pair[]; +} + +/** Pair defines a key/value bytes tuple. */ +export interface Pair { + key: Uint8Array; + value: Uint8Array; +} + +function createBasePairs(): Pairs { + return { pairs: [] }; +} + +export const Pairs = { + encode(message: Pairs, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pairs) { + Pair.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Pairs { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pairs.push(Pair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Pairs { + return { pairs: Array.isArray(object?.pairs) ? object.pairs.map((e: any) => Pair.fromJSON(e)) : [] }; + }, + + toJSON(message: Pairs): unknown { + const obj: any = {}; + if (message.pairs) { + obj.pairs = message.pairs.map((e) => e ? Pair.toJSON(e) : undefined); + } else { + obj.pairs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Pairs { + const message = createBasePairs(); + message.pairs = object.pairs?.map((e) => Pair.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePair(): Pair { + return { key: new Uint8Array(), value: new Uint8Array() }; +} + +export const Pair = { + encode(message: Pair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Pair { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePair(); + 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; + }, + + fromJSON(object: any): Pair { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + }; + }, + + toJSON(message: Pair): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): Pair { + const message = createBasePair(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/base/query/v1beta1/pagination.ts b/common/types/src/lcd/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..f35cb45d --- /dev/null +++ b/common/types/src/lcd/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,283 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * 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: 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; +} + +/** + * 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. + */ + next_key: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: string; +} + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(), offset: "0", limit: "0", count_total: false, reverse: false }; +} + +export const PageRequest = { + encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== "0") { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== "0") { + writer.uint32(24).uint64(message.limit); + } + if (message.count_total === true) { + writer.uint32(32).bool(message.count_total); + } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 3: + message.limit = longToString(reader.uint64() as Long); + break; + case 4: + message.count_total = reader.bool(); + break; + case 5: + message.reverse = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + offset: isSet(object.offset) ? String(object.offset) : "0", + limit: isSet(object.limit) ? String(object.limit) : "0", + count_total: isSet(object.count_total) ? Boolean(object.count_total) : false, + reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.offset !== undefined && (obj.offset = message.offset); + message.limit !== undefined && (obj.limit = message.limit); + message.count_total !== undefined && (obj.count_total = message.count_total); + message.reverse !== undefined && (obj.reverse = message.reverse); + return obj; + }, + + fromPartial, I>>(object: I): PageRequest { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(); + message.offset = object.offset ?? "0"; + message.limit = object.limit ?? "0"; + message.count_total = object.count_total ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +function createBasePageResponse(): PageResponse { + return { next_key: new Uint8Array(), total: "0" }; +} + +export const PageResponse = { + encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.next_key.length !== 0) { + writer.uint32(10).bytes(message.next_key); + } + if (message.total !== "0") { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.next_key = reader.bytes(); + break; + case 2: + message.total = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + next_key: isSet(object.next_key) ? bytesFromBase64(object.next_key) : new Uint8Array(), + total: isSet(object.total) ? String(object.total) : "0", + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + message.next_key !== undefined && + (obj.next_key = base64FromBytes(message.next_key !== undefined ? message.next_key : new Uint8Array())); + message.total !== undefined && (obj.total = message.total); + return obj; + }, + + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.next_key = object.next_key ?? new Uint8Array(); + message.total = object.total ?? "0"; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/base/reflection/v1beta1/reflection.ts b/common/types/src/lcd/cosmos/base/reflection/v1beta1/reflection.ts new file mode 100644 index 00000000..b9491b68 --- /dev/null +++ b/common/types/src/lcd/cosmos/base/reflection/v1beta1/reflection.ts @@ -0,0 +1,280 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.reflection.v1beta1"; + +/** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ +export interface ListAllInterfacesRequest { +} + +/** ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. */ +export interface ListAllInterfacesResponse { + /** interface_names is an array of all the registered interfaces. */ + interface_names: string[]; +} + +/** + * ListImplementationsRequest is the request type of the ListImplementations + * RPC. + */ +export interface ListImplementationsRequest { + /** interface_name defines the interface to query the implementations for. */ + interface_name: string; +} + +/** + * ListImplementationsResponse is the response type of the ListImplementations + * RPC. + */ +export interface ListImplementationsResponse { + implementation_message_names: string[]; +} + +function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { + return {}; +} + +export const ListAllInterfacesRequest = { + encode(_: ListAllInterfacesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListAllInterfacesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): ListAllInterfacesRequest { + return {}; + }, + + toJSON(_: ListAllInterfacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): ListAllInterfacesRequest { + const message = createBaseListAllInterfacesRequest(); + return message; + }, +}; + +function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { + return { interface_names: [] }; +} + +export const ListAllInterfacesResponse = { + encode(message: ListAllInterfacesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.interface_names) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListAllInterfacesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.interface_names.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ListAllInterfacesResponse { + return { + interface_names: Array.isArray(object?.interface_names) ? object.interface_names.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: ListAllInterfacesResponse): unknown { + const obj: any = {}; + if (message.interface_names) { + obj.interface_names = message.interface_names.map((e) => e); + } else { + obj.interface_names = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ListAllInterfacesResponse { + const message = createBaseListAllInterfacesResponse(); + message.interface_names = object.interface_names?.map((e) => e) || []; + return message; + }, +}; + +function createBaseListImplementationsRequest(): ListImplementationsRequest { + return { interface_name: "" }; +} + +export const ListImplementationsRequest = { + encode(message: ListImplementationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.interface_name !== "") { + writer.uint32(10).string(message.interface_name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListImplementationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListImplementationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.interface_name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ListImplementationsRequest { + return { interface_name: isSet(object.interface_name) ? String(object.interface_name) : "" }; + }, + + toJSON(message: ListImplementationsRequest): unknown { + const obj: any = {}; + message.interface_name !== undefined && (obj.interface_name = message.interface_name); + return obj; + }, + + fromPartial, I>>(object: I): ListImplementationsRequest { + const message = createBaseListImplementationsRequest(); + message.interface_name = object.interface_name ?? ""; + return message; + }, +}; + +function createBaseListImplementationsResponse(): ListImplementationsResponse { + return { implementation_message_names: [] }; +} + +export const ListImplementationsResponse = { + encode(message: ListImplementationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.implementation_message_names) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListImplementationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListImplementationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.implementation_message_names.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ListImplementationsResponse { + return { + implementation_message_names: Array.isArray(object?.implementation_message_names) + ? object.implementation_message_names.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: ListImplementationsResponse): unknown { + const obj: any = {}; + if (message.implementation_message_names) { + obj.implementation_message_names = message.implementation_message_names.map((e) => e); + } else { + obj.implementation_message_names = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ListImplementationsResponse { + const message = createBaseListImplementationsResponse(); + message.implementation_message_names = object.implementation_message_names?.map((e) => e) || []; + return message; + }, +}; + +/** ReflectionService defines a service for interface reflection. */ +export interface ReflectionService { + /** + * ListAllInterfaces lists all the interfaces registered in the interface + * registry. + */ + ListAllInterfaces(request: ListAllInterfacesRequest): Promise; + /** + * ListImplementations list all the concrete types that implement a given + * interface. + */ + ListImplementations(request: ListImplementationsRequest): Promise; +} + +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.base.reflection.v1beta1.ReflectionService"; + this.rpc = rpc; + this.ListAllInterfaces = this.ListAllInterfaces.bind(this); + this.ListImplementations = this.ListImplementations.bind(this); + } + ListAllInterfaces(request: ListAllInterfacesRequest): Promise { + const data = ListAllInterfacesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListAllInterfaces", data); + return promise.then((data) => ListAllInterfacesResponse.decode(new _m0.Reader(data))); + } + + ListImplementations(request: ListImplementationsRequest): Promise { + const data = ListImplementationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListImplementations", data); + return promise.then((data) => ListImplementationsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/base/reflection/v2alpha1/reflection.ts b/common/types/src/lcd/cosmos/base/reflection/v2alpha1/reflection.ts new file mode 100644 index 00000000..61d766d8 --- /dev/null +++ b/common/types/src/lcd/cosmos/base/reflection/v2alpha1/reflection.ts @@ -0,0 +1,1750 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.reflection.v2alpha1"; + +/** Since: cosmos-sdk 0.43 */ + +/** AppDescriptor describes a cosmos-sdk based application */ +export interface AppDescriptor { + /** + * AuthnDescriptor provides information on how to authenticate transactions on the application + * NOTE: experimental and subject to change in future releases. + */ + authn?: AuthnDescriptor; + /** chain provides the chain descriptor */ + chain?: ChainDescriptor; + /** codec provides metadata information regarding codec related types */ + codec?: CodecDescriptor; + /** configuration provides metadata information regarding the sdk.Config type */ + configuration?: ConfigurationDescriptor; + /** query_services provides metadata information regarding the available queriable endpoints */ + query_services?: QueryServicesDescriptor; + /** tx provides metadata information regarding how to send transactions to the given application */ + tx?: TxDescriptor; +} + +/** TxDescriptor describes the accepted transaction type */ +export interface TxDescriptor { + /** + * fullname is the protobuf fullname of the raw transaction type (for instance the tx.Tx type) + * it is not meant to support polymorphism of transaction types, it is supposed to be used by + * reflection clients to understand if they can handle a specific transaction type in an application. + */ + fullname: string; + /** msgs lists the accepted application messages (sdk.Msg) */ + msgs: MsgDescriptor[]; +} + +/** + * AuthnDescriptor provides information on how to sign transactions without relying + * on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures + */ +export interface AuthnDescriptor { + /** sign_modes defines the supported signature algorithm */ + sign_modes: SigningModeDescriptor[]; +} + +/** + * SigningModeDescriptor provides information on a signing flow of the application + * NOTE(fdymylja): here we could go as far as providing an entire flow on how + * to sign a message given a SigningModeDescriptor, but it's better to think about + * this another time + */ +export interface SigningModeDescriptor { + /** name defines the unique name of the signing mode */ + name: string; + /** number is the unique int32 identifier for the sign_mode enum */ + number: number; + /** + * authn_info_provider_method_fullname defines the fullname of the method to call to get + * the metadata required to authenticate using the provided sign_modes + */ + authn_info_provider_method_fullname: string; +} + +/** ChainDescriptor describes chain information of the application */ +export interface ChainDescriptor { + /** id is the chain id */ + id: string; +} + +/** CodecDescriptor describes the registered interfaces and provides metadata information on the types */ +export interface CodecDescriptor { + /** interfaces is a list of the registerted interfaces descriptors */ + interfaces: InterfaceDescriptor[]; +} + +/** InterfaceDescriptor describes the implementation of an interface */ +export interface InterfaceDescriptor { + /** fullname is the name of the interface */ + fullname: string; + /** + * interface_accepting_messages contains information regarding the proto messages which contain the interface as + * google.protobuf.Any field + */ + interface_accepting_messages: InterfaceAcceptingMessageDescriptor[]; + /** interface_implementers is a list of the descriptors of the interface implementers */ + interface_implementers: InterfaceImplementerDescriptor[]; +} + +/** InterfaceImplementerDescriptor describes an interface implementer */ +export interface InterfaceImplementerDescriptor { + /** fullname is the protobuf queryable name of the interface implementer */ + fullname: string; + /** + * type_url defines the type URL used when marshalling the type as any + * this is required so we can provide type safe google.protobuf.Any marshalling and + * unmarshalling, making sure that we don't accept just 'any' type + * in our interface fields + */ + type_url: string; +} + +/** + * InterfaceAcceptingMessageDescriptor describes a protobuf message which contains + * an interface represented as a google.protobuf.Any + */ +export interface InterfaceAcceptingMessageDescriptor { + /** fullname is the protobuf fullname of the type containing the interface */ + fullname: string; + /** + * field_descriptor_names is a list of the protobuf name (not fullname) of the field + * which contains the interface as google.protobuf.Any (the interface is the same, but + * it can be in multiple fields of the same proto message) + */ + field_descriptor_names: string[]; +} + +/** ConfigurationDescriptor contains metadata information on the sdk.Config */ +export interface ConfigurationDescriptor { + /** bech32_account_address_prefix is the account address prefix */ + bech32_account_address_prefix: string; +} + +/** MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction */ +export interface MsgDescriptor { + /** msg_type_url contains the TypeURL of a sdk.Msg. */ + msg_type_url: string; +} + +/** GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC */ +export interface GetAuthnDescriptorRequest { +} + +/** GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC */ +export interface GetAuthnDescriptorResponse { + /** authn describes how to authenticate to the application when sending transactions */ + authn?: AuthnDescriptor; +} + +/** GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC */ +export interface GetChainDescriptorRequest { +} + +/** GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC */ +export interface GetChainDescriptorResponse { + /** chain describes application chain information */ + chain?: ChainDescriptor; +} + +/** GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC */ +export interface GetCodecDescriptorRequest { +} + +/** GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC */ +export interface GetCodecDescriptorResponse { + /** codec describes the application codec such as registered interfaces and implementations */ + codec?: CodecDescriptor; +} + +/** GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC */ +export interface GetConfigurationDescriptorRequest { +} + +/** GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC */ +export interface GetConfigurationDescriptorResponse { + /** config describes the application's sdk.Config */ + config?: ConfigurationDescriptor; +} + +/** GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC */ +export interface GetQueryServicesDescriptorRequest { +} + +/** GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC */ +export interface GetQueryServicesDescriptorResponse { + /** queries provides information on the available queryable services */ + queries?: QueryServicesDescriptor; +} + +/** GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC */ +export interface GetTxDescriptorRequest { +} + +/** GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC */ +export interface GetTxDescriptorResponse { + /** + * tx provides information on msgs that can be forwarded to the application + * alongside the accepted transaction protobuf type + */ + tx?: TxDescriptor; +} + +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptor { + /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + query_services: QueryServiceDescriptor[]; +} + +/** QueryServiceDescriptor describes a cosmos-sdk queryable service */ +export interface QueryServiceDescriptor { + /** fullname is the protobuf fullname of the service descriptor */ + fullname: string; + /** is_module describes if this service is actually exposed by an application's module */ + is_module: boolean; + /** methods provides a list of query service methods */ + methods: QueryMethodDescriptor[]; +} + +/** + * QueryMethodDescriptor describes a queryable method of a query service + * no other info is provided beside method name and tendermint queryable path + * because it would be redundant with the grpc reflection service + */ +export interface QueryMethodDescriptor { + /** name is the protobuf name (not fullname) of the method */ + name: string; + /** + * full_query_path is the path that can be used to query + * this method via tendermint abci.Query + */ + full_query_path: string; +} + +function createBaseAppDescriptor(): AppDescriptor { + return { + authn: undefined, + chain: undefined, + codec: undefined, + configuration: undefined, + query_services: undefined, + tx: undefined, + }; +} + +export const AppDescriptor = { + encode(message: AppDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); + } + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(18).fork()).ldelim(); + } + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(26).fork()).ldelim(); + } + if (message.configuration !== undefined) { + ConfigurationDescriptor.encode(message.configuration, writer.uint32(34).fork()).ldelim(); + } + if (message.query_services !== undefined) { + QueryServicesDescriptor.encode(message.query_services, writer.uint32(42).fork()).ldelim(); + } + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AppDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + break; + case 2: + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + break; + case 3: + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + break; + case 4: + message.configuration = ConfigurationDescriptor.decode(reader, reader.uint32()); + break; + case 5: + message.query_services = QueryServicesDescriptor.decode(reader, reader.uint32()); + break; + case 6: + message.tx = TxDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AppDescriptor { + return { + authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined, + chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined, + codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined, + configuration: isSet(object.configuration) ? ConfigurationDescriptor.fromJSON(object.configuration) : undefined, + query_services: isSet(object.query_services) + ? QueryServicesDescriptor.fromJSON(object.query_services) + : undefined, + tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined, + }; + }, + + toJSON(message: AppDescriptor): unknown { + const obj: any = {}; + message.authn !== undefined && (obj.authn = message.authn ? AuthnDescriptor.toJSON(message.authn) : undefined); + message.chain !== undefined && (obj.chain = message.chain ? ChainDescriptor.toJSON(message.chain) : undefined); + message.codec !== undefined && (obj.codec = message.codec ? CodecDescriptor.toJSON(message.codec) : undefined); + message.configuration !== undefined && + (obj.configuration = message.configuration ? ConfigurationDescriptor.toJSON(message.configuration) : undefined); + message.query_services !== undefined && + (obj.query_services = message.query_services + ? QueryServicesDescriptor.toJSON(message.query_services) + : undefined); + message.tx !== undefined && (obj.tx = message.tx ? TxDescriptor.toJSON(message.tx) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): AppDescriptor { + const message = createBaseAppDescriptor(); + message.authn = (object.authn !== undefined && object.authn !== null) + ? AuthnDescriptor.fromPartial(object.authn) + : undefined; + message.chain = (object.chain !== undefined && object.chain !== null) + ? ChainDescriptor.fromPartial(object.chain) + : undefined; + message.codec = (object.codec !== undefined && object.codec !== null) + ? CodecDescriptor.fromPartial(object.codec) + : undefined; + message.configuration = (object.configuration !== undefined && object.configuration !== null) + ? ConfigurationDescriptor.fromPartial(object.configuration) + : undefined; + message.query_services = (object.query_services !== undefined && object.query_services !== null) + ? QueryServicesDescriptor.fromPartial(object.query_services) + : undefined; + message.tx = (object.tx !== undefined && object.tx !== null) ? TxDescriptor.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseTxDescriptor(): TxDescriptor { + return { fullname: "", msgs: [] }; +} + +export const TxDescriptor = { + encode(message: TxDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.msgs) { + MsgDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullname = reader.string(); + break; + case 2: + message.msgs.push(MsgDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TxDescriptor { + return { + fullname: isSet(object.fullname) ? String(object.fullname) : "", + msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => MsgDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxDescriptor): unknown { + const obj: any = {}; + message.fullname !== undefined && (obj.fullname = message.fullname); + if (message.msgs) { + obj.msgs = message.msgs.map((e) => e ? MsgDescriptor.toJSON(e) : undefined); + } else { + obj.msgs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): TxDescriptor { + const message = createBaseTxDescriptor(); + message.fullname = object.fullname ?? ""; + message.msgs = object.msgs?.map((e) => MsgDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAuthnDescriptor(): AuthnDescriptor { + return { sign_modes: [] }; +} + +export const AuthnDescriptor = { + encode(message: AuthnDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.sign_modes) { + SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AuthnDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthnDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sign_modes.push(SigningModeDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AuthnDescriptor { + return { + sign_modes: Array.isArray(object?.sign_modes) + ? object.sign_modes.map((e: any) => SigningModeDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AuthnDescriptor): unknown { + const obj: any = {}; + if (message.sign_modes) { + obj.sign_modes = message.sign_modes.map((e) => e ? SigningModeDescriptor.toJSON(e) : undefined); + } else { + obj.sign_modes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.sign_modes = object.sign_modes?.map((e) => SigningModeDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningModeDescriptor(): SigningModeDescriptor { + return { name: "", number: 0, authn_info_provider_method_fullname: "" }; +} + +export const SigningModeDescriptor = { + encode(message: SigningModeDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.authn_info_provider_method_fullname !== "") { + writer.uint32(26).string(message.authn_info_provider_method_fullname); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SigningModeDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSigningModeDescriptor(); + 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.authn_info_provider_method_fullname = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SigningModeDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + authn_info_provider_method_fullname: isSet(object.authn_info_provider_method_fullname) + ? String(object.authn_info_provider_method_fullname) + : "", + }; + }, + + toJSON(message: SigningModeDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.authn_info_provider_method_fullname !== undefined && + (obj.authn_info_provider_method_fullname = message.authn_info_provider_method_fullname); + return obj; + }, + + fromPartial, I>>(object: I): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.authn_info_provider_method_fullname = object.authn_info_provider_method_fullname ?? ""; + return message; + }, +}; + +function createBaseChainDescriptor(): ChainDescriptor { + return { id: "" }; +} + +export const ChainDescriptor = { + encode(message: ChainDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ChainDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChainDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ChainDescriptor { + return { id: isSet(object.id) ? String(object.id) : "" }; + }, + + toJSON(message: ChainDescriptor): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): ChainDescriptor { + const message = createBaseChainDescriptor(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseCodecDescriptor(): CodecDescriptor { + return { interfaces: [] }; +} + +export const CodecDescriptor = { + encode(message: CodecDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.interfaces) { + InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CodecDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodecDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.interfaces.push(InterfaceDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CodecDescriptor { + return { + interfaces: Array.isArray(object?.interfaces) + ? object.interfaces.map((e: any) => InterfaceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: CodecDescriptor): unknown { + const obj: any = {}; + if (message.interfaces) { + obj.interfaces = message.interfaces.map((e) => e ? InterfaceDescriptor.toJSON(e) : undefined); + } else { + obj.interfaces = []; + } + return obj; + }, + + fromPartial, I>>(object: I): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map((e) => InterfaceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { fullname: "", interface_accepting_messages: [], interface_implementers: [] }; +} + +export const InterfaceDescriptor = { + encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.interface_accepting_messages) { + InterfaceAcceptingMessageDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.interface_implementers) { + InterfaceImplementerDescriptor.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.fullname = reader.string(); + break; + case 2: + message.interface_accepting_messages.push( + InterfaceAcceptingMessageDescriptor.decode(reader, reader.uint32()), + ); + break; + case 3: + message.interface_implementers.push(InterfaceImplementerDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + fullname: isSet(object.fullname) ? String(object.fullname) : "", + interface_accepting_messages: Array.isArray(object?.interface_accepting_messages) + ? object.interface_accepting_messages.map((e: any) => InterfaceAcceptingMessageDescriptor.fromJSON(e)) + : [], + interface_implementers: Array.isArray(object?.interface_implementers) + ? object.interface_implementers.map((e: any) => InterfaceImplementerDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + message.fullname !== undefined && (obj.fullname = message.fullname); + if (message.interface_accepting_messages) { + obj.interface_accepting_messages = message.interface_accepting_messages.map((e) => + e ? InterfaceAcceptingMessageDescriptor.toJSON(e) : undefined + ); + } else { + obj.interface_accepting_messages = []; + } + if (message.interface_implementers) { + obj.interface_implementers = message.interface_implementers.map((e) => + e ? InterfaceImplementerDescriptor.toJSON(e) : undefined + ); + } else { + obj.interface_implementers = []; + } + return obj; + }, + + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.fullname = object.fullname ?? ""; + message.interface_accepting_messages = + object.interface_accepting_messages?.map((e) => InterfaceAcceptingMessageDescriptor.fromPartial(e)) || []; + message.interface_implementers = + object.interface_implementers?.map((e) => InterfaceImplementerDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { + return { fullname: "", type_url: "" }; +} + +export const InterfaceImplementerDescriptor = { + encode(message: InterfaceImplementerDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.type_url !== "") { + writer.uint32(18).string(message.type_url); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceImplementerDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceImplementerDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullname = reader.string(); + break; + case 2: + message.type_url = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): InterfaceImplementerDescriptor { + return { + fullname: isSet(object.fullname) ? String(object.fullname) : "", + type_url: isSet(object.type_url) ? String(object.type_url) : "", + }; + }, + + toJSON(message: InterfaceImplementerDescriptor): unknown { + const obj: any = {}; + message.fullname !== undefined && (obj.fullname = message.fullname); + message.type_url !== undefined && (obj.type_url = message.type_url); + return obj; + }, + + fromPartial, I>>( + object: I, + ): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + message.fullname = object.fullname ?? ""; + message.type_url = object.type_url ?? ""; + return message; + }, +}; + +function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { + return { fullname: "", field_descriptor_names: [] }; +} + +export const InterfaceAcceptingMessageDescriptor = { + encode(message: InterfaceAcceptingMessageDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.field_descriptor_names) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceAcceptingMessageDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullname = reader.string(); + break; + case 2: + message.field_descriptor_names.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): InterfaceAcceptingMessageDescriptor { + return { + fullname: isSet(object.fullname) ? String(object.fullname) : "", + field_descriptor_names: Array.isArray(object?.field_descriptor_names) + ? object.field_descriptor_names.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: InterfaceAcceptingMessageDescriptor): unknown { + const obj: any = {}; + message.fullname !== undefined && (obj.fullname = message.fullname); + if (message.field_descriptor_names) { + obj.field_descriptor_names = message.field_descriptor_names.map((e) => e); + } else { + obj.field_descriptor_names = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + message.fullname = object.fullname ?? ""; + message.field_descriptor_names = object.field_descriptor_names?.map((e) => e) || []; + return message; + }, +}; + +function createBaseConfigurationDescriptor(): ConfigurationDescriptor { + return { bech32_account_address_prefix: "" }; +} + +export const ConfigurationDescriptor = { + encode(message: ConfigurationDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bech32_account_address_prefix !== "") { + writer.uint32(10).string(message.bech32_account_address_prefix); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConfigurationDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigurationDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bech32_account_address_prefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ConfigurationDescriptor { + return { + bech32_account_address_prefix: isSet(object.bech32_account_address_prefix) + ? String(object.bech32_account_address_prefix) + : "", + }; + }, + + toJSON(message: ConfigurationDescriptor): unknown { + const obj: any = {}; + message.bech32_account_address_prefix !== undefined && + (obj.bech32_account_address_prefix = message.bech32_account_address_prefix); + return obj; + }, + + fromPartial, I>>(object: I): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + message.bech32_account_address_prefix = object.bech32_account_address_prefix ?? ""; + return message; + }, +}; + +function createBaseMsgDescriptor(): MsgDescriptor { + return { msg_type_url: "" }; +} + +export const MsgDescriptor = { + encode(message: MsgDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.msg_type_url !== "") { + writer.uint32(10).string(message.msg_type_url); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msg_type_url = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDescriptor { + return { msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "" }; + }, + + toJSON(message: MsgDescriptor): unknown { + const obj: any = {}; + message.msg_type_url !== undefined && (obj.msg_type_url = message.msg_type_url); + return obj; + }, + + fromPartial, I>>(object: I): MsgDescriptor { + const message = createBaseMsgDescriptor(); + message.msg_type_url = object.msg_type_url ?? ""; + return message; + }, +}; + +function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { + return {}; +} + +export const GetAuthnDescriptorRequest = { + encode(_: GetAuthnDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthnDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetAuthnDescriptorRequest { + return {}; + }, + + toJSON(_: GetAuthnDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, +}; + +function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { + return { authn: undefined }; +} + +export const GetAuthnDescriptorResponse = { + encode(message: GetAuthnDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthnDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetAuthnDescriptorResponse { + return { authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined }; + }, + + toJSON(message: GetAuthnDescriptorResponse): unknown { + const obj: any = {}; + message.authn !== undefined && (obj.authn = message.authn ? AuthnDescriptor.toJSON(message.authn) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetAuthnDescriptorResponse { + const message = createBaseGetAuthnDescriptorResponse(); + message.authn = (object.authn !== undefined && object.authn !== null) + ? AuthnDescriptor.fromPartial(object.authn) + : undefined; + return message; + }, +}; + +function createBaseGetChainDescriptorRequest(): GetChainDescriptorRequest { + return {}; +} + +export const GetChainDescriptorRequest = { + encode(_: GetChainDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetChainDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetChainDescriptorRequest { + return {}; + }, + + toJSON(_: GetChainDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, +}; + +function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { + return { chain: undefined }; +} + +export const GetChainDescriptorResponse = { + encode(message: GetChainDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetChainDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetChainDescriptorResponse { + return { chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined }; + }, + + toJSON(message: GetChainDescriptorResponse): unknown { + const obj: any = {}; + message.chain !== undefined && (obj.chain = message.chain ? ChainDescriptor.toJSON(message.chain) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetChainDescriptorResponse { + const message = createBaseGetChainDescriptorResponse(); + message.chain = (object.chain !== undefined && object.chain !== null) + ? ChainDescriptor.fromPartial(object.chain) + : undefined; + return message; + }, +}; + +function createBaseGetCodecDescriptorRequest(): GetCodecDescriptorRequest { + return {}; +} + +export const GetCodecDescriptorRequest = { + encode(_: GetCodecDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetCodecDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetCodecDescriptorRequest { + return {}; + }, + + toJSON(_: GetCodecDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, +}; + +function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { + return { codec: undefined }; +} + +export const GetCodecDescriptorResponse = { + encode(message: GetCodecDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetCodecDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetCodecDescriptorResponse { + return { codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined }; + }, + + toJSON(message: GetCodecDescriptorResponse): unknown { + const obj: any = {}; + message.codec !== undefined && (obj.codec = message.codec ? CodecDescriptor.toJSON(message.codec) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetCodecDescriptorResponse { + const message = createBaseGetCodecDescriptorResponse(); + message.codec = (object.codec !== undefined && object.codec !== null) + ? CodecDescriptor.fromPartial(object.codec) + : undefined; + return message; + }, +}; + +function createBaseGetConfigurationDescriptorRequest(): GetConfigurationDescriptorRequest { + return {}; +} + +export const GetConfigurationDescriptorRequest = { + encode(_: GetConfigurationDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetConfigurationDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetConfigurationDescriptorRequest { + return {}; + }, + + toJSON(_: GetConfigurationDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, +}; + +function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { + return { config: undefined }; +} + +export const GetConfigurationDescriptorResponse = { + encode(message: GetConfigurationDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.config !== undefined) { + ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetConfigurationDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.config = ConfigurationDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetConfigurationDescriptorResponse { + return { config: isSet(object.config) ? ConfigurationDescriptor.fromJSON(object.config) : undefined }; + }, + + toJSON(message: GetConfigurationDescriptorResponse): unknown { + const obj: any = {}; + message.config !== undefined && + (obj.config = message.config ? ConfigurationDescriptor.toJSON(message.config) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): GetConfigurationDescriptorResponse { + const message = createBaseGetConfigurationDescriptorResponse(); + message.config = (object.config !== undefined && object.config !== null) + ? ConfigurationDescriptor.fromPartial(object.config) + : undefined; + return message; + }, +}; + +function createBaseGetQueryServicesDescriptorRequest(): GetQueryServicesDescriptorRequest { + return {}; +} + +export const GetQueryServicesDescriptorRequest = { + encode(_: GetQueryServicesDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetQueryServicesDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetQueryServicesDescriptorRequest { + return {}; + }, + + toJSON(_: GetQueryServicesDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, +}; + +function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { + return { queries: undefined }; +} + +export const GetQueryServicesDescriptorResponse = { + encode(message: GetQueryServicesDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.queries !== undefined) { + QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetQueryServicesDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.queries = QueryServicesDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetQueryServicesDescriptorResponse { + return { queries: isSet(object.queries) ? QueryServicesDescriptor.fromJSON(object.queries) : undefined }; + }, + + toJSON(message: GetQueryServicesDescriptorResponse): unknown { + const obj: any = {}; + message.queries !== undefined && + (obj.queries = message.queries ? QueryServicesDescriptor.toJSON(message.queries) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): GetQueryServicesDescriptorResponse { + const message = createBaseGetQueryServicesDescriptorResponse(); + message.queries = (object.queries !== undefined && object.queries !== null) + ? QueryServicesDescriptor.fromPartial(object.queries) + : undefined; + return message; + }, +}; + +function createBaseGetTxDescriptorRequest(): GetTxDescriptorRequest { + return {}; +} + +export const GetTxDescriptorRequest = { + encode(_: GetTxDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxDescriptorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetTxDescriptorRequest { + return {}; + }, + + toJSON(_: GetTxDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, +}; + +function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { + return { tx: undefined }; +} + +export const GetTxDescriptorResponse = { + encode(message: GetTxDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxDescriptorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = TxDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetTxDescriptorResponse { + return { tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: GetTxDescriptorResponse): unknown { + const obj: any = {}; + message.tx !== undefined && (obj.tx = message.tx ? TxDescriptor.toJSON(message.tx) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetTxDescriptorResponse { + const message = createBaseGetTxDescriptorResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? TxDescriptor.fromPartial(object.tx) : undefined; + return message; + }, +}; + +function createBaseQueryServicesDescriptor(): QueryServicesDescriptor { + return { query_services: [] }; +} + +export const QueryServicesDescriptor = { + encode(message: QueryServicesDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.query_services) { + QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryServicesDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryServicesDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.query_services.push(QueryServiceDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryServicesDescriptor { + return { + query_services: Array.isArray(object?.query_services) + ? object.query_services.map((e: any) => QueryServiceDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryServicesDescriptor): unknown { + const obj: any = {}; + if (message.query_services) { + obj.query_services = message.query_services.map((e) => e ? QueryServiceDescriptor.toJSON(e) : undefined); + } else { + obj.query_services = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.query_services = object.query_services?.map((e) => QueryServiceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { + return { fullname: "", is_module: false, methods: [] }; +} + +export const QueryServiceDescriptor = { + encode(message: QueryServiceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.is_module === true) { + writer.uint32(16).bool(message.is_module); + } + for (const v of message.methods) { + QueryMethodDescriptor.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryServiceDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryServiceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullname = reader.string(); + break; + case 2: + message.is_module = reader.bool(); + break; + case 3: + message.methods.push(QueryMethodDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryServiceDescriptor { + return { + fullname: isSet(object.fullname) ? String(object.fullname) : "", + is_module: isSet(object.is_module) ? Boolean(object.is_module) : false, + methods: Array.isArray(object?.methods) ? object.methods.map((e: any) => QueryMethodDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryServiceDescriptor): unknown { + const obj: any = {}; + message.fullname !== undefined && (obj.fullname = message.fullname); + message.is_module !== undefined && (obj.is_module = message.is_module); + if (message.methods) { + obj.methods = message.methods.map((e) => e ? QueryMethodDescriptor.toJSON(e) : undefined); + } else { + obj.methods = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + message.fullname = object.fullname ?? ""; + message.is_module = object.is_module ?? false; + message.methods = object.methods?.map((e) => QueryMethodDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { + return { name: "", full_query_path: "" }; +} + +export const QueryMethodDescriptor = { + encode(message: QueryMethodDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.full_query_path !== "") { + writer.uint32(18).string(message.full_query_path); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryMethodDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMethodDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.full_query_path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryMethodDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + full_query_path: isSet(object.full_query_path) ? String(object.full_query_path) : "", + }; + }, + + toJSON(message: QueryMethodDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.full_query_path !== undefined && (obj.full_query_path = message.full_query_path); + return obj; + }, + + fromPartial, I>>(object: I): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + message.name = object.name ?? ""; + message.full_query_path = object.full_query_path ?? ""; + return message; + }, +}; + +/** ReflectionService defines a service for application reflection. */ +export interface ReflectionService { + /** + * GetAuthnDescriptor returns information on how to authenticate transactions in the application + * NOTE: this RPC is still experimental and might be subject to breaking changes or removal in + * future releases of the cosmos-sdk. + */ + GetAuthnDescriptor(request: GetAuthnDescriptorRequest): Promise; + /** GetChainDescriptor returns the description of the chain */ + GetChainDescriptor(request: GetChainDescriptorRequest): Promise; + /** GetCodecDescriptor returns the descriptor of the codec of the application */ + GetCodecDescriptor(request: GetCodecDescriptorRequest): Promise; + /** GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application */ + GetConfigurationDescriptor(request: GetConfigurationDescriptorRequest): Promise; + /** GetQueryServicesDescriptor returns the available gRPC queryable services of the application */ + GetQueryServicesDescriptor(request: GetQueryServicesDescriptorRequest): Promise; + /** GetTxDescriptor returns information on the used transaction object and available msgs that can be used */ + GetTxDescriptor(request: GetTxDescriptorRequest): Promise; +} + +export class ReflectionServiceClientImpl implements ReflectionService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.base.reflection.v2alpha1.ReflectionService"; + this.rpc = rpc; + this.GetAuthnDescriptor = this.GetAuthnDescriptor.bind(this); + this.GetChainDescriptor = this.GetChainDescriptor.bind(this); + this.GetCodecDescriptor = this.GetCodecDescriptor.bind(this); + this.GetConfigurationDescriptor = this.GetConfigurationDescriptor.bind(this); + this.GetQueryServicesDescriptor = this.GetQueryServicesDescriptor.bind(this); + this.GetTxDescriptor = this.GetTxDescriptor.bind(this); + } + GetAuthnDescriptor(request: GetAuthnDescriptorRequest): Promise { + const data = GetAuthnDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetAuthnDescriptor", data); + return promise.then((data) => GetAuthnDescriptorResponse.decode(new _m0.Reader(data))); + } + + GetChainDescriptor(request: GetChainDescriptorRequest): Promise { + const data = GetChainDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetChainDescriptor", data); + return promise.then((data) => GetChainDescriptorResponse.decode(new _m0.Reader(data))); + } + + GetCodecDescriptor(request: GetCodecDescriptorRequest): Promise { + const data = GetCodecDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetCodecDescriptor", data); + return promise.then((data) => GetCodecDescriptorResponse.decode(new _m0.Reader(data))); + } + + GetConfigurationDescriptor(request: GetConfigurationDescriptorRequest): Promise { + const data = GetConfigurationDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetConfigurationDescriptor", data); + return promise.then((data) => GetConfigurationDescriptorResponse.decode(new _m0.Reader(data))); + } + + GetQueryServicesDescriptor(request: GetQueryServicesDescriptorRequest): Promise { + const data = GetQueryServicesDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetQueryServicesDescriptor", data); + return promise.then((data) => GetQueryServicesDescriptorResponse.decode(new _m0.Reader(data))); + } + + GetTxDescriptor(request: GetTxDescriptorRequest): Promise { + const data = GetTxDescriptorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetTxDescriptor", data); + return promise.then((data) => GetTxDescriptorResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/base/snapshots/v1beta1/snapshot.ts b/common/types/src/lcd/cosmos/base/snapshots/v1beta1/snapshot.ts new file mode 100644 index 00000000..236000e2 --- /dev/null +++ b/common/types/src/lcd/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -0,0 +1,734 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.snapshots.v1beta1"; + +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface Snapshot { + height: string; + format: number; + chunks: number; + hash: Uint8Array; + metadata?: Metadata; +} + +/** Metadata contains SDK-specific snapshot metadata. */ +export interface Metadata { + /** SHA-256 chunk hashes */ + chunk_hashes: Uint8Array[]; +} + +/** SnapshotItem is an item contained in a rootmulti.Store snapshot. */ +export interface SnapshotItem { + store?: SnapshotStoreItem | undefined; + iavl?: SnapshotIAVLItem | undefined; + extension?: SnapshotExtensionMeta | undefined; + extension_payload?: SnapshotExtensionPayload | undefined; + kv?: SnapshotKVItem | undefined; + schema?: SnapshotSchema | undefined; +} + +/** SnapshotStoreItem contains metadata about a snapshotted store. */ +export interface SnapshotStoreItem { + name: string; +} + +/** SnapshotIAVLItem is an exported IAVL node. */ +export interface SnapshotIAVLItem { + key: Uint8Array; + value: Uint8Array; + /** version is block height */ + version: string; + /** height is depth of the tree. */ + height: number; +} + +/** SnapshotExtensionMeta contains metadata about an external snapshotter. */ +export interface SnapshotExtensionMeta { + name: string; + format: number; +} + +/** SnapshotExtensionPayload contains payloads of an external snapshotter. */ +export interface SnapshotExtensionPayload { + payload: Uint8Array; +} + +/** SnapshotKVItem is an exported Key/Value Pair */ +export interface SnapshotKVItem { + key: Uint8Array; + value: Uint8Array; +} + +/** SnapshotSchema is an exported schema of smt store */ +export interface SnapshotSchema { + keys: Uint8Array[]; +} + +function createBaseSnapshot(): Snapshot { + return { height: "0", format: 0, chunks: 0, hash: new Uint8Array(), metadata: undefined }; +} + +export const Snapshot = { + encode(message: Snapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "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 !== undefined) { + Metadata.encode(message.metadata, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + 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 = Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? String(object.height) : "0", + format: isSet(object.format) ? Number(object.format) : 0, + chunks: isSet(object.chunks) ? Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunks !== undefined && (obj.chunks = Math.round(message.chunks)); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.metadata !== undefined && (obj.metadata = message.metadata ? Metadata.toJSON(message.metadata) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Snapshot { + const message = createBaseSnapshot(); + message.height = object.height ?? "0"; + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBaseMetadata(): Metadata { + return { chunk_hashes: [] }; +} + +export const Metadata = { + encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.chunk_hashes) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Metadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.chunk_hashes.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + chunk_hashes: Array.isArray(object?.chunk_hashes) ? object.chunk_hashes.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.chunk_hashes) { + obj.chunk_hashes = message.chunk_hashes.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.chunk_hashes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.chunk_hashes = object.chunk_hashes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSnapshotItem(): SnapshotItem { + return { + store: undefined, + iavl: undefined, + extension: undefined, + extension_payload: undefined, + kv: undefined, + schema: undefined, + }; +} + +export const SnapshotItem = { + encode(message: SnapshotItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.store !== undefined) { + SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).ldelim(); + } + if (message.iavl !== undefined) { + SnapshotIAVLItem.encode(message.iavl, writer.uint32(18).fork()).ldelim(); + } + if (message.extension !== undefined) { + SnapshotExtensionMeta.encode(message.extension, writer.uint32(26).fork()).ldelim(); + } + if (message.extension_payload !== undefined) { + SnapshotExtensionPayload.encode(message.extension_payload, writer.uint32(34).fork()).ldelim(); + } + if (message.kv !== undefined) { + SnapshotKVItem.encode(message.kv, writer.uint32(42).fork()).ldelim(); + } + if (message.schema !== undefined) { + SnapshotSchema.encode(message.schema, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotItem { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.store = SnapshotStoreItem.decode(reader, reader.uint32()); + break; + case 2: + message.iavl = SnapshotIAVLItem.decode(reader, reader.uint32()); + break; + case 3: + message.extension = SnapshotExtensionMeta.decode(reader, reader.uint32()); + break; + case 4: + message.extension_payload = SnapshotExtensionPayload.decode(reader, reader.uint32()); + break; + case 5: + message.kv = SnapshotKVItem.decode(reader, reader.uint32()); + break; + case 6: + message.schema = SnapshotSchema.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SnapshotItem { + return { + store: isSet(object.store) ? SnapshotStoreItem.fromJSON(object.store) : undefined, + iavl: isSet(object.iavl) ? SnapshotIAVLItem.fromJSON(object.iavl) : undefined, + extension: isSet(object.extension) ? SnapshotExtensionMeta.fromJSON(object.extension) : undefined, + extension_payload: isSet(object.extension_payload) + ? SnapshotExtensionPayload.fromJSON(object.extension_payload) + : undefined, + kv: isSet(object.kv) ? SnapshotKVItem.fromJSON(object.kv) : undefined, + schema: isSet(object.schema) ? SnapshotSchema.fromJSON(object.schema) : undefined, + }; + }, + + toJSON(message: SnapshotItem): unknown { + const obj: any = {}; + message.store !== undefined && (obj.store = message.store ? SnapshotStoreItem.toJSON(message.store) : undefined); + message.iavl !== undefined && (obj.iavl = message.iavl ? SnapshotIAVLItem.toJSON(message.iavl) : undefined); + message.extension !== undefined && + (obj.extension = message.extension ? SnapshotExtensionMeta.toJSON(message.extension) : undefined); + message.extension_payload !== undefined && (obj.extension_payload = message.extension_payload + ? SnapshotExtensionPayload.toJSON(message.extension_payload) + : undefined); + message.kv !== undefined && (obj.kv = message.kv ? SnapshotKVItem.toJSON(message.kv) : undefined); + message.schema !== undefined && (obj.schema = message.schema ? SnapshotSchema.toJSON(message.schema) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotItem { + const message = createBaseSnapshotItem(); + message.store = (object.store !== undefined && object.store !== null) + ? SnapshotStoreItem.fromPartial(object.store) + : undefined; + message.iavl = (object.iavl !== undefined && object.iavl !== null) + ? SnapshotIAVLItem.fromPartial(object.iavl) + : undefined; + message.extension = (object.extension !== undefined && object.extension !== null) + ? SnapshotExtensionMeta.fromPartial(object.extension) + : undefined; + message.extension_payload = (object.extension_payload !== undefined && object.extension_payload !== null) + ? SnapshotExtensionPayload.fromPartial(object.extension_payload) + : undefined; + message.kv = (object.kv !== undefined && object.kv !== null) ? SnapshotKVItem.fromPartial(object.kv) : undefined; + message.schema = (object.schema !== undefined && object.schema !== null) + ? SnapshotSchema.fromPartial(object.schema) + : undefined; + return message; + }, +}; + +function createBaseSnapshotStoreItem(): SnapshotStoreItem { + return { name: "" }; +} + +export const SnapshotStoreItem = { + encode(message: SnapshotStoreItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotStoreItem { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotStoreItem(); + 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; + }, + + fromJSON(object: any): SnapshotStoreItem { + return { name: isSet(object.name) ? String(object.name) : "" }; + }, + + toJSON(message: SnapshotStoreItem): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { + return { key: new Uint8Array(), value: new Uint8Array(), version: "0", height: 0 }; +} + +export const SnapshotIAVLItem = { + encode(message: SnapshotIAVLItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.version !== "0") { + writer.uint32(24).int64(message.version); + } + if (message.height !== 0) { + writer.uint32(32).int32(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotIAVLItem { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotIAVLItem(); + 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.version = longToString(reader.int64() as Long); + break; + case 4: + message.height = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SnapshotIAVLItem { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + version: isSet(object.version) ? String(object.version) : "0", + height: isSet(object.height) ? Number(object.height) : 0, + }; + }, + + toJSON(message: SnapshotIAVLItem): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.version !== undefined && (obj.version = message.version); + message.height !== undefined && (obj.height = Math.round(message.height)); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.version = object.version ?? "0"; + message.height = object.height ?? 0; + return message; + }, +}; + +function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { + return { name: "", format: 0 }; +} + +export const SnapshotExtensionMeta = { + encode(message: SnapshotExtensionMeta, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotExtensionMeta { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotExtensionMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.format = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionMeta { + return { + name: isSet(object.name) ? String(object.name) : "", + format: isSet(object.format) ? Number(object.format) : 0, + }; + }, + + toJSON(message: SnapshotExtensionMeta): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.format !== undefined && (obj.format = Math.round(message.format)); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotExtensionMeta { + const message = createBaseSnapshotExtensionMeta(); + message.name = object.name ?? ""; + message.format = object.format ?? 0; + return message; + }, +}; + +function createBaseSnapshotExtensionPayload(): SnapshotExtensionPayload { + return { payload: new Uint8Array() }; +} + +export const SnapshotExtensionPayload = { + encode(message: SnapshotExtensionPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotExtensionPayload { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotExtensionPayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.payload = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionPayload { + return { payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array() }; + }, + + toJSON(message: SnapshotExtensionPayload): unknown { + const obj: any = {}; + message.payload !== undefined && + (obj.payload = base64FromBytes(message.payload !== undefined ? message.payload : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + message.payload = object.payload ?? new Uint8Array(); + return message; + }, +}; + +function createBaseSnapshotKVItem(): SnapshotKVItem { + return { key: new Uint8Array(), value: new Uint8Array() }; +} + +export const SnapshotKVItem = { + encode(message: SnapshotKVItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SnapshotKVItem { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotKVItem(); + 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; + }, + + fromJSON(object: any): SnapshotKVItem { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + }; + }, + + toJSON(message: SnapshotKVItem): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): SnapshotKVItem { + const message = createBaseSnapshotKVItem(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; + +function createBaseSnapshotSchema(): SnapshotSchema { + return { keys: [] }; +} + +export const SnapshotSchema = { + encode(message: SnapshotSchema, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.keys) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotSchema { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keys.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SnapshotSchema { + return { keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: SnapshotSchema): unknown { + const obj: any = {}; + if (message.keys) { + obj.keys = message.keys.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.keys = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SnapshotSchema { + const message = createBaseSnapshotSchema(); + message.keys = object.keys?.map((e) => e) || []; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/base/store/v1beta1/commit_info.ts b/common/types/src/lcd/cosmos/base/store/v1beta1/commit_info.ts new file mode 100644 index 00000000..fad7da54 --- /dev/null +++ b/common/types/src/lcd/cosmos/base/store/v1beta1/commit_info.ts @@ -0,0 +1,282 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.store.v1beta1"; + +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfo { + version: string; + store_infos: StoreInfo[]; +} + +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfo { + name: string; + commit_id?: CommitID; +} + +/** + * CommitID defines the committment information when a specific store is + * committed. + */ +export interface CommitID { + version: string; + hash: Uint8Array; +} + +function createBaseCommitInfo(): CommitInfo { + return { version: "0", store_infos: [] }; +} + +export const CommitInfo = { + encode(message: CommitInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "0") { + writer.uint32(8).int64(message.version); + } + for (const v of message.store_infos) { + StoreInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.version = longToString(reader.int64() as Long); + break; + case 2: + message.store_infos.push(StoreInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + version: isSet(object.version) ? String(object.version) : "0", + store_infos: Array.isArray(object?.store_infos) ? object.store_infos.map((e: any) => StoreInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + if (message.store_infos) { + obj.store_infos = message.store_infos.map((e) => e ? StoreInfo.toJSON(e) : undefined); + } else { + obj.store_infos = []; + } + return obj; + }, + + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.version = object.version ?? "0"; + message.store_infos = object.store_infos?.map((e) => StoreInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStoreInfo(): StoreInfo { + return { name: "", commit_id: undefined }; +} + +export const StoreInfo = { + encode(message: StoreInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.commit_id !== undefined) { + CommitID.encode(message.commit_id, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StoreInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.commit_id = CommitID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StoreInfo { + return { + name: isSet(object.name) ? String(object.name) : "", + commit_id: isSet(object.commit_id) ? CommitID.fromJSON(object.commit_id) : undefined, + }; + }, + + toJSON(message: StoreInfo): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.commit_id !== undefined && + (obj.commit_id = message.commit_id ? CommitID.toJSON(message.commit_id) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): StoreInfo { + const message = createBaseStoreInfo(); + message.name = object.name ?? ""; + message.commit_id = (object.commit_id !== undefined && object.commit_id !== null) + ? CommitID.fromPartial(object.commit_id) + : undefined; + return message; + }, +}; + +function createBaseCommitID(): CommitID { + return { version: "0", hash: new Uint8Array() }; +} + +export const CommitID = { + encode(message: CommitID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "0") { + writer.uint32(8).int64(message.version); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommitID { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = longToString(reader.int64() as Long); + break; + case 2: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommitID { + return { + version: isSet(object.version) ? String(object.version) : "0", + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + }; + }, + + toJSON(message: CommitID): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): CommitID { + const message = createBaseCommitID(); + message.version = object.version ?? "0"; + message.hash = object.hash ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/base/store/v1beta1/listening.ts b/common/types/src/lcd/cosmos/base/store/v1beta1/listening.ts new file mode 100644 index 00000000..aefc9d0f --- /dev/null +++ b/common/types/src/lcd/cosmos/base/store/v1beta1/listening.ts @@ -0,0 +1,157 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.store.v1beta1"; + +/** + * StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) + * It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and + * Deletes + * + * Since: cosmos-sdk 0.43 + */ +export interface StoreKVPair { + /** the store key for the KVStore this pair originates from */ + store_key: string; + /** true indicates a delete operation, false indicates a set operation */ + delete: boolean; + key: Uint8Array; + value: Uint8Array; +} + +function createBaseStoreKVPair(): StoreKVPair { + return { store_key: "", delete: false, key: new Uint8Array(), value: new Uint8Array() }; +} + +export const StoreKVPair = { + encode(message: StoreKVPair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.store_key !== "") { + writer.uint32(10).string(message.store_key); + } + if (message.delete === true) { + writer.uint32(16).bool(message.delete); + } + if (message.key.length !== 0) { + writer.uint32(26).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(34).bytes(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StoreKVPair { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.store_key = reader.string(); + break; + case 2: + message.delete = reader.bool(); + break; + case 3: + message.key = reader.bytes(); + break; + case 4: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StoreKVPair { + return { + store_key: isSet(object.store_key) ? String(object.store_key) : "", + delete: isSet(object.delete) ? Boolean(object.delete) : false, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + }; + }, + + toJSON(message: StoreKVPair): unknown { + const obj: any = {}; + message.store_key !== undefined && (obj.store_key = message.store_key); + message.delete !== undefined && (obj.delete = message.delete); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): StoreKVPair { + const message = createBaseStoreKVPair(); + message.store_key = object.store_key ?? ""; + message.delete = object.delete ?? false; + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/base/tendermint/v1beta1/query.ts b/common/types/src/lcd/cosmos/base/tendermint/v1beta1/query.ts new file mode 100644 index 00000000..1e02d7d7 --- /dev/null +++ b/common/types/src/lcd/cosmos/base/tendermint/v1beta1/query.ts @@ -0,0 +1,1137 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../../google/protobuf/any"; +import { NodeInfo } from "../../../../tendermint/p2p/types"; +import { Block } from "../../../../tendermint/types/block"; +import { BlockID } from "../../../../tendermint/types/types"; +import { PageRequest, PageResponse } from "../../query/v1beta1/pagination"; + +export const protobufPackage = "cosmos.base.tendermint.v1beta1"; + +/** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightRequest { + height: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetValidatorSetByHeightResponse { + block_height: string; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +/** GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetRequest { + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. */ +export interface GetLatestValidatorSetResponse { + block_height: string; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +/** Validator is the type for the validator-set. */ +export interface Validator { + address: string; + pub_key?: Any; + voting_power: string; + proposer_priority: string; +} + +/** GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightRequest { + height: string; +} + +/** GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. */ +export interface GetBlockByHeightResponse { + block_id?: BlockID; + block?: Block; +} + +/** GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method. */ +export interface GetLatestBlockRequest { +} + +/** GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method. */ +export interface GetLatestBlockResponse { + block_id?: BlockID; + block?: Block; +} + +/** GetSyncingRequest is the request type for the Query/GetSyncing RPC method. */ +export interface GetSyncingRequest { +} + +/** GetSyncingResponse is the response type for the Query/GetSyncing RPC method. */ +export interface GetSyncingResponse { + syncing: boolean; +} + +/** GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method. */ +export interface GetNodeInfoRequest { +} + +/** GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC method. */ +export interface GetNodeInfoResponse { + node_info?: NodeInfo; + application_version?: VersionInfo; +} + +/** VersionInfo is the type for the GetNodeInfoResponse message. */ +export interface VersionInfo { + name: string; + app_name: string; + version: string; + git_commit: string; + build_tags: string; + go_version: string; + build_deps: Module[]; + /** Since: cosmos-sdk 0.43 */ + cosmos_sdk_version: string; +} + +/** Module is the type for VersionInfo */ +export interface Module { + /** module path */ + path: string; + /** module version */ + version: string; + /** checksum */ + sum: string; +} + +function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequest { + return { height: "0", pagination: undefined }; +} + +export const GetValidatorSetByHeightRequest = { + encode(message: GetValidatorSetByHeightRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetValidatorSetByHeightRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetValidatorSetByHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = longToString(reader.int64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightRequest { + return { + height: isSet(object.height) ? String(object.height) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightRequest): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): GetValidatorSetByHeightRequest { + const message = createBaseGetValidatorSetByHeightRequest(); + message.height = object.height ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseGetValidatorSetByHeightResponse(): GetValidatorSetByHeightResponse { + return { block_height: "0", validators: [], pagination: undefined }; +} + +export const GetValidatorSetByHeightResponse = { + encode(message: GetValidatorSetByHeightResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_height !== "0") { + writer.uint32(8).int64(message.block_height); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetValidatorSetByHeightResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetValidatorSetByHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_height = longToString(reader.int64() as Long); + break; + case 2: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightResponse { + return { + block_height: isSet(object.block_height) ? String(object.block_height) : "0", + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightResponse): unknown { + const obj: any = {}; + message.block_height !== undefined && (obj.block_height = message.block_height); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): GetValidatorSetByHeightResponse { + const message = createBaseGetValidatorSetByHeightResponse(); + message.block_height = object.block_height ?? "0"; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseGetLatestValidatorSetRequest(): GetLatestValidatorSetRequest { + return { pagination: undefined }; +} + +export const GetLatestValidatorSetRequest = { + encode(message: GetLatestValidatorSetRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestValidatorSetRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestValidatorSetRequest(); + 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; + }, + + fromJSON(object: any): GetLatestValidatorSetRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: GetLatestValidatorSetRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetLatestValidatorSetRequest { + const message = createBaseGetLatestValidatorSetRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseGetLatestValidatorSetResponse(): GetLatestValidatorSetResponse { + return { block_height: "0", validators: [], pagination: undefined }; +} + +export const GetLatestValidatorSetResponse = { + encode(message: GetLatestValidatorSetResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_height !== "0") { + writer.uint32(8).int64(message.block_height); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestValidatorSetResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_height = longToString(reader.int64() as Long); + break; + case 2: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetResponse { + return { + block_height: isSet(object.block_height) ? String(object.block_height) : "0", + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetLatestValidatorSetResponse): unknown { + const obj: any = {}; + message.block_height !== undefined && (obj.block_height = message.block_height); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): GetLatestValidatorSetResponse { + const message = createBaseGetLatestValidatorSetResponse(); + message.block_height = object.block_height ?? "0"; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: "", pub_key: undefined, voting_power: "0", proposer_priority: "0" }; +} + +export const Validator = { + encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pub_key !== undefined) { + Any.encode(message.pub_key, writer.uint32(18).fork()).ldelim(); + } + if (message.voting_power !== "0") { + writer.uint32(24).int64(message.voting_power); + } + if (message.proposer_priority !== "0") { + writer.uint32(32).int64(message.proposer_priority); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Validator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.string(); + break; + case 2: + message.pub_key = Any.decode(reader, reader.uint32()); + break; + case 3: + message.voting_power = longToString(reader.int64() as Long); + break; + case 4: + message.proposer_priority = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? String(object.address) : "", + pub_key: isSet(object.pub_key) ? Any.fromJSON(object.pub_key) : undefined, + voting_power: isSet(object.voting_power) ? String(object.voting_power) : "0", + proposer_priority: isSet(object.proposer_priority) ? String(object.proposer_priority) : "0", + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? Any.toJSON(message.pub_key) : undefined); + message.voting_power !== undefined && (obj.voting_power = message.voting_power); + message.proposer_priority !== undefined && (obj.proposer_priority = message.proposer_priority); + return obj; + }, + + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? ""; + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? Any.fromPartial(object.pub_key) + : undefined; + message.voting_power = object.voting_power ?? "0"; + message.proposer_priority = object.proposer_priority ?? "0"; + return message; + }, +}; + +function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { + return { height: "0" }; +} + +export const GetBlockByHeightRequest = { + encode(message: GetBlockByHeightRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockByHeightRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockByHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightRequest { + return { height: isSet(object.height) ? String(object.height) : "0" }; + }, + + toJSON(message: GetBlockByHeightRequest): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>(object: I): GetBlockByHeightRequest { + const message = createBaseGetBlockByHeightRequest(); + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { + return { block_id: undefined, block: undefined }; +} + +export const GetBlockByHeightResponse = { + encode(message: GetBlockByHeightResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(10).fork()).ldelim(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockByHeightResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockByHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_id = BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.block = Block.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightResponse { + return { + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + }; + }, + + toJSON(message: GetBlockByHeightResponse): unknown { + const obj: any = {}; + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.block !== undefined && (obj.block = message.block ? Block.toJSON(message.block) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetBlockByHeightResponse { + const message = createBaseGetBlockByHeightResponse(); + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + return message; + }, +}; + +function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { + return {}; +} + +export const GetLatestBlockRequest = { + encode(_: GetLatestBlockRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestBlockRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetLatestBlockRequest { + return {}; + }, + + toJSON(_: GetLatestBlockRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetLatestBlockRequest { + const message = createBaseGetLatestBlockRequest(); + return message; + }, +}; + +function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { + return { block_id: undefined, block: undefined }; +} + +export const GetLatestBlockResponse = { + encode(message: GetLatestBlockResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(10).fork()).ldelim(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetLatestBlockResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_id = BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.block = Block.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetLatestBlockResponse { + return { + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + }; + }, + + toJSON(message: GetLatestBlockResponse): unknown { + const obj: any = {}; + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.block !== undefined && (obj.block = message.block ? Block.toJSON(message.block) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetLatestBlockResponse { + const message = createBaseGetLatestBlockResponse(); + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.block = (object.block !== undefined && object.block !== null) ? Block.fromPartial(object.block) : undefined; + return message; + }, +}; + +function createBaseGetSyncingRequest(): GetSyncingRequest { + return {}; +} + +export const GetSyncingRequest = { + encode(_: GetSyncingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetSyncingRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetSyncingRequest { + return {}; + }, + + toJSON(_: GetSyncingRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetSyncingRequest { + const message = createBaseGetSyncingRequest(); + return message; + }, +}; + +function createBaseGetSyncingResponse(): GetSyncingResponse { + return { syncing: false }; +} + +export const GetSyncingResponse = { + encode(message: GetSyncingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.syncing === true) { + writer.uint32(8).bool(message.syncing); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetSyncingResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.syncing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetSyncingResponse { + return { syncing: isSet(object.syncing) ? Boolean(object.syncing) : false }; + }, + + toJSON(message: GetSyncingResponse): unknown { + const obj: any = {}; + message.syncing !== undefined && (obj.syncing = message.syncing); + return obj; + }, + + fromPartial, I>>(object: I): GetSyncingResponse { + const message = createBaseGetSyncingResponse(); + message.syncing = object.syncing ?? false; + return message; + }, +}; + +function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { + return {}; +} + +export const GetNodeInfoRequest = { + encode(_: GetNodeInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetNodeInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): GetNodeInfoRequest { + return {}; + }, + + toJSON(_: GetNodeInfoRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): GetNodeInfoRequest { + const message = createBaseGetNodeInfoRequest(); + return message; + }, +}; + +function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { + return { node_info: undefined, application_version: undefined }; +} + +export const GetNodeInfoResponse = { + encode(message: GetNodeInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.node_info !== undefined) { + NodeInfo.encode(message.node_info, writer.uint32(10).fork()).ldelim(); + } + if (message.application_version !== undefined) { + VersionInfo.encode(message.application_version, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetNodeInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.node_info = NodeInfo.decode(reader, reader.uint32()); + break; + case 2: + message.application_version = VersionInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetNodeInfoResponse { + return { + node_info: isSet(object.node_info) ? NodeInfo.fromJSON(object.node_info) : undefined, + application_version: isSet(object.application_version) + ? VersionInfo.fromJSON(object.application_version) + : undefined, + }; + }, + + toJSON(message: GetNodeInfoResponse): unknown { + const obj: any = {}; + message.node_info !== undefined && + (obj.node_info = message.node_info ? NodeInfo.toJSON(message.node_info) : undefined); + message.application_version !== undefined && (obj.application_version = message.application_version + ? VersionInfo.toJSON(message.application_version) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetNodeInfoResponse { + const message = createBaseGetNodeInfoResponse(); + message.node_info = (object.node_info !== undefined && object.node_info !== null) + ? NodeInfo.fromPartial(object.node_info) + : undefined; + message.application_version = (object.application_version !== undefined && object.application_version !== null) + ? VersionInfo.fromPartial(object.application_version) + : undefined; + return message; + }, +}; + +function createBaseVersionInfo(): VersionInfo { + return { + name: "", + app_name: "", + version: "", + git_commit: "", + build_tags: "", + go_version: "", + build_deps: [], + cosmos_sdk_version: "", + }; +} + +export const VersionInfo = { + encode(message: VersionInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.app_name !== "") { + writer.uint32(18).string(message.app_name); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.git_commit !== "") { + writer.uint32(34).string(message.git_commit); + } + if (message.build_tags !== "") { + writer.uint32(42).string(message.build_tags); + } + if (message.go_version !== "") { + writer.uint32(50).string(message.go_version); + } + for (const v of message.build_deps) { + Module.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.cosmos_sdk_version !== "") { + writer.uint32(66).string(message.cosmos_sdk_version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): VersionInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.app_name = reader.string(); + break; + case 3: + message.version = reader.string(); + break; + case 4: + message.git_commit = reader.string(); + break; + case 5: + message.build_tags = reader.string(); + break; + case 6: + message.go_version = reader.string(); + break; + case 7: + message.build_deps.push(Module.decode(reader, reader.uint32())); + break; + case 8: + message.cosmos_sdk_version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): VersionInfo { + return { + name: isSet(object.name) ? String(object.name) : "", + app_name: isSet(object.app_name) ? String(object.app_name) : "", + version: isSet(object.version) ? String(object.version) : "", + git_commit: isSet(object.git_commit) ? String(object.git_commit) : "", + build_tags: isSet(object.build_tags) ? String(object.build_tags) : "", + go_version: isSet(object.go_version) ? String(object.go_version) : "", + build_deps: Array.isArray(object?.build_deps) ? object.build_deps.map((e: any) => Module.fromJSON(e)) : [], + cosmos_sdk_version: isSet(object.cosmos_sdk_version) ? String(object.cosmos_sdk_version) : "", + }; + }, + + toJSON(message: VersionInfo): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.app_name !== undefined && (obj.app_name = message.app_name); + message.version !== undefined && (obj.version = message.version); + message.git_commit !== undefined && (obj.git_commit = message.git_commit); + message.build_tags !== undefined && (obj.build_tags = message.build_tags); + message.go_version !== undefined && (obj.go_version = message.go_version); + if (message.build_deps) { + obj.build_deps = message.build_deps.map((e) => e ? Module.toJSON(e) : undefined); + } else { + obj.build_deps = []; + } + message.cosmos_sdk_version !== undefined && (obj.cosmos_sdk_version = message.cosmos_sdk_version); + return obj; + }, + + fromPartial, I>>(object: I): VersionInfo { + const message = createBaseVersionInfo(); + message.name = object.name ?? ""; + message.app_name = object.app_name ?? ""; + message.version = object.version ?? ""; + message.git_commit = object.git_commit ?? ""; + message.build_tags = object.build_tags ?? ""; + message.go_version = object.go_version ?? ""; + message.build_deps = object.build_deps?.map((e) => Module.fromPartial(e)) || []; + message.cosmos_sdk_version = object.cosmos_sdk_version ?? ""; + return message; + }, +}; + +function createBaseModule(): Module { + return { path: "", version: "", sum: "" }; +} + +export const Module = { + encode(message: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.sum !== "") { + writer.uint32(26).string(message.sum); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Module { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + case 3: + message.sum = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Module { + return { + path: isSet(object.path) ? String(object.path) : "", + version: isSet(object.version) ? String(object.version) : "", + sum: isSet(object.sum) ? String(object.sum) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + message.path !== undefined && (obj.path = message.path); + message.version !== undefined && (obj.version = message.version); + message.sum !== undefined && (obj.sum = message.sum); + return obj; + }, + + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.path = object.path ?? ""; + message.version = object.version ?? ""; + message.sum = object.sum ?? ""; + return message; + }, +}; + +/** Service defines the gRPC querier service for tendermint queries. */ +export interface Service { + /** GetNodeInfo queries the current node info. */ + GetNodeInfo(request: GetNodeInfoRequest): Promise; + /** GetSyncing queries node syncing. */ + GetSyncing(request: GetSyncingRequest): Promise; + /** GetLatestBlock returns the latest block. */ + GetLatestBlock(request: GetLatestBlockRequest): Promise; + /** GetBlockByHeight queries block for given height. */ + GetBlockByHeight(request: GetBlockByHeightRequest): Promise; + /** GetLatestValidatorSet queries latest validator-set. */ + GetLatestValidatorSet(request: GetLatestValidatorSetRequest): Promise; + /** GetValidatorSetByHeight queries validator-set at a given height. */ + GetValidatorSetByHeight(request: GetValidatorSetByHeightRequest): Promise; +} + +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.base.tendermint.v1beta1.Service"; + this.rpc = rpc; + this.GetNodeInfo = this.GetNodeInfo.bind(this); + this.GetSyncing = this.GetSyncing.bind(this); + this.GetLatestBlock = this.GetLatestBlock.bind(this); + this.GetBlockByHeight = this.GetBlockByHeight.bind(this); + this.GetLatestValidatorSet = this.GetLatestValidatorSet.bind(this); + this.GetValidatorSetByHeight = this.GetValidatorSetByHeight.bind(this); + } + GetNodeInfo(request: GetNodeInfoRequest): Promise { + const data = GetNodeInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetNodeInfo", data); + return promise.then((data) => GetNodeInfoResponse.decode(new _m0.Reader(data))); + } + + GetSyncing(request: GetSyncingRequest): Promise { + const data = GetSyncingRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetSyncing", data); + return promise.then((data) => GetSyncingResponse.decode(new _m0.Reader(data))); + } + + GetLatestBlock(request: GetLatestBlockRequest): Promise { + const data = GetLatestBlockRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetLatestBlock", data); + return promise.then((data) => GetLatestBlockResponse.decode(new _m0.Reader(data))); + } + + GetBlockByHeight(request: GetBlockByHeightRequest): Promise { + const data = GetBlockByHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetBlockByHeight", data); + return promise.then((data) => GetBlockByHeightResponse.decode(new _m0.Reader(data))); + } + + GetLatestValidatorSet(request: GetLatestValidatorSetRequest): Promise { + const data = GetLatestValidatorSetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetLatestValidatorSet", data); + return promise.then((data) => GetLatestValidatorSetResponse.decode(new _m0.Reader(data))); + } + + GetValidatorSetByHeight(request: GetValidatorSetByHeightRequest): Promise { + const data = GetValidatorSetByHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetValidatorSetByHeight", data); + return promise.then((data) => GetValidatorSetByHeightResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/base/v1beta1/coin.ts b/common/types/src/lcd/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..b28eec03 --- /dev/null +++ b/common/types/src/lcd/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,261 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.v1beta1"; + +/** + * 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; +} + +/** + * 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; +} + +/** IntProto defines a Protobuf wrapper around an Int object. */ +export interface IntProto { + int: string; +} + +/** DecProto defines a Protobuf wrapper around a Dec object. */ +export interface DecProto { + dec: string; +} + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +export const Coin = { + encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Coin { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): Coin { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +export const DecCoin = { + encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? String(object.denom) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): DecCoin { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseIntProto(): IntProto { + return { int: "" }; +} + +export const IntProto = { + encode(message: IntProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): IntProto { + return { int: isSet(object.int) ? String(object.int) : "" }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + message.int !== undefined && (obj.int = message.int); + return obj; + }, + + fromPartial, I>>(object: I): IntProto { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, +}; + +function createBaseDecProto(): DecProto { + return { dec: "" }; +} + +export const DecProto = { + encode(message: DecProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DecProto { + return { dec: isSet(object.dec) ? String(object.dec) : "" }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + message.dec !== undefined && (obj.dec = message.dec); + return obj; + }, + + fromPartial, I>>(object: I): DecProto { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/capability/v1beta1/capability.ts b/common/types/src/lcd/cosmos/capability/v1beta1/capability.ts new file mode 100644 index 00000000..db10e372 --- /dev/null +++ b/common/types/src/lcd/cosmos/capability/v1beta1/capability.ts @@ -0,0 +1,210 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.capability.v1beta1"; + +/** + * Capability defines an implementation of an object capability. The index + * provided to a Capability must be globally unique. + */ +export interface Capability { + index: string; +} + +/** + * Owner defines a single capability owner. An owner is defined by the name of + * capability and the module name. + */ +export interface Owner { + module: string; + name: string; +} + +/** + * CapabilityOwners defines a set of owners of a single Capability. The set of + * owners must be unique. + */ +export interface CapabilityOwners { + owners: Owner[]; +} + +function createBaseCapability(): Capability { + return { index: "0" }; +} + +export const Capability = { + encode(message: Capability, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Capability { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCapability(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Capability { + return { index: isSet(object.index) ? String(object.index) : "0" }; + }, + + toJSON(message: Capability): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + return obj; + }, + + fromPartial, I>>(object: I): Capability { + const message = createBaseCapability(); + message.index = object.index ?? "0"; + return message; + }, +}; + +function createBaseOwner(): Owner { + return { module: "", name: "" }; +} + +export const Owner = { + encode(message: Owner, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Owner { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOwner(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.module = reader.string(); + break; + case 2: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Owner { + return { + module: isSet(object.module) ? String(object.module) : "", + name: isSet(object.name) ? String(object.name) : "", + }; + }, + + toJSON(message: Owner): unknown { + const obj: any = {}; + message.module !== undefined && (obj.module = message.module); + message.name !== undefined && (obj.name = message.name); + return obj; + }, + + fromPartial, I>>(object: I): Owner { + const message = createBaseOwner(); + message.module = object.module ?? ""; + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseCapabilityOwners(): CapabilityOwners { + return { owners: [] }; +} + +export const CapabilityOwners = { + encode(message: CapabilityOwners, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.owners) { + Owner.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CapabilityOwners { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCapabilityOwners(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owners.push(Owner.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CapabilityOwners { + return { owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => Owner.fromJSON(e)) : [] }; + }, + + toJSON(message: CapabilityOwners): unknown { + const obj: any = {}; + if (message.owners) { + obj.owners = message.owners.map((e) => e ? Owner.toJSON(e) : undefined); + } else { + obj.owners = []; + } + return obj; + }, + + fromPartial, I>>(object: I): CapabilityOwners { + const message = createBaseCapabilityOwners(); + message.owners = object.owners?.map((e) => Owner.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/capability/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/capability/v1beta1/genesis.ts new file mode 100644 index 00000000..eab16eaa --- /dev/null +++ b/common/types/src/lcd/cosmos/capability/v1beta1/genesis.ts @@ -0,0 +1,172 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { CapabilityOwners } from "./capability"; + +export const protobufPackage = "cosmos.capability.v1beta1"; + +/** GenesisOwners defines the capability owners with their corresponding index. */ +export interface GenesisOwners { + /** index is the index of the capability owner. */ + index: string; + /** index_owners are the owners at the given index. */ + index_owners?: CapabilityOwners; +} + +/** GenesisState defines the capability module's genesis state. */ +export interface GenesisState { + /** index is the capability global index. */ + index: string; + /** + * owners represents a map from index to owners of the capability index + * index key is string to allow amino marshalling. + */ + owners: GenesisOwners[]; +} + +function createBaseGenesisOwners(): GenesisOwners { + return { index: "0", index_owners: undefined }; +} + +export const GenesisOwners = { + encode(message: GenesisOwners, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.index_owners !== undefined) { + CapabilityOwners.encode(message.index_owners, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisOwners { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisOwners(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.index_owners = CapabilityOwners.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisOwners { + return { + index: isSet(object.index) ? String(object.index) : "0", + index_owners: isSet(object.index_owners) ? CapabilityOwners.fromJSON(object.index_owners) : undefined, + }; + }, + + toJSON(message: GenesisOwners): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.index_owners !== undefined && + (obj.index_owners = message.index_owners ? CapabilityOwners.toJSON(message.index_owners) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisOwners { + const message = createBaseGenesisOwners(); + message.index = object.index ?? "0"; + message.index_owners = (object.index_owners !== undefined && object.index_owners !== null) + ? CapabilityOwners.fromPartial(object.index_owners) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { index: "0", owners: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + for (const v of message.owners) { + GenesisOwners.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.owners.push(GenesisOwners.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + index: isSet(object.index) ? String(object.index) : "0", + owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => GenesisOwners.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + if (message.owners) { + obj.owners = message.owners.map((e) => e ? GenesisOwners.toJSON(e) : undefined); + } else { + obj.owners = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.index = object.index ?? "0"; + message.owners = object.owners?.map((e) => GenesisOwners.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/crisis/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/crisis/v1beta1/genesis.ts new file mode 100644 index 00000000..ea45d3e8 --- /dev/null +++ b/common/types/src/lcd/cosmos/crisis/v1beta1/genesis.ts @@ -0,0 +1,79 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.crisis.v1beta1"; + +/** GenesisState defines the crisis module's genesis state. */ +export interface GenesisState { + /** + * constant_fee is the fee used to verify the invariant in the crisis + * module. + */ + constant_fee?: Coin; +} + +function createBaseGenesisState(): GenesisState { + return { constant_fee: undefined }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.constant_fee !== undefined) { + Coin.encode(message.constant_fee, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.constant_fee = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { constant_fee: isSet(object.constant_fee) ? Coin.fromJSON(object.constant_fee) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.constant_fee !== undefined && + (obj.constant_fee = message.constant_fee ? Coin.toJSON(message.constant_fee) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.constant_fee = (object.constant_fee !== undefined && object.constant_fee !== null) + ? Coin.fromPartial(object.constant_fee) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/crisis/v1beta1/tx.ts b/common/types/src/lcd/cosmos/crisis/v1beta1/tx.ts new file mode 100644 index 00000000..34aef3b9 --- /dev/null +++ b/common/types/src/lcd/cosmos/crisis/v1beta1/tx.ts @@ -0,0 +1,161 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crisis.v1beta1"; + +/** MsgVerifyInvariant represents a message to verify a particular invariance. */ +export interface MsgVerifyInvariant { + sender: string; + invariant_module_name: string; + invariant_route: string; +} + +/** MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. */ +export interface MsgVerifyInvariantResponse { +} + +function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { + return { sender: "", invariant_module_name: "", invariant_route: "" }; +} + +export const MsgVerifyInvariant = { + encode(message: MsgVerifyInvariant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.invariant_module_name !== "") { + writer.uint32(18).string(message.invariant_module_name); + } + if (message.invariant_route !== "") { + writer.uint32(26).string(message.invariant_route); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVerifyInvariant { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.invariant_module_name = reader.string(); + break; + case 3: + message.invariant_route = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgVerifyInvariant { + return { + sender: isSet(object.sender) ? String(object.sender) : "", + invariant_module_name: isSet(object.invariant_module_name) ? String(object.invariant_module_name) : "", + invariant_route: isSet(object.invariant_route) ? String(object.invariant_route) : "", + }; + }, + + toJSON(message: MsgVerifyInvariant): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.invariant_module_name !== undefined && (obj.invariant_module_name = message.invariant_module_name); + message.invariant_route !== undefined && (obj.invariant_route = message.invariant_route); + return obj; + }, + + fromPartial, I>>(object: I): MsgVerifyInvariant { + const message = createBaseMsgVerifyInvariant(); + message.sender = object.sender ?? ""; + message.invariant_module_name = object.invariant_module_name ?? ""; + message.invariant_route = object.invariant_route ?? ""; + return message; + }, +}; + +function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { + return {}; +} + +export const MsgVerifyInvariantResponse = { + encode(_: MsgVerifyInvariantResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVerifyInvariantResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgVerifyInvariantResponse { + return {}; + }, + + toJSON(_: MsgVerifyInvariantResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVerifyInvariantResponse { + const message = createBaseMsgVerifyInvariantResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** VerifyInvariant defines a method to verify a particular invariance. */ + VerifyInvariant(request: MsgVerifyInvariant): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.crisis.v1beta1.Msg"; + this.rpc = rpc; + this.VerifyInvariant = this.VerifyInvariant.bind(this); + } + VerifyInvariant(request: MsgVerifyInvariant): Promise { + const data = MsgVerifyInvariant.encode(request).finish(); + const promise = this.rpc.request(this.service, "VerifyInvariant", data); + return promise.then((data) => MsgVerifyInvariantResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/crypto/ed25519/keys.ts b/common/types/src/lcd/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 00000000..b774ec88 --- /dev/null +++ b/common/types/src/lcd/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,178 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crypto.ed25519"; + +/** + * 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; +} + +/** + * Deprecated: 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; +} + +function createBasePubKey(): PubKey { + return { key: new Uint8Array() }; +} + +export const PubKey = { + encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array() }; +} + +export const PrivKey = { + encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/crypto/hd/v1/hd.ts b/common/types/src/lcd/cosmos/crypto/hd/v1/hd.ts new file mode 100644 index 00000000..622c613c --- /dev/null +++ b/common/types/src/lcd/cosmos/crypto/hd/v1/hd.ts @@ -0,0 +1,121 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crypto.hd.v1"; + +/** BIP44Params is used as path field in ledger item in Record. */ +export interface BIP44Params { + /** purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation */ + purpose: number; + /** coin_type is a constant that improves privacy */ + coin_type: number; + /** account splits the key space into independent user identities */ + account: number; + /** + * change is a constant used for public derivation. Constant 0 is used for external chain and constant 1 for internal + * chain. + */ + change: boolean; + /** address_index is used as child index in BIP32 derivation */ + address_index: number; +} + +function createBaseBIP44Params(): BIP44Params { + return { purpose: 0, coin_type: 0, account: 0, change: false, address_index: 0 }; +} + +export const BIP44Params = { + encode(message: BIP44Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.purpose !== 0) { + writer.uint32(8).uint32(message.purpose); + } + if (message.coin_type !== 0) { + writer.uint32(16).uint32(message.coin_type); + } + if (message.account !== 0) { + writer.uint32(24).uint32(message.account); + } + if (message.change === true) { + writer.uint32(32).bool(message.change); + } + if (message.address_index !== 0) { + writer.uint32(40).uint32(message.address_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BIP44Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBIP44Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purpose = reader.uint32(); + break; + case 2: + message.coin_type = reader.uint32(); + break; + case 3: + message.account = reader.uint32(); + break; + case 4: + message.change = reader.bool(); + break; + case 5: + message.address_index = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BIP44Params { + return { + purpose: isSet(object.purpose) ? Number(object.purpose) : 0, + coin_type: isSet(object.coin_type) ? Number(object.coin_type) : 0, + account: isSet(object.account) ? Number(object.account) : 0, + change: isSet(object.change) ? Boolean(object.change) : false, + address_index: isSet(object.address_index) ? Number(object.address_index) : 0, + }; + }, + + toJSON(message: BIP44Params): unknown { + const obj: any = {}; + message.purpose !== undefined && (obj.purpose = Math.round(message.purpose)); + message.coin_type !== undefined && (obj.coin_type = Math.round(message.coin_type)); + message.account !== undefined && (obj.account = Math.round(message.account)); + message.change !== undefined && (obj.change = message.change); + message.address_index !== undefined && (obj.address_index = Math.round(message.address_index)); + return obj; + }, + + fromPartial, I>>(object: I): BIP44Params { + const message = createBaseBIP44Params(); + message.purpose = object.purpose ?? 0; + message.coin_type = object.coin_type ?? 0; + message.account = object.account ?? 0; + message.change = object.change ?? false; + message.address_index = object.address_index ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/crypto/keyring/v1/record.ts b/common/types/src/lcd/cosmos/crypto/keyring/v1/record.ts new file mode 100644 index 00000000..953bfbb9 --- /dev/null +++ b/common/types/src/lcd/cosmos/crypto/keyring/v1/record.ts @@ -0,0 +1,357 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../../google/protobuf/any"; +import { BIP44Params } from "../../hd/v1/hd"; + +export const protobufPackage = "cosmos.crypto.keyring.v1"; + +/** Record is used for representing a key in the keyring. */ +export interface Record { + /** name represents a name of Record */ + name: string; + /** pub_key represents a public key in any format */ + pub_key?: Any; + /** local stores the public information about a locally stored key */ + local?: + | Record_Local + | undefined; + /** ledger stores the public information about a Ledger key */ + ledger?: + | Record_Ledger + | undefined; + /** Multi does not store any information. */ + multi?: + | Record_Multi + | undefined; + /** Offline does not store any information. */ + offline?: Record_Offline | undefined; +} + +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_Local { + priv_key?: Any; + priv_key_type: string; +} + +/** Ledger item */ +export interface Record_Ledger { + path?: BIP44Params; +} + +/** Multi item */ +export interface Record_Multi { +} + +/** Offline item */ +export interface Record_Offline { +} + +function createBaseRecord(): Record { + return { name: "", pub_key: undefined, local: undefined, ledger: undefined, multi: undefined, offline: undefined }; +} + +export const Record = { + encode(message: Record, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.pub_key !== undefined) { + Any.encode(message.pub_key, writer.uint32(18).fork()).ldelim(); + } + if (message.local !== undefined) { + Record_Local.encode(message.local, writer.uint32(26).fork()).ldelim(); + } + if (message.ledger !== undefined) { + Record_Ledger.encode(message.ledger, writer.uint32(34).fork()).ldelim(); + } + if (message.multi !== undefined) { + Record_Multi.encode(message.multi, writer.uint32(42).fork()).ldelim(); + } + if (message.offline !== undefined) { + Record_Offline.encode(message.offline, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.pub_key = Any.decode(reader, reader.uint32()); + break; + case 3: + message.local = Record_Local.decode(reader, reader.uint32()); + break; + case 4: + message.ledger = Record_Ledger.decode(reader, reader.uint32()); + break; + case 5: + message.multi = Record_Multi.decode(reader, reader.uint32()); + break; + case 6: + message.offline = Record_Offline.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Record { + return { + name: isSet(object.name) ? String(object.name) : "", + pub_key: isSet(object.pub_key) ? Any.fromJSON(object.pub_key) : undefined, + local: isSet(object.local) ? Record_Local.fromJSON(object.local) : undefined, + ledger: isSet(object.ledger) ? Record_Ledger.fromJSON(object.ledger) : undefined, + multi: isSet(object.multi) ? Record_Multi.fromJSON(object.multi) : undefined, + offline: isSet(object.offline) ? Record_Offline.fromJSON(object.offline) : undefined, + }; + }, + + toJSON(message: Record): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? Any.toJSON(message.pub_key) : undefined); + message.local !== undefined && (obj.local = message.local ? Record_Local.toJSON(message.local) : undefined); + message.ledger !== undefined && (obj.ledger = message.ledger ? Record_Ledger.toJSON(message.ledger) : undefined); + message.multi !== undefined && (obj.multi = message.multi ? Record_Multi.toJSON(message.multi) : undefined); + message.offline !== undefined && + (obj.offline = message.offline ? Record_Offline.toJSON(message.offline) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Record { + const message = createBaseRecord(); + message.name = object.name ?? ""; + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? Any.fromPartial(object.pub_key) + : undefined; + message.local = (object.local !== undefined && object.local !== null) + ? Record_Local.fromPartial(object.local) + : undefined; + message.ledger = (object.ledger !== undefined && object.ledger !== null) + ? Record_Ledger.fromPartial(object.ledger) + : undefined; + message.multi = (object.multi !== undefined && object.multi !== null) + ? Record_Multi.fromPartial(object.multi) + : undefined; + message.offline = (object.offline !== undefined && object.offline !== null) + ? Record_Offline.fromPartial(object.offline) + : undefined; + return message; + }, +}; + +function createBaseRecord_Local(): Record_Local { + return { priv_key: undefined, priv_key_type: "" }; +} + +export const Record_Local = { + encode(message: Record_Local, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.priv_key !== undefined) { + Any.encode(message.priv_key, writer.uint32(10).fork()).ldelim(); + } + if (message.priv_key_type !== "") { + writer.uint32(18).string(message.priv_key_type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record_Local { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Local(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.priv_key = Any.decode(reader, reader.uint32()); + break; + case 2: + message.priv_key_type = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Record_Local { + return { + priv_key: isSet(object.priv_key) ? Any.fromJSON(object.priv_key) : undefined, + priv_key_type: isSet(object.priv_key_type) ? String(object.priv_key_type) : "", + }; + }, + + toJSON(message: Record_Local): unknown { + const obj: any = {}; + message.priv_key !== undefined && (obj.priv_key = message.priv_key ? Any.toJSON(message.priv_key) : undefined); + message.priv_key_type !== undefined && (obj.priv_key_type = message.priv_key_type); + return obj; + }, + + fromPartial, I>>(object: I): Record_Local { + const message = createBaseRecord_Local(); + message.priv_key = (object.priv_key !== undefined && object.priv_key !== null) + ? Any.fromPartial(object.priv_key) + : undefined; + message.priv_key_type = object.priv_key_type ?? ""; + return message; + }, +}; + +function createBaseRecord_Ledger(): Record_Ledger { + return { path: undefined }; +} + +export const Record_Ledger = { + encode(message: Record_Ledger, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.path !== undefined) { + BIP44Params.encode(message.path, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record_Ledger { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Ledger(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = BIP44Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Record_Ledger { + return { path: isSet(object.path) ? BIP44Params.fromJSON(object.path) : undefined }; + }, + + toJSON(message: Record_Ledger): unknown { + const obj: any = {}; + message.path !== undefined && (obj.path = message.path ? BIP44Params.toJSON(message.path) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Record_Ledger { + const message = createBaseRecord_Ledger(); + message.path = (object.path !== undefined && object.path !== null) + ? BIP44Params.fromPartial(object.path) + : undefined; + return message; + }, +}; + +function createBaseRecord_Multi(): Record_Multi { + return {}; +} + +export const Record_Multi = { + encode(_: Record_Multi, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record_Multi { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): Record_Multi { + return {}; + }, + + toJSON(_: Record_Multi): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Record_Multi { + const message = createBaseRecord_Multi(); + return message; + }, +}; + +function createBaseRecord_Offline(): Record_Offline { + return {}; +} + +export const Record_Offline = { + encode(_: Record_Offline, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Record_Offline { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Offline(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): Record_Offline { + return {}; + }, + + toJSON(_: Record_Offline): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Record_Offline { + const message = createBaseRecord_Offline(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/crypto/multisig/keys.ts b/common/types/src/lcd/cosmos/crypto/multisig/keys.ts new file mode 100644 index 00000000..22f0af90 --- /dev/null +++ b/common/types/src/lcd/cosmos/crypto/multisig/keys.ts @@ -0,0 +1,92 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.crypto.multisig"; + +/** + * LegacyAminoPubKey specifies a public key type + * which nests multiple public keys and a threshold, + * it uses legacy amino address rules. + */ +export interface LegacyAminoPubKey { + threshold: number; + public_keys: Any[]; +} + +function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { + return { threshold: 0, public_keys: [] }; +} + +export const LegacyAminoPubKey = { + encode(message: LegacyAminoPubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.threshold !== 0) { + writer.uint32(8).uint32(message.threshold); + } + for (const v of message.public_keys) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LegacyAminoPubKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLegacyAminoPubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.threshold = reader.uint32(); + break; + case 2: + message.public_keys.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LegacyAminoPubKey { + return { + threshold: isSet(object.threshold) ? Number(object.threshold) : 0, + public_keys: Array.isArray(object?.public_keys) ? object.public_keys.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: LegacyAminoPubKey): unknown { + const obj: any = {}; + message.threshold !== undefined && (obj.threshold = Math.round(message.threshold)); + if (message.public_keys) { + obj.public_keys = message.public_keys.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.public_keys = []; + } + return obj; + }, + + fromPartial, I>>(object: I): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + message.threshold = object.threshold ?? 0; + message.public_keys = object.public_keys?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/crypto/multisig/v1beta1/multisig.ts b/common/types/src/lcd/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 00000000..5eeeef5a --- /dev/null +++ b/common/types/src/lcd/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,195 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crypto.multisig.v1beta1"; + +/** + * 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[]; +} + +/** + * 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 { + extra_bits_stored: number; + elems: Uint8Array; +} + +function createBaseMultiSignature(): MultiSignature { + return { signatures: [] }; +} + +export const MultiSignature = { + encode(message: MultiSignature, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.signatures) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MultiSignature { + return { + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: MultiSignature): unknown { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCompactBitArray(): CompactBitArray { + return { extra_bits_stored: 0, elems: new Uint8Array() }; +} + +export const CompactBitArray = { + encode(message: CompactBitArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.extra_bits_stored !== 0) { + writer.uint32(8).uint32(message.extra_bits_stored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.extra_bits_stored = reader.uint32(); + break; + case 2: + message.elems = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CompactBitArray { + return { + extra_bits_stored: isSet(object.extra_bits_stored) ? Number(object.extra_bits_stored) : 0, + elems: isSet(object.elems) ? bytesFromBase64(object.elems) : new Uint8Array(), + }; + }, + + toJSON(message: CompactBitArray): unknown { + const obj: any = {}; + message.extra_bits_stored !== undefined && (obj.extra_bits_stored = Math.round(message.extra_bits_stored)); + message.elems !== undefined && + (obj.elems = base64FromBytes(message.elems !== undefined ? message.elems : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): CompactBitArray { + const message = createBaseCompactBitArray(); + message.extra_bits_stored = object.extra_bits_stored ?? 0; + message.elems = object.elems ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/crypto/secp256k1/keys.ts b/common/types/src/lcd/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 00000000..379a8913 --- /dev/null +++ b/common/types/src/lcd/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,175 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crypto.secp256k1"; + +/** + * 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; +} + +/** PrivKey defines a secp256k1 private key. */ +export interface PrivKey { + key: Uint8Array; +} + +function createBasePubKey(): PubKey { + return { key: new Uint8Array() }; +} + +export const PubKey = { + encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array() }; +} + +export const PrivKey = { + encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/crypto/secp256r1/keys.ts b/common/types/src/lcd/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 00000000..25234f80 --- /dev/null +++ b/common/types/src/lcd/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,176 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.crypto.secp256r1"; + +/** Since: cosmos-sdk 0.43 */ + +/** 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; +} + +/** PrivKey defines a secp256r1 ECDSA private key. */ +export interface PrivKey { + /** secret number serialized using big-endian encoding */ + secret: Uint8Array; +} + +function createBasePubKey(): PubKey { + return { key: new Uint8Array() }; +} + +export const PubKey = { + encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; + +function createBasePrivKey(): PrivKey { + return { secret: new Uint8Array() }; +} + +export const PrivKey = { + encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.secret.length !== 0) { + writer.uint32(10).bytes(message.secret); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PrivKey { + return { secret: isSet(object.secret) ? bytesFromBase64(object.secret) : new Uint8Array() }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + message.secret !== undefined && + (obj.secret = base64FromBytes(message.secret !== undefined ? message.secret : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.secret = object.secret ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/distribution/v1beta1/distribution.ts b/common/types/src/lcd/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..9bec5691 --- /dev/null +++ b/common/types/src/lcd/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,926 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Coin, DecCoin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** Params defines the set of params for the distribution module. */ +export interface Params { + community_tax: string; + base_proposer_reward: string; + bonus_proposer_reward: string; + withdraw_addr_enabled: boolean; +} + +/** + * 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 { + cumulative_reward_ratio: DecCoin[]; + reference_count: number; +} + +/** + * 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: string; +} + +/** + * ValidatorAccumulatedCommission represents accumulated commission + * for a validator kept as a running counter, can be withdrawn at any time. + */ +export interface ValidatorAccumulatedCommission { + commission: DecCoin[]; +} + +/** + * ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards + * for a validator inexpensive to track, allows simple sanity checks. + */ +export interface ValidatorOutstandingRewards { + rewards: DecCoin[]; +} + +/** + * 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 { + validator_period: string; + fraction: string; +} + +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validator_slash_events: ValidatorSlashEvent[]; +} + +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + community_pool: DecCoin[]; +} + +/** + * CommunityPoolSpendProposal details a proposal for use of community funds, + * together with how many coins are proposed to be spent, and to which + * recipient account. + */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +/** + * 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 { + previous_period: string; + stake: string; + height: string; +} + +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validator_address: string; + reward: DecCoin[]; +} + +/** + * CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal + * with a deposit + */ +export interface CommunityPoolSpendProposalWithDeposit { + title: string; + description: string; + recipient: string; + amount: string; + deposit: string; +} + +function createBaseParams(): Params { + return { community_tax: "", base_proposer_reward: "", bonus_proposer_reward: "", withdraw_addr_enabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.community_tax !== "") { + writer.uint32(10).string(message.community_tax); + } + if (message.base_proposer_reward !== "") { + writer.uint32(18).string(message.base_proposer_reward); + } + if (message.bonus_proposer_reward !== "") { + writer.uint32(26).string(message.bonus_proposer_reward); + } + if (message.withdraw_addr_enabled === true) { + writer.uint32(32).bool(message.withdraw_addr_enabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.community_tax = reader.string(); + break; + case 2: + message.base_proposer_reward = reader.string(); + break; + case 3: + message.bonus_proposer_reward = reader.string(); + break; + case 4: + message.withdraw_addr_enabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + community_tax: isSet(object.community_tax) ? String(object.community_tax) : "", + base_proposer_reward: isSet(object.base_proposer_reward) ? String(object.base_proposer_reward) : "", + bonus_proposer_reward: isSet(object.bonus_proposer_reward) ? String(object.bonus_proposer_reward) : "", + withdraw_addr_enabled: isSet(object.withdraw_addr_enabled) ? Boolean(object.withdraw_addr_enabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.community_tax !== undefined && (obj.community_tax = message.community_tax); + message.base_proposer_reward !== undefined && (obj.base_proposer_reward = message.base_proposer_reward); + message.bonus_proposer_reward !== undefined && (obj.bonus_proposer_reward = message.bonus_proposer_reward); + message.withdraw_addr_enabled !== undefined && (obj.withdraw_addr_enabled = message.withdraw_addr_enabled); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.community_tax = object.community_tax ?? ""; + message.base_proposer_reward = object.base_proposer_reward ?? ""; + message.bonus_proposer_reward = object.bonus_proposer_reward ?? ""; + message.withdraw_addr_enabled = object.withdraw_addr_enabled ?? false; + return message; + }, +}; + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulative_reward_ratio: [], reference_count: 0 }; +} + +export const ValidatorHistoricalRewards = { + encode(message: ValidatorHistoricalRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cumulative_reward_ratio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.reference_count !== 0) { + writer.uint32(16).uint32(message.reference_count); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.cumulative_reward_ratio.push(DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.reference_count = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulative_reward_ratio: Array.isArray(object?.cumulative_reward_ratio) + ? object.cumulative_reward_ratio.map((e: any) => DecCoin.fromJSON(e)) + : [], + reference_count: isSet(object.reference_count) ? Number(object.reference_count) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulative_reward_ratio) { + obj.cumulative_reward_ratio = message.cumulative_reward_ratio.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.cumulative_reward_ratio = []; + } + message.reference_count !== undefined && (obj.reference_count = Math.round(message.reference_count)); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulative_reward_ratio = object.cumulative_reward_ratio?.map((e) => DecCoin.fromPartial(e)) || []; + message.reference_count = object.reference_count ?? 0; + return message; + }, +}; + +function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { + return { rewards: [], period: "0" }; +} + +export const ValidatorCurrentRewards = { + encode(message: ValidatorCurrentRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.period !== "0") { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? String(object.period) : "0", + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.rewards = []; + } + message.period !== undefined && (obj.period = message.period); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorCurrentRewards { + const message = createBaseValidatorCurrentRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.period = object.period ?? "0"; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommission(): ValidatorAccumulatedCommission { + return { commission: [] }; +} + +export const ValidatorAccumulatedCommission = { + encode(message: ValidatorAccumulatedCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ValidatorAccumulatedCommission { + return { + commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorAccumulatedCommission): unknown { + const obj: any = {}; + if (message.commission) { + obj.commission = message.commission.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.commission = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommission { + const message = createBaseValidatorAccumulatedCommission(); + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorOutstandingRewards(): ValidatorOutstandingRewards { + return { rewards: [] }; +} + +export const ValidatorOutstandingRewards = { + encode(message: ValidatorOutstandingRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ValidatorOutstandingRewards { + return { rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: ValidatorOutstandingRewards): unknown { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.rewards = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validator_period: "0", fraction: "" }; +} + +export const ValidatorSlashEvent = { + encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_period !== "0") { + writer.uint32(8).uint64(message.validator_period); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_period = longToString(reader.uint64() as Long); + break; + case 2: + message.fraction = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validator_period: isSet(object.validator_period) ? String(object.validator_period) : "0", + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + message.validator_period !== undefined && (obj.validator_period = message.validator_period); + message.fraction !== undefined && (obj.fraction = message.fraction); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validator_period = object.validator_period ?? "0"; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validator_slash_events: [] }; +} + +export const ValidatorSlashEvents = { + encode(message: ValidatorSlashEvents, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validator_slash_events) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_slash_events.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validator_slash_events: Array.isArray(object?.validator_slash_events) + ? object.validator_slash_events.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validator_slash_events) { + obj.validator_slash_events = message.validator_slash_events.map((e) => + e ? ValidatorSlashEvent.toJSON(e) : undefined + ); + } else { + obj.validator_slash_events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validator_slash_events = object.validator_slash_events?.map((e) => ValidatorSlashEvent.fromPartial(e)) || + []; + return message; + }, +}; + +function createBaseFeePool(): FeePool { + return { community_pool: [] }; +} + +export const FeePool = { + encode(message: FeePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.community_pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FeePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.community_pool.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + community_pool: Array.isArray(object?.community_pool) + ? object.community_pool.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.community_pool) { + obj.community_pool = message.community_pool.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.community_pool = []; + } + return obj; + }, + + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.community_pool = object.community_pool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { + return { title: "", description: "", recipient: "", amount: [] }; +} + +export const CommunityPoolSpendProposal = { + encode(message: CommunityPoolSpendProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): CommunityPoolSpendProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommunityPoolSpendProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseDelegatorStartingInfo(): DelegatorStartingInfo { + return { previous_period: "0", stake: "", height: "0" }; +} + +export const DelegatorStartingInfo = { + encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.previous_period !== "0") { + writer.uint32(8).uint64(message.previous_period); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (message.height !== "0") { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.previous_period = longToString(reader.uint64() as Long); + break; + case 2: + message.stake = reader.string(); + break; + case 3: + message.height = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previous_period: isSet(object.previous_period) ? String(object.previous_period) : "0", + stake: isSet(object.stake) ? String(object.stake) : "", + height: isSet(object.height) ? String(object.height) : "0", + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + message.previous_period !== undefined && (obj.previous_period = message.previous_period); + message.stake !== undefined && (obj.stake = message.stake); + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previous_period = object.previous_period ?? "0"; + message.stake = object.stake ?? ""; + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validator_address: "", reward: [] }; +} + +export const DelegationDelegatorReward = { + encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_address = reader.string(); + break; + case 2: + message.reward.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + if (message.reward) { + obj.reward = message.reward.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.reward = []; + } + return obj; + }, + + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validator_address = object.validator_address ?? ""; + message.reward = object.reward?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { + return { title: "", description: "", recipient: "", amount: "", deposit: "" }; +} + +export const CommunityPoolSpendProposalWithDeposit = { + encode(message: CommunityPoolSpendProposalWithDeposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): CommunityPoolSpendProposalWithDeposit { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + recipient: isSet(object.recipient) ? String(object.recipient) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + deposit: isSet(object.deposit) ? String(object.deposit) : "", + }; + }, + + toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.recipient !== undefined && (obj.recipient = message.recipient); + message.amount !== undefined && (obj.amount = message.amount); + message.deposit !== undefined && (obj.deposit = message.deposit); + return obj; + }, + + fromPartial, I>>( + object: I, + ): 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; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/distribution/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..c07645dd --- /dev/null +++ b/common/types/src/lcd/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,822 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { DecCoin } from "../../base/v1beta1/coin"; +import { + DelegatorStartingInfo, + FeePool, + Params, + ValidatorAccumulatedCommission, + ValidatorCurrentRewards, + ValidatorHistoricalRewards, + ValidatorSlashEvent, +} from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * DelegatorWithdrawInfo is the address for where distributions rewards are + * withdrawn to by default this struct is only used at genesis to feed in + * default withdraw addresses. + */ +export interface DelegatorWithdrawInfo { + /** delegator_address is the address of the delegator. */ + delegator_address: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdraw_address: string; +} + +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** outstanding_rewards represents the oustanding rewards of a validator. */ + outstanding_rewards: DecCoin[]; +} + +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated?: ValidatorAccumulatedCommission; +} + +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** period defines the period the historical rewards apply to. */ + period: string; + /** rewards defines the historical rewards of a validator. */ + rewards?: ValidatorHistoricalRewards; +} + +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** rewards defines the current rewards of a validator. */ + rewards?: ValidatorCurrentRewards; +} + +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegator_address: string; + /** validator_address is the address of the validator. */ + validator_address: string; + /** starting_info defines the starting info of a delegator. */ + starting_info?: DelegatorStartingInfo; +} + +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** height defines the block height at which the slash event occured. */ + height: string; + /** period is the period of the slash event. */ + period: string; + /** validator_slash_event describes the slash event. */ + validator_slash_event?: ValidatorSlashEvent; +} + +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the paramaters of the module. */ + params?: Params; + /** fee_pool defines the fee pool at genesis. */ + fee_pool?: FeePool; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegator_withdraw_infos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previous_proposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstanding_rewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commisions of all validators at genesis. */ + validator_accumulated_commissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validator_historical_rewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validator_current_rewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegator_starting_infos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validator_slash_events: ValidatorSlashEventRecord[]; +} + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegator_address: "", withdraw_address: "" }; +} + +export const DelegatorWithdrawInfo = { + encode(message: DelegatorWithdrawInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.withdraw_address !== "") { + writer.uint32(18).string(message.withdraw_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorWithdrawInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.withdraw_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + withdraw_address: isSet(object.withdraw_address) ? String(object.withdraw_address) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.withdraw_address !== undefined && (obj.withdraw_address = message.withdraw_address); + return obj; + }, + + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegator_address = object.delegator_address ?? ""; + message.withdraw_address = object.withdraw_address ?? ""; + return message; + }, +}; + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validator_address: "", outstanding_rewards: [] }; +} + +export const ValidatorOutstandingRewardsRecord = { + encode(message: ValidatorOutstandingRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + for (const v of message.outstanding_rewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorOutstandingRewardsRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.outstanding_rewards.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + outstanding_rewards: Array.isArray(object?.outstanding_rewards) + ? object.outstanding_rewards.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + if (message.outstanding_rewards) { + obj.outstanding_rewards = message.outstanding_rewards.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.outstanding_rewards = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validator_address = object.validator_address ?? ""; + message.outstanding_rewards = object.outstanding_rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validator_address: "", accumulated: undefined }; +} + +export const ValidatorAccumulatedCommissionRecord = { + encode(message: ValidatorAccumulatedCommissionRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.accumulated !== undefined) { + ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorAccumulatedCommissionRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommissionRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.accumulated !== undefined && + (obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toJSON(message.accumulated) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validator_address = object.validator_address ?? ""; + message.accumulated = (object.accumulated !== undefined && object.accumulated !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) + : undefined; + return message; + }, +}; + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validator_address: "", period: "0", rewards: undefined }; +} + +export const ValidatorHistoricalRewardsRecord = { + encode(message: ValidatorHistoricalRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.period !== "0") { + writer.uint32(16).uint64(message.period); + } + if (message.rewards !== undefined) { + ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewardsRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.period = longToString(reader.uint64() as Long); + break; + case 3: + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + period: isSet(object.period) ? String(object.period) : "0", + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.period !== undefined && (obj.period = message.period); + message.rewards !== undefined && + (obj.rewards = message.rewards ? ValidatorHistoricalRewards.toJSON(message.rewards) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validator_address = object.validator_address ?? ""; + message.period = object.period ?? "0"; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorHistoricalRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validator_address: "", rewards: undefined }; +} + +export const ValidatorCurrentRewardsRecord = { + encode(message: ValidatorCurrentRewardsRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.rewards !== undefined) { + ValidatorCurrentRewards.encode(message.rewards, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorCurrentRewardsRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.rewards !== undefined && + (obj.rewards = message.rewards ? ValidatorCurrentRewards.toJSON(message.rewards) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validator_address = object.validator_address ?? ""; + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorCurrentRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegator_address: "", validator_address: "", starting_info: undefined }; +} + +export const DelegatorStartingInfoRecord = { + encode(message: DelegatorStartingInfoRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.starting_info !== undefined) { + DelegatorStartingInfo.encode(message.starting_info, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfoRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.starting_info = DelegatorStartingInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + starting_info: isSet(object.starting_info) ? DelegatorStartingInfo.fromJSON(object.starting_info) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.starting_info !== undefined && + (obj.starting_info = message.starting_info ? DelegatorStartingInfo.toJSON(message.starting_info) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.starting_info = (object.starting_info !== undefined && object.starting_info !== null) + ? DelegatorStartingInfo.fromPartial(object.starting_info) + : undefined; + return message; + }, +}; + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validator_address: "", height: "0", period: "0", validator_slash_event: undefined }; +} + +export const ValidatorSlashEventRecord = { + encode(message: ValidatorSlashEventRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.height !== "0") { + writer.uint32(16).uint64(message.height); + } + if (message.period !== "0") { + writer.uint32(24).uint64(message.period); + } + if (message.validator_slash_event !== undefined) { + ValidatorSlashEvent.encode(message.validator_slash_event, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEventRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.height = longToString(reader.uint64() as Long); + break; + case 3: + message.period = longToString(reader.uint64() as Long); + break; + case 4: + message.validator_slash_event = ValidatorSlashEvent.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + height: isSet(object.height) ? String(object.height) : "0", + period: isSet(object.period) ? String(object.period) : "0", + validator_slash_event: isSet(object.validator_slash_event) + ? ValidatorSlashEvent.fromJSON(object.validator_slash_event) + : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.height !== undefined && (obj.height = message.height); + message.period !== undefined && (obj.period = message.period); + message.validator_slash_event !== undefined && (obj.validator_slash_event = message.validator_slash_event + ? ValidatorSlashEvent.toJSON(message.validator_slash_event) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validator_address = object.validator_address ?? ""; + message.height = object.height ?? "0"; + message.period = object.period ?? "0"; + message.validator_slash_event = + (object.validator_slash_event !== undefined && object.validator_slash_event !== null) + ? ValidatorSlashEvent.fromPartial(object.validator_slash_event) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + fee_pool: undefined, + delegator_withdraw_infos: [], + previous_proposer: "", + outstanding_rewards: [], + validator_accumulated_commissions: [], + validator_historical_rewards: [], + validator_current_rewards: [], + delegator_starting_infos: [], + validator_slash_events: [], + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.fee_pool !== undefined) { + FeePool.encode(message.fee_pool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegator_withdraw_infos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previous_proposer !== "") { + writer.uint32(34).string(message.previous_proposer); + } + for (const v of message.outstanding_rewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validator_accumulated_commissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validator_historical_rewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validator_current_rewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegator_starting_infos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validator_slash_events) { + ValidatorSlashEventRecord.encode(v!, writer.uint32(82).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.fee_pool = FeePool.decode(reader, reader.uint32()); + break; + case 3: + message.delegator_withdraw_infos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + break; + case 4: + message.previous_proposer = reader.string(); + break; + case 5: + message.outstanding_rewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + break; + case 6: + message.validator_accumulated_commissions.push( + ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32()), + ); + break; + case 7: + message.validator_historical_rewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + break; + case 8: + message.validator_current_rewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + break; + case 9: + message.delegator_starting_infos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + break; + case 10: + message.validator_slash_events.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + fee_pool: isSet(object.fee_pool) ? FeePool.fromJSON(object.fee_pool) : undefined, + delegator_withdraw_infos: Array.isArray(object?.delegator_withdraw_infos) + ? object.delegator_withdraw_infos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previous_proposer: isSet(object.previous_proposer) ? String(object.previous_proposer) : "", + outstanding_rewards: Array.isArray(object?.outstanding_rewards) + ? object.outstanding_rewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validator_accumulated_commissions: Array.isArray(object?.validator_accumulated_commissions) + ? object.validator_accumulated_commissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validator_historical_rewards: Array.isArray(object?.validator_historical_rewards) + ? object.validator_historical_rewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validator_current_rewards: Array.isArray(object?.validator_current_rewards) + ? object.validator_current_rewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegator_starting_infos: Array.isArray(object?.delegator_starting_infos) + ? object.delegator_starting_infos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validator_slash_events: Array.isArray(object?.validator_slash_events) + ? object.validator_slash_events.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + message.fee_pool !== undefined && (obj.fee_pool = message.fee_pool ? FeePool.toJSON(message.fee_pool) : undefined); + if (message.delegator_withdraw_infos) { + obj.delegator_withdraw_infos = message.delegator_withdraw_infos.map((e) => + e ? DelegatorWithdrawInfo.toJSON(e) : undefined + ); + } else { + obj.delegator_withdraw_infos = []; + } + message.previous_proposer !== undefined && (obj.previous_proposer = message.previous_proposer); + if (message.outstanding_rewards) { + obj.outstanding_rewards = message.outstanding_rewards.map((e) => + e ? ValidatorOutstandingRewardsRecord.toJSON(e) : undefined + ); + } else { + obj.outstanding_rewards = []; + } + if (message.validator_accumulated_commissions) { + obj.validator_accumulated_commissions = message.validator_accumulated_commissions.map((e) => + e ? ValidatorAccumulatedCommissionRecord.toJSON(e) : undefined + ); + } else { + obj.validator_accumulated_commissions = []; + } + if (message.validator_historical_rewards) { + obj.validator_historical_rewards = message.validator_historical_rewards.map((e) => + e ? ValidatorHistoricalRewardsRecord.toJSON(e) : undefined + ); + } else { + obj.validator_historical_rewards = []; + } + if (message.validator_current_rewards) { + obj.validator_current_rewards = message.validator_current_rewards.map((e) => + e ? ValidatorCurrentRewardsRecord.toJSON(e) : undefined + ); + } else { + obj.validator_current_rewards = []; + } + if (message.delegator_starting_infos) { + obj.delegator_starting_infos = message.delegator_starting_infos.map((e) => + e ? DelegatorStartingInfoRecord.toJSON(e) : undefined + ); + } else { + obj.delegator_starting_infos = []; + } + if (message.validator_slash_events) { + obj.validator_slash_events = message.validator_slash_events.map((e) => + e ? ValidatorSlashEventRecord.toJSON(e) : undefined + ); + } else { + obj.validator_slash_events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.fee_pool = (object.fee_pool !== undefined && object.fee_pool !== null) + ? FeePool.fromPartial(object.fee_pool) + : undefined; + message.delegator_withdraw_infos = + object.delegator_withdraw_infos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || []; + message.previous_proposer = object.previous_proposer ?? ""; + message.outstanding_rewards = + object.outstanding_rewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validator_accumulated_commissions = + object.validator_accumulated_commissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validator_historical_rewards = + object.validator_historical_rewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validator_current_rewards = + object.validator_current_rewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegator_starting_infos = + object.delegator_starting_infos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validator_slash_events = + object.validator_slash_events?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/distribution/v1beta1/query.ts b/common/types/src/lcd/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..50a90ca0 --- /dev/null +++ b/common/types/src/lcd/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1269 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { DecCoin } from "../../base/v1beta1/coin"; +import { + DelegationDelegatorReward, + Params, + ValidatorAccumulatedCommission, + ValidatorOutstandingRewards, + ValidatorSlashEvent, +} from "./distribution"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validator_address: string; +} + +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards?: ValidatorOutstandingRewards; +} + +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validator_address: string; +} + +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commision the validator received. */ + commission?: ValidatorAccumulatedCommission; +} + +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validator_address: string; + /** starting_height defines the optional starting height to query the slashes. */ + starting_height: string; + /** starting_height defines the optional ending height to query the slashes. */ + ending_height: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryValidatorSlashesResponse is the response type for the + * Query/ValidatorSlashes RPC method. + */ +export interface QueryValidatorSlashesResponse { + /** slashes defines the slashes the validator received. */ + slashes: ValidatorSlashEvent[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; + /** validator_address defines the validator address to query for. */ + validator_address: string; +} + +/** + * QueryDelegationRewardsResponse is the response type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsResponse { + /** rewards defines the rewards accrued by a delegation. */ + rewards: DecCoin[]; +} + +/** + * QueryDelegationTotalRewardsRequest is the request type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; +} + +/** + * QueryDelegationTotalRewardsResponse is the response type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsResponse { + /** rewards defines all the rewards accrued by a delegator. */ + rewards: DelegationDelegatorReward[]; + /** total defines the sum of all the rewards. */ + total: DecCoin[]; +} + +/** + * QueryDelegatorValidatorsRequest is the request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; +} + +/** + * QueryDelegatorValidatorsResponse is the response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators a delegator is delegating for. */ + validators: string[]; +} + +/** + * QueryDelegatorWithdrawAddressRequest is the request type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; +} + +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdraw_address: string; +} + +/** + * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC + * method. + */ +export interface QueryCommunityPoolRequest { +} + +/** + * QueryCommunityPoolResponse is the response type for the Query/CommunityPool + * RPC method. + */ +export interface QueryCommunityPoolResponse { + /** pool defines community pool's coins. */ + pool: DecCoin[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validator_address: "" }; +} + +export const QueryValidatorOutstandingRewardsRequest = { + encode(message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validator_address: isSet(object.validator_address) ? String(object.validator_address) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { + return { rewards: undefined }; +} + +export const QueryValidatorOutstandingRewardsResponse = { + encode(message: QueryValidatorOutstandingRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.rewards !== undefined) { + ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + message.rewards !== undefined && + (obj.rewards = message.rewards ? ValidatorOutstandingRewards.toJSON(message.rewards) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorOutstandingRewardsResponse { + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + message.rewards = (object.rewards !== undefined && object.rewards !== null) + ? ValidatorOutstandingRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorCommissionRequest(): QueryValidatorCommissionRequest { + return { validator_address: "" }; +} + +export const QueryValidatorCommissionRequest = { + encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorCommissionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validator_address: isSet(object.validator_address) ? String(object.validator_address) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { + return { commission: undefined }; +} + +export const QueryValidatorCommissionResponse = { + encode(message: QueryValidatorCommissionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.commission !== undefined) { + ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + message.commission !== undefined && + (obj.commission = message.commission ? ValidatorAccumulatedCommission.toJSON(message.commission) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorCommissionResponse { + const message = createBaseQueryValidatorCommissionResponse(); + message.commission = (object.commission !== undefined && object.commission !== null) + ? ValidatorAccumulatedCommission.fromPartial(object.commission) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSlashesRequest(): QueryValidatorSlashesRequest { + return { validator_address: "", starting_height: "0", ending_height: "0", pagination: undefined }; +} + +export const QueryValidatorSlashesRequest = { + encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.starting_height !== "0") { + writer.uint32(16).uint64(message.starting_height); + } + if (message.ending_height !== "0") { + writer.uint32(24).uint64(message.ending_height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorSlashesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSlashesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.starting_height = longToString(reader.uint64() as Long); + break; + case 3: + message.ending_height = longToString(reader.uint64() as Long); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + starting_height: isSet(object.starting_height) ? String(object.starting_height) : "0", + ending_height: isSet(object.ending_height) ? String(object.ending_height) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.starting_height !== undefined && (obj.starting_height = message.starting_height); + message.ending_height !== undefined && (obj.ending_height = message.ending_height); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validator_address = object.validator_address ?? ""; + message.starting_height = object.starting_height ?? "0"; + message.ending_height = object.ending_height ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorSlashesResponse(): QueryValidatorSlashesResponse { + return { slashes: [], pagination: undefined }; +} + +export const QueryValidatorSlashesResponse = { + encode(message: QueryValidatorSlashesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.slashes) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorSlashesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSlashesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesResponse { + return { + slashes: Array.isArray(object?.slashes) ? object.slashes.map((e: any) => ValidatorSlashEvent.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesResponse): unknown { + const obj: any = {}; + if (message.slashes) { + obj.slashes = message.slashes.map((e) => e ? ValidatorSlashEvent.toJSON(e) : undefined); + } else { + obj.slashes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorSlashesResponse { + const message = createBaseQueryValidatorSlashesResponse(); + message.slashes = object.slashes?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegationRewardsRequest(): QueryDelegationRewardsRequest { + return { delegator_address: "", validator_address: "" }; +} + +export const QueryDelegationRewardsRequest = { + encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { + return { rewards: [] }; +} + +export const QueryDelegationRewardsResponse = { + encode(message: QueryDelegationRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRewardsResponse(); + 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; + }, + + fromJSON(object: any): QueryDelegationRewardsResponse { + return { rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryDelegationRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.rewards = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegator_address: "" }; +} + +export const QueryDelegationTotalRewardsRequest = { + encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationTotalRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegator_address = object.delegator_address ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { + return { rewards: [], total: [] }; +} + +export const QueryDelegationTotalRewardsResponse = { + encode(message: QueryDelegationTotalRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rewards) { + DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.total) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationTotalRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + break; + case 2: + message.total.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsResponse { + return { + rewards: Array.isArray(object?.rewards) + ? object.rewards.map((e: any) => DelegationDelegatorReward.fromJSON(e)) + : [], + total: Array.isArray(object?.total) ? object.total.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationTotalRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => e ? DelegationDelegatorReward.toJSON(e) : undefined); + } else { + obj.rewards = []; + } + if (message.total) { + obj.total = message.total.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.total = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegationTotalRewardsResponse { + const message = createBaseQueryDelegationTotalRewardsResponse(); + message.rewards = object.rewards?.map((e) => DelegationDelegatorReward.fromPartial(e)) || []; + message.total = object.total?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegator_address: "" }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegator_address = object.delegator_address ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [] }; +} + +export const QueryDelegatorValidatorsResponse = { + encode(message: QueryDelegatorValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validators) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e); + } else { + obj.validators = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegator_address: "" }; +} + +export const QueryDelegatorWithdrawAddressRequest = { + encode(message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegator_address = object.delegator_address ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdraw_address: "" }; +} + +export const QueryDelegatorWithdrawAddressResponse = { + encode(message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.withdraw_address !== "") { + writer.uint32(10).string(message.withdraw_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.withdraw_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdraw_address: isSet(object.withdraw_address) ? String(object.withdraw_address) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + message.withdraw_address !== undefined && (obj.withdraw_address = message.withdraw_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdraw_address = object.withdraw_address ?? ""; + return message; + }, +}; + +function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { + return {}; +} + +export const QueryCommunityPoolRequest = { + encode(_: QueryCommunityPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommunityPoolRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, +}; + +function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { + return { pool: [] }; +} + +export const QueryCommunityPoolResponse = { + encode(message: QueryCommunityPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommunityPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCommunityPoolResponse { + return { pool: Array.isArray(object?.pool) ? object.pool.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryCommunityPoolResponse): unknown { + const obj: any = {}; + if (message.pool) { + obj.pool = message.pool.map((e) => e ? DecCoin.toJSON(e) : undefined); + } else { + obj.pool = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryCommunityPoolResponse { + const message = createBaseQueryCommunityPoolResponse(); + message.pool = object.pool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +/** Query defines the gRPC querier service for distribution module. */ +export interface Query { + /** Params queries params of the distribution module. */ + Params(request: QueryParamsRequest): Promise; + /** ValidatorOutstandingRewards queries rewards of a validator address. */ + ValidatorOutstandingRewards( + request: QueryValidatorOutstandingRewardsRequest, + ): Promise; + /** ValidatorCommission queries accumulated commission for a validator. */ + ValidatorCommission(request: QueryValidatorCommissionRequest): Promise; + /** ValidatorSlashes queries slash events of a validator. */ + ValidatorSlashes(request: QueryValidatorSlashesRequest): Promise; + /** DelegationRewards queries the total rewards accrued by a delegation. */ + DelegationRewards(request: QueryDelegationRewardsRequest): Promise; + /** + * DelegationTotalRewards queries the total rewards accrued by a each + * validator. + */ + DelegationTotalRewards(request: QueryDelegationTotalRewardsRequest): Promise; + /** DelegatorValidators queries the validators of a delegator. */ + DelegatorValidators(request: QueryDelegatorValidatorsRequest): Promise; + /** DelegatorWithdrawAddress queries withdraw address of a delegator. */ + DelegatorWithdrawAddress( + request: QueryDelegatorWithdrawAddressRequest, + ): Promise; + /** CommunityPool queries the community pool coins. */ + CommunityPool(request: QueryCommunityPoolRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.distribution.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorOutstandingRewards = this.ValidatorOutstandingRewards.bind(this); + this.ValidatorCommission = this.ValidatorCommission.bind(this); + this.ValidatorSlashes = this.ValidatorSlashes.bind(this); + this.DelegationRewards = this.DelegationRewards.bind(this); + this.DelegationTotalRewards = this.DelegationTotalRewards.bind(this); + this.DelegatorValidators = this.DelegatorValidators.bind(this); + this.DelegatorWithdrawAddress = this.DelegatorWithdrawAddress.bind(this); + this.CommunityPool = this.CommunityPool.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + ValidatorOutstandingRewards( + request: QueryValidatorOutstandingRewardsRequest, + ): Promise { + const data = QueryValidatorOutstandingRewardsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorOutstandingRewards", data); + return promise.then((data) => QueryValidatorOutstandingRewardsResponse.decode(new _m0.Reader(data))); + } + + ValidatorCommission(request: QueryValidatorCommissionRequest): Promise { + const data = QueryValidatorCommissionRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorCommission", data); + return promise.then((data) => QueryValidatorCommissionResponse.decode(new _m0.Reader(data))); + } + + ValidatorSlashes(request: QueryValidatorSlashesRequest): Promise { + const data = QueryValidatorSlashesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorSlashes", data); + return promise.then((data) => QueryValidatorSlashesResponse.decode(new _m0.Reader(data))); + } + + DelegationRewards(request: QueryDelegationRewardsRequest): Promise { + const data = QueryDelegationRewardsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegationRewards", data); + return promise.then((data) => QueryDelegationRewardsResponse.decode(new _m0.Reader(data))); + } + + DelegationTotalRewards(request: QueryDelegationTotalRewardsRequest): Promise { + const data = QueryDelegationTotalRewardsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegationTotalRewards", data); + return promise.then((data) => QueryDelegationTotalRewardsResponse.decode(new _m0.Reader(data))); + } + + DelegatorValidators(request: QueryDelegatorValidatorsRequest): Promise { + const data = QueryDelegatorValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorValidators", data); + return promise.then((data) => QueryDelegatorValidatorsResponse.decode(new _m0.Reader(data))); + } + + DelegatorWithdrawAddress( + request: QueryDelegatorWithdrawAddressRequest, + ): Promise { + const data = QueryDelegatorWithdrawAddressRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorWithdrawAddress", data); + return promise.then((data) => QueryDelegatorWithdrawAddressResponse.decode(new _m0.Reader(data))); + } + + CommunityPool(request: QueryCommunityPoolRequest): Promise { + const data = QueryCommunityPoolRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CommunityPool", data); + return promise.then((data) => QueryCommunityPoolResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/distribution/v1beta1/tx.ts b/common/types/src/lcd/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..5232c4d1 --- /dev/null +++ b/common/types/src/lcd/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,550 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.distribution.v1beta1"; + +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegator_address: string; + withdraw_address: string; +} + +/** MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. */ +export interface MsgSetWithdrawAddressResponse { +} + +/** + * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + * from a single validator. + */ +export interface MsgWithdrawDelegatorReward { + delegator_address: string; + validator_address: string; +} + +/** MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. */ +export interface MsgWithdrawDelegatorRewardResponse { + amount: Coin[]; +} + +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validator_address: string; +} + +/** MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. */ +export interface MsgWithdrawValidatorCommissionResponse { + amount: Coin[]; +} + +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPool { + amount: Coin[]; + depositor: string; +} + +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponse { +} + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegator_address: "", withdraw_address: "" }; +} + +export const MsgSetWithdrawAddress = { + encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.withdraw_address !== "") { + writer.uint32(18).string(message.withdraw_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.withdraw_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + withdraw_address: isSet(object.withdraw_address) ? String(object.withdraw_address) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.withdraw_address !== undefined && (obj.withdraw_address = message.withdraw_address); + return obj; + }, + + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegator_address = object.delegator_address ?? ""; + message.withdraw_address = object.withdraw_address ?? ""; + return message; + }, +}; + +function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { + return {}; +} + +export const MsgSetWithdrawAddressResponse = { + encode(_: MsgSetWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegator_address: "", validator_address: "" }; +} + +export const MsgWithdrawDelegatorReward = { + encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { + return { amount: [] }; +} + +export const MsgWithdrawDelegatorRewardResponse = { + encode(message: MsgWithdrawDelegatorRewardResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgWithdrawDelegatorRewardResponse { + return { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawDelegatorRewardResponse): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validator_address: "" }; +} + +export const MsgWithdrawValidatorCommission = { + encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validator_address: isSet(object.validator_address) ? String(object.validator_address) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { + return { amount: [] }; +} + +export const MsgWithdrawValidatorCommissionResponse = { + encode(message: MsgWithdrawValidatorCommissionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommissionResponse { + return { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: MsgWithdrawValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgWithdrawValidatorCommissionResponse { + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { + return { amount: [], depositor: "" }; +} + +export const MsgFundCommunityPool = { + encode(message: MsgFundCommunityPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgFundCommunityPool { + return { + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + depositor: isSet(object.depositor) ? String(object.depositor) : "", + }; + }, + + toJSON(message: MsgFundCommunityPool): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + + fromPartial, I>>(object: I): MsgFundCommunityPool { + const message = createBaseMsgFundCommunityPool(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse { + return {}; +} + +export const MsgFundCommunityPoolResponse = { + encode(_: MsgFundCommunityPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +/** Msg defines the distribution Msg service. */ +export interface Msg { + /** + * SetWithdrawAddress defines a method to change the withdraw address + * for a delegator (or validator self-delegation). + */ + SetWithdrawAddress(request: MsgSetWithdrawAddress): Promise; + /** + * WithdrawDelegatorReward defines a method to withdraw rewards of delegator + * from a single validator. + */ + WithdrawDelegatorReward(request: MsgWithdrawDelegatorReward): Promise; + /** + * WithdrawValidatorCommission defines a method to withdraw the + * full commission to the validator address. + */ + WithdrawValidatorCommission(request: MsgWithdrawValidatorCommission): Promise; + /** + * FundCommunityPool defines a method to allow an account to directly + * fund the community pool. + */ + FundCommunityPool(request: MsgFundCommunityPool): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.distribution.v1beta1.Msg"; + this.rpc = rpc; + this.SetWithdrawAddress = this.SetWithdrawAddress.bind(this); + this.WithdrawDelegatorReward = this.WithdrawDelegatorReward.bind(this); + this.WithdrawValidatorCommission = this.WithdrawValidatorCommission.bind(this); + this.FundCommunityPool = this.FundCommunityPool.bind(this); + } + SetWithdrawAddress(request: MsgSetWithdrawAddress): Promise { + const data = MsgSetWithdrawAddress.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetWithdrawAddress", data); + return promise.then((data) => MsgSetWithdrawAddressResponse.decode(new _m0.Reader(data))); + } + + WithdrawDelegatorReward(request: MsgWithdrawDelegatorReward): Promise { + const data = MsgWithdrawDelegatorReward.encode(request).finish(); + const promise = this.rpc.request(this.service, "WithdrawDelegatorReward", data); + return promise.then((data) => MsgWithdrawDelegatorRewardResponse.decode(new _m0.Reader(data))); + } + + WithdrawValidatorCommission( + request: MsgWithdrawValidatorCommission, + ): Promise { + const data = MsgWithdrawValidatorCommission.encode(request).finish(); + const promise = this.rpc.request(this.service, "WithdrawValidatorCommission", data); + return promise.then((data) => MsgWithdrawValidatorCommissionResponse.decode(new _m0.Reader(data))); + } + + FundCommunityPool(request: MsgFundCommunityPool): Promise { + const data = MsgFundCommunityPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "FundCommunityPool", data); + return promise.then((data) => MsgFundCommunityPoolResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/evidence/v1beta1/evidence.ts b/common/types/src/lcd/cosmos/evidence/v1beta1/evidence.ts new file mode 100644 index 00000000..8ea296ed --- /dev/null +++ b/common/types/src/lcd/cosmos/evidence/v1beta1/evidence.ts @@ -0,0 +1,139 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.evidence.v1beta1"; + +/** + * Equivocation implements the Evidence interface and defines evidence of double + * signing misbehavior. + */ +export interface Equivocation { + height: string; + time?: Date; + power: string; + consensus_address: string; +} + +function createBaseEquivocation(): Equivocation { + return { height: "0", time: undefined, power: "0", consensus_address: "" }; +} + +export const Equivocation = { + encode(message: Equivocation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).ldelim(); + } + if (message.power !== "0") { + writer.uint32(24).int64(message.power); + } + if (message.consensus_address !== "") { + writer.uint32(34).string(message.consensus_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Equivocation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEquivocation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = longToString(reader.int64() as Long); + break; + case 2: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.power = longToString(reader.int64() as Long); + break; + case 4: + message.consensus_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Equivocation { + return { + height: isSet(object.height) ? String(object.height) : "0", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + power: isSet(object.power) ? String(object.power) : "0", + consensus_address: isSet(object.consensus_address) ? String(object.consensus_address) : "", + }; + }, + + toJSON(message: Equivocation): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.power !== undefined && (obj.power = message.power); + message.consensus_address !== undefined && (obj.consensus_address = message.consensus_address); + return obj; + }, + + fromPartial, I>>(object: I): Equivocation { + const message = createBaseEquivocation(); + message.height = object.height ?? "0"; + message.time = object.time ?? undefined; + message.power = object.power ?? "0"; + message.consensus_address = object.consensus_address ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/evidence/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/evidence/v1beta1/genesis.ts new file mode 100644 index 00000000..1c72de38 --- /dev/null +++ b/common/types/src/lcd/cosmos/evidence/v1beta1/genesis.ts @@ -0,0 +1,73 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.evidence.v1beta1"; + +/** GenesisState defines the evidence module's genesis state. */ +export interface GenesisState { + /** evidence defines all the evidence at genesis. */ + evidence: Any[]; +} + +function createBaseGenesisState(): GenesisState { + return { evidence: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { evidence: Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [] }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.evidence = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.evidence = object.evidence?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/lcd/cosmos/evidence/v1beta1/query.ts b/common/types/src/lcd/cosmos/evidence/v1beta1/query.ts new file mode 100644 index 00000000..00a3f793 --- /dev/null +++ b/common/types/src/lcd/cosmos/evidence/v1beta1/query.ts @@ -0,0 +1,345 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +export const protobufPackage = "cosmos.evidence.v1beta1"; + +/** QueryEvidenceRequest is the request type for the Query/Evidence RPC method. */ +export interface QueryEvidenceRequest { + /** evidence_hash defines the hash of the requested evidence. */ + evidence_hash: Uint8Array; +} + +/** QueryEvidenceResponse is the response type for the Query/Evidence RPC method. */ +export interface QueryEvidenceResponse { + /** evidence returns the requested evidence. */ + evidence?: Any; +} + +/** + * QueryEvidenceRequest is the request type for the Query/AllEvidence RPC + * method. + */ +export interface QueryAllEvidenceRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryAllEvidenceResponse is the response type for the Query/AllEvidence RPC + * method. + */ +export interface QueryAllEvidenceResponse { + /** evidence returns all evidences. */ + evidence: Any[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { + return { evidence_hash: new Uint8Array() }; +} + +export const QueryEvidenceRequest = { + encode(message: QueryEvidenceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.evidence_hash.length !== 0) { + writer.uint32(10).bytes(message.evidence_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryEvidenceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEvidenceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryEvidenceRequest { + return { evidence_hash: isSet(object.evidence_hash) ? bytesFromBase64(object.evidence_hash) : new Uint8Array() }; + }, + + toJSON(message: QueryEvidenceRequest): unknown { + const obj: any = {}; + message.evidence_hash !== undefined && + (obj.evidence_hash = base64FromBytes( + message.evidence_hash !== undefined ? message.evidence_hash : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): QueryEvidenceRequest { + const message = createBaseQueryEvidenceRequest(); + message.evidence_hash = object.evidence_hash ?? new Uint8Array(); + return message; + }, +}; + +function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { + return { evidence: undefined }; +} + +export const QueryEvidenceResponse = { + encode(message: QueryEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryEvidenceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEvidenceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryEvidenceResponse { + return { evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined }; + }, + + toJSON(message: QueryEvidenceResponse): unknown { + const obj: any = {}; + message.evidence !== undefined && (obj.evidence = message.evidence ? Any.toJSON(message.evidence) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryEvidenceResponse { + const message = createBaseQueryEvidenceResponse(); + message.evidence = (object.evidence !== undefined && object.evidence !== null) + ? Any.fromPartial(object.evidence) + : undefined; + return message; + }, +}; + +function createBaseQueryAllEvidenceRequest(): QueryAllEvidenceRequest { + return { pagination: undefined }; +} + +export const QueryAllEvidenceRequest = { + encode(message: QueryAllEvidenceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEvidenceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllEvidenceRequest(); + 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; + }, + + fromJSON(object: any): QueryAllEvidenceRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAllEvidenceRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllEvidenceRequest { + const message = createBaseQueryAllEvidenceRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllEvidenceResponse(): QueryAllEvidenceResponse { + return { evidence: [], pagination: undefined }; +} + +export const QueryAllEvidenceResponse = { + encode(message: QueryAllEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllEvidenceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllEvidenceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence.push(Any.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceResponse { + return { + evidence: Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllEvidenceResponse): unknown { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.evidence = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllEvidenceResponse { + const message = createBaseQueryAllEvidenceResponse(); + message.evidence = object.evidence?.map((e) => Any.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Evidence queries evidence based on evidence hash. */ + Evidence(request: QueryEvidenceRequest): Promise; + /** AllEvidence queries all evidence. */ + AllEvidence(request: QueryAllEvidenceRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.evidence.v1beta1.Query"; + this.rpc = rpc; + this.Evidence = this.Evidence.bind(this); + this.AllEvidence = this.AllEvidence.bind(this); + } + Evidence(request: QueryEvidenceRequest): Promise { + const data = QueryEvidenceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Evidence", data); + return promise.then((data) => QueryEvidenceResponse.decode(new _m0.Reader(data))); + } + + AllEvidence(request: QueryAllEvidenceRequest): Promise { + const data = QueryAllEvidenceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AllEvidence", data); + return promise.then((data) => QueryAllEvidenceResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/evidence/v1beta1/tx.ts b/common/types/src/lcd/cosmos/evidence/v1beta1/tx.ts new file mode 100644 index 00000000..1901a2ee --- /dev/null +++ b/common/types/src/lcd/cosmos/evidence/v1beta1/tx.ts @@ -0,0 +1,215 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.evidence.v1beta1"; + +/** + * MsgSubmitEvidence represents a message that supports submitting arbitrary + * Evidence of misbehavior such as equivocation or counterfactual signing. + */ +export interface MsgSubmitEvidence { + submitter: string; + evidence?: Any; +} + +/** MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. */ +export interface MsgSubmitEvidenceResponse { + /** hash defines the hash of the evidence. */ + hash: Uint8Array; +} + +function createBaseMsgSubmitEvidence(): MsgSubmitEvidence { + return { submitter: "", evidence: undefined }; +} + +export const MsgSubmitEvidence = { + encode(message: MsgSubmitEvidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.submitter !== "") { + writer.uint32(10).string(message.submitter); + } + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitEvidence { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.submitter = reader.string(); + break; + case 2: + message.evidence = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidence { + return { + submitter: isSet(object.submitter) ? String(object.submitter) : "", + evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined, + }; + }, + + toJSON(message: MsgSubmitEvidence): unknown { + const obj: any = {}; + message.submitter !== undefined && (obj.submitter = message.submitter); + message.evidence !== undefined && (obj.evidence = message.evidence ? Any.toJSON(message.evidence) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitEvidence { + const message = createBaseMsgSubmitEvidence(); + message.submitter = object.submitter ?? ""; + message.evidence = (object.evidence !== undefined && object.evidence !== null) + ? Any.fromPartial(object.evidence) + : undefined; + return message; + }, +}; + +function createBaseMsgSubmitEvidenceResponse(): MsgSubmitEvidenceResponse { + return { hash: new Uint8Array() }; +} + +export const MsgSubmitEvidenceResponse = { + encode(message: MsgSubmitEvidenceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitEvidenceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEvidenceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidenceResponse { + return { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array() }; + }, + + toJSON(message: MsgSubmitEvidenceResponse): unknown { + const obj: any = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitEvidenceResponse { + const message = createBaseMsgSubmitEvidenceResponse(); + message.hash = object.hash ?? new Uint8Array(); + return message; + }, +}; + +/** Msg defines the evidence Msg service. */ +export interface Msg { + /** + * SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + * counterfactual signing. + */ + SubmitEvidence(request: MsgSubmitEvidence): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.evidence.v1beta1.Msg"; + this.rpc = rpc; + this.SubmitEvidence = this.SubmitEvidence.bind(this); + } + SubmitEvidence(request: MsgSubmitEvidence): Promise { + const data = MsgSubmitEvidence.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitEvidence", data); + return promise.then((data) => MsgSubmitEvidenceResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/feegrant/v1beta1/feegrant.ts b/common/types/src/lcd/cosmos/feegrant/v1beta1/feegrant.ts new file mode 100644 index 00000000..d10f8c3d --- /dev/null +++ b/common/types/src/lcd/cosmos/feegrant/v1beta1/feegrant.ts @@ -0,0 +1,405 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.feegrant.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** + * BasicAllowance implements Allowance with a one-time grant of tokens + * that optionally expires. The grantee can use up to SpendLimit to cover fees. + */ +export interface BasicAllowance { + /** + * spend_limit specifies the maximum amount of tokens that can be spent + * by this allowance and will be updated as tokens are spent. If it is + * empty, there is no spend limit and any amount of coins can be spent. + */ + spend_limit: Coin[]; + /** expiration specifies an optional time when this allowance expires */ + expiration?: Date; +} + +/** + * PeriodicAllowance extends Allowance to allow for both a maximum cap, + * as well as a limit per time period. + */ +export interface PeriodicAllowance { + /** basic specifies a struct of `BasicAllowance` */ + basic?: BasicAllowance; + /** + * period specifies the time duration in which period_spend_limit coins can + * be spent before that allowance is reset + */ + period?: Duration; + /** + * period_spend_limit specifies the maximum number of coins that can be spent + * in the period + */ + period_spend_limit: Coin[]; + /** period_can_spend is the number of coins left to be spent before the period_reset time */ + period_can_spend: Coin[]; + /** + * period_reset is the time at which this period resets and a new one begins, + * it is calculated from the start time of the first transaction after the + * last period ended + */ + period_reset?: Date; +} + +/** AllowedMsgAllowance creates allowance only for specified message types. */ +export interface AllowedMsgAllowance { + /** allowance can be any of basic and periodic fee allowance. */ + allowance?: Any; + /** allowed_messages are the messages for which the grantee has the access. */ + allowed_messages: string[]; +} + +/** Grant is stored in the KVStore to record a grant with full context */ +export interface Grant { + /** 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; +} + +function createBaseBasicAllowance(): BasicAllowance { + return { spend_limit: [], expiration: undefined }; +} + +export const BasicAllowance = { + encode(message: BasicAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.spend_limit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BasicAllowance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBasicAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.spend_limit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BasicAllowance { + return { + spend_limit: Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromJSON(e)) : [], + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: BasicAllowance): unknown { + const obj: any = {}; + if (message.spend_limit) { + obj.spend_limit = message.spend_limit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.spend_limit = []; + } + message.expiration !== undefined && (obj.expiration = message.expiration.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): BasicAllowance { + const message = createBaseBasicAllowance(); + message.spend_limit = object.spend_limit?.map((e) => Coin.fromPartial(e)) || []; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBasePeriodicAllowance(): PeriodicAllowance { + return { basic: undefined, period: undefined, period_spend_limit: [], period_can_spend: [], period_reset: undefined }; +} + +export const PeriodicAllowance = { + encode(message: PeriodicAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.basic !== undefined) { + BasicAllowance.encode(message.basic, writer.uint32(10).fork()).ldelim(); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.period_spend_limit) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.period_can_spend) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.period_reset !== undefined) { + Timestamp.encode(toTimestamp(message.period_reset), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PeriodicAllowance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.basic = BasicAllowance.decode(reader, reader.uint32()); + break; + case 2: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.period_spend_limit.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.period_can_spend.push(Coin.decode(reader, reader.uint32())); + break; + case 5: + message.period_reset = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PeriodicAllowance { + return { + basic: isSet(object.basic) ? BasicAllowance.fromJSON(object.basic) : undefined, + period: isSet(object.period) ? Duration.fromJSON(object.period) : undefined, + period_spend_limit: Array.isArray(object?.period_spend_limit) + ? object.period_spend_limit.map((e: any) => Coin.fromJSON(e)) + : [], + period_can_spend: Array.isArray(object?.period_can_spend) + ? object.period_can_spend.map((e: any) => Coin.fromJSON(e)) + : [], + period_reset: isSet(object.period_reset) ? fromJsonTimestamp(object.period_reset) : undefined, + }; + }, + + toJSON(message: PeriodicAllowance): unknown { + const obj: any = {}; + message.basic !== undefined && (obj.basic = message.basic ? BasicAllowance.toJSON(message.basic) : undefined); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + if (message.period_spend_limit) { + obj.period_spend_limit = message.period_spend_limit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.period_spend_limit = []; + } + if (message.period_can_spend) { + obj.period_can_spend = message.period_can_spend.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.period_can_spend = []; + } + message.period_reset !== undefined && (obj.period_reset = message.period_reset.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): PeriodicAllowance { + const message = createBasePeriodicAllowance(); + message.basic = (object.basic !== undefined && object.basic !== null) + ? BasicAllowance.fromPartial(object.basic) + : undefined; + message.period = (object.period !== undefined && object.period !== null) + ? Duration.fromPartial(object.period) + : undefined; + message.period_spend_limit = object.period_spend_limit?.map((e) => Coin.fromPartial(e)) || []; + message.period_can_spend = object.period_can_spend?.map((e) => Coin.fromPartial(e)) || []; + message.period_reset = object.period_reset ?? undefined; + return message; + }, +}; + +function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { + return { allowance: undefined, allowed_messages: [] }; +} + +export const AllowedMsgAllowance = { + encode(message: AllowedMsgAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.allowed_messages) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AllowedMsgAllowance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllowedMsgAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowance = Any.decode(reader, reader.uint32()); + break; + case 2: + message.allowed_messages.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AllowedMsgAllowance { + return { + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + allowed_messages: Array.isArray(object?.allowed_messages) + ? object.allowed_messages.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: AllowedMsgAllowance): unknown { + const obj: any = {}; + message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toJSON(message.allowance) : undefined); + if (message.allowed_messages) { + obj.allowed_messages = message.allowed_messages.map((e) => e); + } else { + obj.allowed_messages = []; + } + return obj; + }, + + fromPartial, I>>(object: I): AllowedMsgAllowance { + const message = createBaseAllowedMsgAllowance(); + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Any.fromPartial(object.allowance) + : undefined; + message.allowed_messages = object.allowed_messages?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGrant(): Grant { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const Grant = { + encode(message: Grant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Grant { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.allowance = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Grant { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: Grant): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toJSON(message.allowance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Grant { + const message = createBaseGrant(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Any.fromPartial(object.allowance) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/feegrant/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/feegrant/v1beta1/genesis.ts new file mode 100644 index 00000000..ff8d4af5 --- /dev/null +++ b/common/types/src/lcd/cosmos/feegrant/v1beta1/genesis.ts @@ -0,0 +1,76 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Grant } from "./feegrant"; + +export const protobufPackage = "cosmos.feegrant.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** GenesisState contains a set of fee allowances, persisted from the store */ +export interface GenesisState { + allowances: Grant[]; +} + +function createBaseGenesisState(): GenesisState { + return { allowances: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowances.push(Grant.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + allowances: Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map((e) => e ? Grant.toJSON(e) : undefined); + } else { + obj.allowances = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.allowances = object.allowances?.map((e) => Grant.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/lcd/cosmos/feegrant/v1beta1/query.ts b/common/types/src/lcd/cosmos/feegrant/v1beta1/query.ts new file mode 100644 index 00000000..d848ef96 --- /dev/null +++ b/common/types/src/lcd/cosmos/feegrant/v1beta1/query.ts @@ -0,0 +1,477 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Grant } from "./feegrant"; + +export const protobufPackage = "cosmos.feegrant.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ +export interface QueryAllowanceRequest { + /** 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; +} + +/** QueryAllowanceResponse is the response type for the Query/Allowance RPC method. */ +export interface QueryAllowanceResponse { + /** allowance is a allowance granted for grantee by granter. */ + allowance?: Grant; +} + +/** QueryAllowancesRequest is the request type for the Query/Allowances RPC method. */ +export interface QueryAllowancesRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryAllowancesResponse is the response type for the Query/Allowances RPC method. */ +export interface QueryAllowancesResponse { + /** allowances are allowance's granted for grantee by granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +/** QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. */ +export interface QueryAllowancesByGranterRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. */ +export interface QueryAllowancesByGranterResponse { + /** allowances that have been issued by the granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { + return { granter: "", grantee: "" }; +} + +export const QueryAllowanceRequest = { + encode(message: QueryAllowanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowanceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowanceRequest(); + 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; + }, + + fromJSON(object: any): QueryAllowanceRequest { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + }; + }, + + toJSON(message: QueryAllowanceRequest): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllowanceRequest { + const message = createBaseQueryAllowanceRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseQueryAllowanceResponse(): QueryAllowanceResponse { + return { allowance: undefined }; +} + +export const QueryAllowanceResponse = { + encode(message: QueryAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.allowance !== undefined) { + Grant.encode(message.allowance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowance = Grant.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllowanceResponse { + return { allowance: isSet(object.allowance) ? Grant.fromJSON(object.allowance) : undefined }; + }, + + toJSON(message: QueryAllowanceResponse): unknown { + const obj: any = {}; + message.allowance !== undefined && + (obj.allowance = message.allowance ? Grant.toJSON(message.allowance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllowanceResponse { + const message = createBaseQueryAllowanceResponse(); + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Grant.fromPartial(object.allowance) + : undefined; + return message; + }, +}; + +function createBaseQueryAllowancesRequest(): QueryAllowancesRequest { + return { grantee: "", pagination: undefined }; +} + +export const QueryAllowancesRequest = { + encode(message: QueryAllowancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grantee = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllowancesRequest { + return { + grantee: isSet(object.grantee) ? String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesRequest): unknown { + const obj: any = {}; + message.grantee !== undefined && (obj.grantee = message.grantee); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllowancesRequest { + const message = createBaseQueryAllowancesRequest(); + message.grantee = object.grantee ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllowancesResponse(): QueryAllowancesResponse { + return { allowances: [], pagination: undefined }; +} + +export const QueryAllowancesResponse = { + encode(message: QueryAllowancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowances.push(Grant.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllowancesResponse { + return { + allowances: Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesResponse): unknown { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map((e) => e ? Grant.toJSON(e) : undefined); + } else { + obj.allowances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryAllowancesResponse { + const message = createBaseQueryAllowancesResponse(); + message.allowances = object.allowances?.map((e) => Grant.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllowancesByGranterRequest(): QueryAllowancesByGranterRequest { + return { granter: "", pagination: undefined }; +} + +export const QueryAllowancesByGranterRequest = { + encode(message: QueryAllowancesByGranterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesByGranterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterRequest { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesByGranterRequest): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAllowancesByGranterRequest { + const message = createBaseQueryAllowancesByGranterRequest(); + message.granter = object.granter ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryAllowancesByGranterResponse(): QueryAllowancesByGranterResponse { + return { allowances: [], pagination: undefined }; +} + +export const QueryAllowancesByGranterResponse = { + encode(message: QueryAllowancesByGranterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesByGranterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowances.push(Grant.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterResponse { + return { + allowances: Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesByGranterResponse): unknown { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map((e) => e ? Grant.toJSON(e) : undefined); + } else { + obj.allowances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAllowancesByGranterResponse { + const message = createBaseQueryAllowancesByGranterResponse(); + message.allowances = object.allowances?.map((e) => Grant.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Allowance returns fee granted to the grantee by the granter. */ + Allowance(request: QueryAllowanceRequest): Promise; + /** Allowances returns all the grants for address. */ + Allowances(request: QueryAllowancesRequest): Promise; + /** + * AllowancesByGranter returns all the grants given by an address + * Since v0.46 + */ + AllowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.feegrant.v1beta1.Query"; + this.rpc = rpc; + this.Allowance = this.Allowance.bind(this); + this.Allowances = this.Allowances.bind(this); + this.AllowancesByGranter = this.AllowancesByGranter.bind(this); + } + Allowance(request: QueryAllowanceRequest): Promise { + const data = QueryAllowanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Allowance", data); + return promise.then((data) => QueryAllowanceResponse.decode(new _m0.Reader(data))); + } + + Allowances(request: QueryAllowancesRequest): Promise { + const data = QueryAllowancesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Allowances", data); + return promise.then((data) => QueryAllowancesResponse.decode(new _m0.Reader(data))); + } + + AllowancesByGranter(request: QueryAllowancesByGranterRequest): Promise { + const data = QueryAllowancesByGranterRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AllowancesByGranter", data); + return promise.then((data) => QueryAllowancesByGranterResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/feegrant/v1beta1/tx.ts b/common/types/src/lcd/cosmos/feegrant/v1beta1/tx.ts new file mode 100644 index 00000000..52ae7023 --- /dev/null +++ b/common/types/src/lcd/cosmos/feegrant/v1beta1/tx.ts @@ -0,0 +1,296 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.feegrant.v1beta1"; + +/** Since: cosmos-sdk 0.43 */ + +/** + * 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; +} + +/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */ +export interface MsgGrantAllowanceResponse { +} + +/** 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; +} + +/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ +export interface MsgRevokeAllowanceResponse { +} + +function createBaseMsgGrantAllowance(): MsgGrantAllowance { + return { granter: "", grantee: "", allowance: undefined }; +} + +export const MsgGrantAllowance = { + encode(message: MsgGrantAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgGrantAllowance { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: MsgGrantAllowance): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toJSON(message.allowance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgGrantAllowance { + const message = createBaseMsgGrantAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = (object.allowance !== undefined && object.allowance !== null) + ? Any.fromPartial(object.allowance) + : undefined; + return message; + }, +}; + +function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { + return {}; +} + +export const MsgGrantAllowanceResponse = { + encode(_: MsgGrantAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantAllowanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgGrantAllowanceResponse { + return {}; + }, + + toJSON(_: MsgGrantAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { + return { granter: "", grantee: "" }; +} + +export const MsgRevokeAllowance = { + encode(message: MsgRevokeAllowance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeAllowance { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgRevokeAllowance { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + }; + }, + + toJSON(message: MsgRevokeAllowance): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + return obj; + }, + + fromPartial, I>>(object: I): MsgRevokeAllowance { + const message = createBaseMsgRevokeAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { + return {}; +} + +export const MsgRevokeAllowanceResponse = { + encode(_: MsgRevokeAllowanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgRevokeAllowanceResponse { + return {}; + }, + + toJSON(_: MsgRevokeAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, +}; + +/** Msg defines the feegrant msg service. */ +export interface Msg { + /** + * GrantAllowance grants fee allowance to the grantee on the granter's + * account with the provided expiration time. + */ + GrantAllowance(request: MsgGrantAllowance): Promise; + /** + * RevokeAllowance revokes any fee allowance of granter's account that + * has been granted to the grantee. + */ + RevokeAllowance(request: MsgRevokeAllowance): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.feegrant.v1beta1.Msg"; + this.rpc = rpc; + this.GrantAllowance = this.GrantAllowance.bind(this); + this.RevokeAllowance = this.RevokeAllowance.bind(this); + } + GrantAllowance(request: MsgGrantAllowance): Promise { + const data = MsgGrantAllowance.encode(request).finish(); + const promise = this.rpc.request(this.service, "GrantAllowance", data); + return promise.then((data) => MsgGrantAllowanceResponse.decode(new _m0.Reader(data))); + } + + RevokeAllowance(request: MsgRevokeAllowance): Promise { + const data = MsgRevokeAllowance.encode(request).finish(); + const promise = this.rpc.request(this.service, "RevokeAllowance", data); + return promise.then((data) => MsgRevokeAllowanceResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/genutil/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/genutil/v1beta1/genesis.ts new file mode 100644 index 00000000..1c42d365 --- /dev/null +++ b/common/types/src/lcd/cosmos/genutil/v1beta1/genesis.ts @@ -0,0 +1,116 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.genutil.v1beta1"; + +/** GenesisState defines the raw genesis transaction in JSON. */ +export interface GenesisState { + /** gen_txs defines the genesis transactions. */ + gen_txs: Uint8Array[]; +} + +function createBaseGenesisState(): GenesisState { + return { gen_txs: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.gen_txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gen_txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { gen_txs: Array.isArray(object?.gen_txs) ? object.gen_txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.gen_txs) { + obj.gen_txs = message.gen_txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.gen_txs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.gen_txs = object.gen_txs?.map((e) => e) || []; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/lcd/cosmos/gov/v1/genesis.ts b/common/types/src/lcd/cosmos/gov/v1/genesis.ts new file mode 100644 index 00000000..196797c7 --- /dev/null +++ b/common/types/src/lcd/cosmos/gov/v1/genesis.ts @@ -0,0 +1,182 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Deposit, DepositParams, Proposal, TallyParams, Vote, VotingParams } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisState { + /** starting_proposal_id is the ID of the starting proposal. */ + starting_proposal_id: string; + /** deposits defines all the deposits present at genesis. */ + deposits: Deposit[]; + /** votes defines all the votes present at genesis. */ + votes: Vote[]; + /** proposals defines all the proposals present at genesis. */ + proposals: Proposal[]; + /** params defines all the paramaters of related to deposit. */ + deposit_params?: DepositParams; + /** params defines all the paramaters of related to voting. */ + voting_params?: VotingParams; + /** params defines all the paramaters of related to tally. */ + tally_params?: TallyParams; +} + +function createBaseGenesisState(): GenesisState { + return { + starting_proposal_id: "0", + deposits: [], + votes: [], + proposals: [], + deposit_params: undefined, + voting_params: undefined, + tally_params: undefined, + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.starting_proposal_id !== "0") { + writer.uint32(8).uint64(message.starting_proposal_id); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.deposit_params !== undefined) { + DepositParams.encode(message.deposit_params, writer.uint32(42).fork()).ldelim(); + } + if (message.voting_params !== undefined) { + VotingParams.encode(message.voting_params, writer.uint32(50).fork()).ldelim(); + } + if (message.tally_params !== undefined) { + TallyParams.encode(message.tally_params, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.starting_proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 3: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 4: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 5: + message.deposit_params = DepositParams.decode(reader, reader.uint32()); + break; + case 6: + message.voting_params = VotingParams.decode(reader, reader.uint32()); + break; + case 7: + message.tally_params = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + starting_proposal_id: isSet(object.starting_proposal_id) ? String(object.starting_proposal_id) : "0", + deposits: Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + deposit_params: isSet(object.deposit_params) ? DepositParams.fromJSON(object.deposit_params) : undefined, + voting_params: isSet(object.voting_params) ? VotingParams.fromJSON(object.voting_params) : undefined, + tally_params: isSet(object.tally_params) ? TallyParams.fromJSON(object.tally_params) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.starting_proposal_id !== undefined && (obj.starting_proposal_id = message.starting_proposal_id); + if (message.deposits) { + obj.deposits = message.deposits.map((e) => e ? Deposit.toJSON(e) : undefined); + } else { + obj.deposits = []; + } + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + message.deposit_params !== undefined && + (obj.deposit_params = message.deposit_params ? DepositParams.toJSON(message.deposit_params) : undefined); + message.voting_params !== undefined && + (obj.voting_params = message.voting_params ? VotingParams.toJSON(message.voting_params) : undefined); + message.tally_params !== undefined && + (obj.tally_params = message.tally_params ? TallyParams.toJSON(message.tally_params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.starting_proposal_id = object.starting_proposal_id ?? "0"; + message.deposits = object.deposits?.map((e) => Deposit.fromPartial(e)) || []; + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.proposals = object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.deposit_params = (object.deposit_params !== undefined && object.deposit_params !== null) + ? DepositParams.fromPartial(object.deposit_params) + : undefined; + message.voting_params = (object.voting_params !== undefined && object.voting_params !== null) + ? VotingParams.fromPartial(object.voting_params) + : undefined; + message.tally_params = (object.tally_params !== undefined && object.tally_params !== null) + ? TallyParams.fromPartial(object.tally_params) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/gov/v1/gov.ts b/common/types/src/lcd/cosmos/gov/v1/gov.ts new file mode 100644 index 00000000..cf919854 --- /dev/null +++ b/common/types/src/lcd/cosmos/gov/v1/gov.ts @@ -0,0 +1,943 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** 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 = "VOTE_OPTION_UNSPECIFIED", + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = "VOTE_OPTION_YES", + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = "VOTE_OPTION_ABSTAIN", + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = "VOTE_OPTION_NO", + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = "VOTE_OPTION_NO_WITH_VETO", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function voteOptionToNumber(object: VoteOption): number { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return 0; + case VoteOption.VOTE_OPTION_YES: + return 1; + case VoteOption.VOTE_OPTION_ABSTAIN: + return 2; + case VoteOption.VOTE_OPTION_NO: + return 3; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return 4; + case VoteOption.UNRECOGNIZED: + default: + return -1; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. */ + PROPOSAL_STATUS_UNSPECIFIED = "PROPOSAL_STATUS_UNSPECIFIED", + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = "PROPOSAL_STATUS_DEPOSIT_PERIOD", + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = "PROPOSAL_STATUS_VOTING_PERIOD", + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = "PROPOSAL_STATUS_PASSED", + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = "PROPOSAL_STATUS_REJECTED", + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = "PROPOSAL_STATUS_FAILED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function proposalStatusToNumber(object: ProposalStatus): number { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return 0; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return 1; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return 2; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return 3; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return 4; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return 5; + case ProposalStatus.UNRECOGNIZED: + default: + return -1; + } +} + +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOption { + option: VoteOption; + weight: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + proposal_id: string; + depositor: string; + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + id: string; + messages: Any[]; + 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?: TallyResult; + submit_time?: Date; + deposit_end_time?: Date; + total_deposit: Coin[]; + voting_start_time?: Date; + voting_end_time?: Date; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + yes_count: string; + abstain_count: string; + no_count: string; + no_with_veto_count: string; +} + +/** + * 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: string; + voter: string; + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata to attached to the vote. */ + metadata: string; +} + +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: Duration; +} + +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Length of the voting period. */ + voting_period?: Duration; +} + +/** 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: 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; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: VoteOption.VOTE_OPTION_UNSPECIFIED, weight: "" }; +} + +export const WeightedVoteOption = { + encode(message: WeightedVoteOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.option !== VoteOption.VOTE_OPTION_UNSPECIFIED) { + writer.uint32(8).int32(voteOptionToNumber(message.option)); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = voteOptionFromJSON(reader.int32()); + break; + case 2: + message.weight = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : VoteOption.VOTE_OPTION_UNSPECIFIED, + weight: isSet(object.weight) ? String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.weight !== undefined && (obj.weight = message.weight); + return obj; + }, + + fromPartial, I>>(object: I): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? VoteOption.VOTE_OPTION_UNSPECIFIED; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposal_id: "0", depositor: "", amount: [] }; +} + +export const Deposit = { + encode(message: Deposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): Deposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): Deposit { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Deposit): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Deposit { + const message = createBaseDeposit(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: "0", + messages: [], + status: ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED, + final_tally_result: undefined, + submit_time: undefined, + deposit_end_time: undefined, + total_deposit: [], + voting_start_time: undefined, + voting_end_time: undefined, + metadata: "", + }; +} + +export const Proposal = { + encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.status !== ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED) { + writer.uint32(24).int32(proposalStatusToNumber(message.status)); + } + if (message.final_tally_result !== undefined) { + TallyResult.encode(message.final_tally_result, writer.uint32(34).fork()).ldelim(); + } + if (message.submit_time !== undefined) { + Timestamp.encode(toTimestamp(message.submit_time), writer.uint32(42).fork()).ldelim(); + } + if (message.deposit_end_time !== undefined) { + Timestamp.encode(toTimestamp(message.deposit_end_time), writer.uint32(50).fork()).ldelim(); + } + for (const v of message.total_deposit) { + Coin.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.voting_start_time !== undefined) { + Timestamp.encode(toTimestamp(message.voting_start_time), writer.uint32(66).fork()).ldelim(); + } + if (message.voting_end_time !== undefined) { + Timestamp.encode(toTimestamp(message.voting_end_time), writer.uint32(74).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(82).string(message.metadata); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 3: + message.status = proposalStatusFromJSON(reader.int32()); + break; + case 4: + message.final_tally_result = TallyResult.decode(reader, reader.uint32()); + break; + case 5: + message.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.deposit_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.total_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 8: + message.voting_start_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 9: + message.voting_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 10: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? String(object.id) : "0", + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED, + final_tally_result: isSet(object.final_tally_result) + ? TallyResult.fromJSON(object.final_tally_result) + : undefined, + submit_time: isSet(object.submit_time) ? fromJsonTimestamp(object.submit_time) : undefined, + deposit_end_time: isSet(object.deposit_end_time) ? fromJsonTimestamp(object.deposit_end_time) : undefined, + total_deposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromJSON(e)) : [], + voting_start_time: isSet(object.voting_start_time) ? fromJsonTimestamp(object.voting_start_time) : undefined, + voting_end_time: isSet(object.voting_end_time) ? fromJsonTimestamp(object.voting_end_time) : undefined, + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + message.status !== undefined && (obj.status = proposalStatusToJSON(message.status)); + message.final_tally_result !== undefined && + (obj.final_tally_result = message.final_tally_result + ? TallyResult.toJSON(message.final_tally_result) + : undefined); + message.submit_time !== undefined && (obj.submit_time = message.submit_time.toISOString()); + message.deposit_end_time !== undefined && (obj.deposit_end_time = message.deposit_end_time.toISOString()); + if (message.total_deposit) { + obj.total_deposit = message.total_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.total_deposit = []; + } + message.voting_start_time !== undefined && (obj.voting_start_time = message.voting_start_time.toISOString()); + message.voting_end_time !== undefined && (obj.voting_end_time = message.voting_end_time.toISOString()); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.id = object.id ?? "0"; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.status = object.status ?? ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + message.final_tally_result = (object.final_tally_result !== undefined && object.final_tally_result !== null) + ? TallyResult.fromPartial(object.final_tally_result) + : undefined; + message.submit_time = object.submit_time ?? undefined; + message.deposit_end_time = object.deposit_end_time ?? undefined; + message.total_deposit = object.total_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.voting_start_time = object.voting_start_time ?? undefined; + message.voting_end_time = object.voting_end_time ?? undefined; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes_count: "", abstain_count: "", no_count: "", no_with_veto_count: "" }; +} + +export const TallyResult = { + encode(message: TallyResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.yes_count !== "") { + writer.uint32(10).string(message.yes_count); + } + if (message.abstain_count !== "") { + writer.uint32(18).string(message.abstain_count); + } + if (message.no_count !== "") { + writer.uint32(26).string(message.no_count); + } + if (message.no_with_veto_count !== "") { + writer.uint32(34).string(message.no_with_veto_count); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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_count = reader.string(); + break; + case 2: + message.abstain_count = reader.string(); + break; + case 3: + message.no_count = reader.string(); + break; + case 4: + message.no_with_veto_count = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes_count: isSet(object.yes_count) ? String(object.yes_count) : "", + abstain_count: isSet(object.abstain_count) ? String(object.abstain_count) : "", + no_count: isSet(object.no_count) ? String(object.no_count) : "", + no_with_veto_count: isSet(object.no_with_veto_count) ? String(object.no_with_veto_count) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + message.yes_count !== undefined && (obj.yes_count = message.yes_count); + message.abstain_count !== undefined && (obj.abstain_count = message.abstain_count); + message.no_count !== undefined && (obj.no_count = message.no_count); + message.no_with_veto_count !== undefined && (obj.no_with_veto_count = message.no_with_veto_count); + return obj; + }, + + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes_count = object.yes_count ?? ""; + message.abstain_count = object.abstain_count ?? ""; + message.no_count = object.no_count ?? ""; + message.no_with_veto_count = object.no_with_veto_count ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposal_id: "0", voter: "", options: [], metadata: "" }; +} + +export const Vote = { + encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): Vote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): Vote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [], + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + if (message.options) { + obj.options = message.options.map((e) => e ? WeightedVoteOption.toJSON(e) : undefined); + } else { + obj.options = []; + } + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { min_deposit: [], max_deposit_period: undefined }; +} + +export const DepositParams = { + encode(message: DepositParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.min_deposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.max_deposit_period !== undefined) { + Duration.encode(message.max_deposit_period, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.min_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.max_deposit_period = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + min_deposit: Array.isArray(object?.min_deposit) ? object.min_deposit.map((e: any) => Coin.fromJSON(e)) : [], + max_deposit_period: isSet(object.max_deposit_period) ? Duration.fromJSON(object.max_deposit_period) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.min_deposit) { + obj.min_deposit = message.min_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.min_deposit = []; + } + message.max_deposit_period !== undefined && + (obj.max_deposit_period = message.max_deposit_period ? Duration.toJSON(message.max_deposit_period) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.min_deposit = object.min_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.max_deposit_period = (object.max_deposit_period !== undefined && object.max_deposit_period !== null) + ? Duration.fromPartial(object.max_deposit_period) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { voting_period: undefined }; +} + +export const VotingParams = { + encode(message: VotingParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voting_period !== undefined) { + Duration.encode(message.voting_period, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.voting_period = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { voting_period: isSet(object.voting_period) ? Duration.fromJSON(object.voting_period) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + message.voting_period !== undefined && + (obj.voting_period = message.voting_period ? Duration.toJSON(message.voting_period) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.voting_period = (object.voting_period !== undefined && object.voting_period !== null) + ? Duration.fromPartial(object.voting_period) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: "", threshold: "", veto_threshold: "" }; +} + +export const TallyParams = { + encode(message: TallyParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.quorum !== "") { + writer.uint32(10).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(18).string(message.threshold); + } + if (message.veto_threshold !== "") { + writer.uint32(26).string(message.veto_threshold); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.veto_threshold = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? String(object.quorum) : "", + threshold: isSet(object.threshold) ? String(object.threshold) : "", + veto_threshold: isSet(object.veto_threshold) ? String(object.veto_threshold) : "", + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + message.quorum !== undefined && (obj.quorum = message.quorum); + message.threshold !== undefined && (obj.threshold = message.threshold); + message.veto_threshold !== undefined && (obj.veto_threshold = message.veto_threshold); + return obj; + }, + + fromPartial, I>>(object: I): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.veto_threshold = object.veto_threshold ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/gov/v1/query.ts b/common/types/src/lcd/cosmos/gov/v1/query.ts new file mode 100644 index 00000000..e130da7a --- /dev/null +++ b/common/types/src/lcd/cosmos/gov/v1/query.ts @@ -0,0 +1,1186 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + Deposit, + DepositParams, + Proposal, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + proposalStatusToNumber, + TallyParams, + TallyResult, + Vote, + VotingParams, +} from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal?: Proposal; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** 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?: PageRequest; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter defines the oter address for the proposals. */ + voter: string; +} + +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponse { + /** vote defined the queried vote. */ + vote?: Vote; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defined the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** 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". + */ + params_type: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + voting_params?: VotingParams; + /** deposit_params defines the parameters related to deposit. */ + deposit_params?: DepositParams; + /** tally_params defines the parameters related to tally. */ + tally_params?: TallyParams; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} + +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponse { + /** deposit defines the requested deposit. */ + deposit?: Deposit; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally?: TallyResult; +} + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposal_id: "0" }; +} + +export const QueryProposalRequest = { + encode(message: QueryProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse = { + encode(message: QueryProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = (object.proposal !== undefined && object.proposal !== null) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { + proposal_status: ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED, + voter: "", + depositor: "", + pagination: undefined, + }; +} + +export const QueryProposalsRequest = { + encode(message: QueryProposalsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_status !== ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED) { + writer.uint32(8).int32(proposalStatusToNumber(message.proposal_status)); + } + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_status = proposalStatusFromJSON(reader.int32()); + 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; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposal_status: isSet(object.proposal_status) + ? proposalStatusFromJSON(object.proposal_status) + : ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED, + voter: isSet(object.voter) ? String(object.voter) : "", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsRequest): unknown { + const obj: any = {}; + message.proposal_status !== undefined && (obj.proposal_status = proposalStatusToJSON(message.proposal_status)); + message.voter !== undefined && (obj.voter = message.voter); + message.depositor !== undefined && (obj.depositor = message.depositor); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + message.proposal_status = object.proposal_status ?? ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse = { + encode(message: QueryProposalsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsResponse): unknown { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposal_id: "0", voter: "" }; +} + +export const QueryVoteRequest = { + encode(message: QueryVoteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + return obj; + }, + + fromPartial, I>>(object: I): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse = { + encode(message: QueryVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + message.vote = (object.vote !== undefined && object.vote !== null) ? Vote.fromPartial(object.vote) : undefined; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposal_id: "0", pagination: undefined }; +} + +export const QueryVotesRequest = { + encode(message: QueryVotesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVotesResponse(): QueryVotesResponse { + return { votes: [], pagination: undefined }; +} + +export const QueryVotesResponse = { + encode(message: QueryVotesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesResponse): unknown { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { params_type: "" }; +} + +export const QueryParamsRequest = { + encode(message: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params_type !== "") { + writer.uint32(10).string(message.params_type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.params_type = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { params_type: isSet(object.params_type) ? String(object.params_type) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + message.params_type !== undefined && (obj.params_type = message.params_type); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.params_type = object.params_type ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { voting_params: undefined, deposit_params: undefined, tally_params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voting_params !== undefined) { + VotingParams.encode(message.voting_params, writer.uint32(10).fork()).ldelim(); + } + if (message.deposit_params !== undefined) { + DepositParams.encode(message.deposit_params, writer.uint32(18).fork()).ldelim(); + } + if (message.tally_params !== undefined) { + TallyParams.encode(message.tally_params, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.voting_params = VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.deposit_params = DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tally_params = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + voting_params: isSet(object.voting_params) ? VotingParams.fromJSON(object.voting_params) : undefined, + deposit_params: isSet(object.deposit_params) ? DepositParams.fromJSON(object.deposit_params) : undefined, + tally_params: isSet(object.tally_params) ? TallyParams.fromJSON(object.tally_params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.voting_params !== undefined && + (obj.voting_params = message.voting_params ? VotingParams.toJSON(message.voting_params) : undefined); + message.deposit_params !== undefined && + (obj.deposit_params = message.deposit_params ? DepositParams.toJSON(message.deposit_params) : undefined); + message.tally_params !== undefined && + (obj.tally_params = message.tally_params ? TallyParams.toJSON(message.tally_params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.voting_params = (object.voting_params !== undefined && object.voting_params !== null) + ? VotingParams.fromPartial(object.voting_params) + : undefined; + message.deposit_params = (object.deposit_params !== undefined && object.deposit_params !== null) + ? DepositParams.fromPartial(object.deposit_params) + : undefined; + message.tally_params = (object.tally_params !== undefined && object.tally_params !== null) + ? TallyParams.fromPartial(object.tally_params) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposal_id: "0", depositor: "" }; +} + +export const QueryDepositRequest = { + encode(message: QueryDepositRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse = { + encode(message: QueryDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + message.deposit !== undefined && (obj.deposit = message.deposit ? Deposit.toJSON(message.deposit) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + message.deposit = (object.deposit !== undefined && object.deposit !== null) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposal_id: "0", pagination: undefined }; +} + +export const QueryDepositsRequest = { + encode(message: QueryDepositsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsResponse(): QueryDepositsResponse { + return { deposits: [], pagination: undefined }; +} + +export const QueryDepositsResponse = { + encode(message: QueryDepositsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + deposits: Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsResponse): unknown { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => e ? Deposit.toJSON(e) : undefined); + } else { + obj.deposits = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposal_id: "0" }; +} + +export const QueryTallyResultRequest = { + encode(message: QueryTallyResultRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse = { + encode(message: QueryTallyResultResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = (object.tally !== undefined && object.tally !== null) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Proposal queries proposal details based on ProposalID. */ + Proposal(request: QueryProposalRequest): Promise; + /** Proposals queries all proposals based on given status. */ + Proposals(request: QueryProposalsRequest): Promise; + /** Vote queries voted information based on proposalID, voterAddr. */ + Vote(request: QueryVoteRequest): Promise; + /** Votes queries votes of a given proposal. */ + Votes(request: QueryVotesRequest): Promise; + /** Params queries all parameters of the gov module. */ + Params(request: QueryParamsRequest): Promise; + /** Deposit queries single deposit information based proposalID, depositAddr. */ + Deposit(request: QueryDepositRequest): Promise; + /** Deposits queries all deposits of a single proposal. */ + Deposits(request: QueryDepositsRequest): Promise; + /** TallyResult queries the tally of a proposal vote. */ + TallyResult(request: QueryTallyResultRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.gov.v1.Query"; + this.rpc = rpc; + this.Proposal = this.Proposal.bind(this); + this.Proposals = this.Proposals.bind(this); + this.Vote = this.Vote.bind(this); + this.Votes = this.Votes.bind(this); + this.Params = this.Params.bind(this); + this.Deposit = this.Deposit.bind(this); + this.Deposits = this.Deposits.bind(this); + this.TallyResult = this.TallyResult.bind(this); + } + Proposal(request: QueryProposalRequest): Promise { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Proposal", data); + return promise.then((data) => QueryProposalResponse.decode(new _m0.Reader(data))); + } + + Proposals(request: QueryProposalsRequest): Promise { + const data = QueryProposalsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Proposals", data); + return promise.then((data) => QueryProposalsResponse.decode(new _m0.Reader(data))); + } + + Vote(request: QueryVoteRequest): Promise { + const data = QueryVoteRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Vote", data); + return promise.then((data) => QueryVoteResponse.decode(new _m0.Reader(data))); + } + + Votes(request: QueryVotesRequest): Promise { + const data = QueryVotesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Votes", data); + return promise.then((data) => QueryVotesResponse.decode(new _m0.Reader(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + Deposit(request: QueryDepositRequest): Promise { + const data = QueryDepositRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposit", data); + return promise.then((data) => QueryDepositResponse.decode(new _m0.Reader(data))); + } + + Deposits(request: QueryDepositsRequest): Promise { + const data = QueryDepositsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposits", data); + return promise.then((data) => QueryDepositsResponse.decode(new _m0.Reader(data))); + } + + TallyResult(request: QueryTallyResultRequest): Promise { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TallyResult", data); + return promise.then((data) => QueryTallyResultResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/gov/v1/tx.ts b/common/types/src/lcd/cosmos/gov/v1/tx.ts new file mode 100644 index 00000000..d4ff3aeb --- /dev/null +++ b/common/types/src/lcd/cosmos/gov/v1/tx.ts @@ -0,0 +1,741 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Coin } from "../../base/v1beta1/coin"; +import { VoteOption, voteOptionFromJSON, voteOptionToJSON, voteOptionToNumber, WeightedVoteOption } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1"; + +/** Since: cosmos-sdk 0.46 */ + +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + messages: Any[]; + initial_deposit: Coin[]; + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + proposal_id: string; +} + +/** + * 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?: Any; + /** authority must be the gov module address. */ + authority: string; +} + +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponse { +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + proposal_id: string; + voter: string; + option: VoteOption; + metadata: string; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeighted { + proposal_id: string; + voter: string; + options: WeightedVoteOption[]; + metadata: string; +} + +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponse { +} + +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + proposal_id: string; + depositor: string; + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { messages: [], initial_deposit: [], proposer: "", metadata: "" }; +} + +export const MsgSubmitProposal = { + encode(message: MsgSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initial_deposit) { + 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); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.initial_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + case 4: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + initial_deposit: Array.isArray(object?.initial_deposit) + ? object.initial_deposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? String(object.proposer) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + if (message.initial_deposit) { + obj.initial_deposit = message.initial_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.initial_deposit = []; + } + message.proposer !== undefined && (obj.proposer = message.proposer); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.initial_deposit = object.initial_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposal_id: "0" }; +} + +export const MsgSubmitProposalResponse = { + encode(message: MsgSubmitProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { + return { content: undefined, authority: "" }; +} + +export const MsgExecLegacyContent = { + encode(message: MsgExecLegacyContent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).ldelim(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecLegacyContent { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgExecLegacyContent { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + authority: isSet(object.authority) ? String(object.authority) : "", + }; + }, + + toJSON(message: MsgExecLegacyContent): unknown { + const obj: any = {}; + message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); + message.authority !== undefined && (obj.authority = message.authority); + return obj; + }, + + fromPartial, I>>(object: I): MsgExecLegacyContent { + const message = createBaseMsgExecLegacyContent(); + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { + return {}; +} + +export const MsgExecLegacyContentResponse = { + encode(_: MsgExecLegacyContentResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecLegacyContentResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgExecLegacyContentResponse { + return {}; + }, + + toJSON(_: MsgExecLegacyContentResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposal_id: "0", voter: "", option: VoteOption.VOTE_OPTION_UNSPECIFIED, metadata: "" }; +} + +export const MsgVote = { + encode(message: MsgVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== VoteOption.VOTE_OPTION_UNSPECIFIED) { + writer.uint32(24).int32(voteOptionToNumber(message.option)); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = voteOptionFromJSON(reader.int32()); + break; + case 4: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : VoteOption.VOTE_OPTION_UNSPECIFIED, + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.option = object.option ?? VoteOption.VOTE_OPTION_UNSPECIFIED; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse = { + encode(_: MsgVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposal_id: "0", voter: "", options: [], metadata: "" }; +} + +export const MsgVoteWeighted = { + encode(message: MsgVoteWeighted, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [], + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + if (message.options) { + obj.options = message.options.map((e) => e ? WeightedVoteOption.toJSON(e) : undefined); + } else { + obj.options = []; + } + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse = { + encode(_: MsgVoteWeightedResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposal_id: "0", depositor: "", amount: [] }; +} + +export const MsgDeposit = { + encode(message: MsgDeposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDeposit): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse = { + encode(_: MsgDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + */ + ExecLegacyContent(request: MsgExecLegacyContent): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.gov.v1.Msg"; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.ExecLegacyContent = this.ExecLegacyContent.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + } + SubmitProposal(request: MsgSubmitProposal): Promise { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitProposal", data); + return promise.then((data) => MsgSubmitProposalResponse.decode(new _m0.Reader(data))); + } + + ExecLegacyContent(request: MsgExecLegacyContent): Promise { + const data = MsgExecLegacyContent.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExecLegacyContent", data); + return promise.then((data) => MsgExecLegacyContentResponse.decode(new _m0.Reader(data))); + } + + Vote(request: MsgVote): Promise { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "Vote", data); + return promise.then((data) => MsgVoteResponse.decode(new _m0.Reader(data))); + } + + VoteWeighted(request: MsgVoteWeighted): Promise { + const data = MsgVoteWeighted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteWeighted", data); + return promise.then((data) => MsgVoteWeightedResponse.decode(new _m0.Reader(data))); + } + + Deposit(request: MsgDeposit): Promise { + const data = MsgDeposit.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposit", data); + return promise.then((data) => MsgDepositResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/gov/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 00000000..8ef52afc --- /dev/null +++ b/common/types/src/lcd/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,180 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Deposit, DepositParams, Proposal, TallyParams, Vote, VotingParams } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1beta1"; + +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisState { + /** starting_proposal_id is the ID of the starting proposal. */ + starting_proposal_id: string; + /** deposits defines all the deposits present at genesis. */ + deposits: Deposit[]; + /** votes defines all the votes present at genesis. */ + votes: Vote[]; + /** proposals defines all the proposals present at genesis. */ + proposals: Proposal[]; + /** params defines all the paramaters of related to deposit. */ + deposit_params?: DepositParams; + /** params defines all the paramaters of related to voting. */ + voting_params?: VotingParams; + /** params defines all the paramaters of related to tally. */ + tally_params?: TallyParams; +} + +function createBaseGenesisState(): GenesisState { + return { + starting_proposal_id: "0", + deposits: [], + votes: [], + proposals: [], + deposit_params: undefined, + voting_params: undefined, + tally_params: undefined, + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.starting_proposal_id !== "0") { + writer.uint32(8).uint64(message.starting_proposal_id); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.deposit_params !== undefined) { + DepositParams.encode(message.deposit_params, writer.uint32(42).fork()).ldelim(); + } + if (message.voting_params !== undefined) { + VotingParams.encode(message.voting_params, writer.uint32(50).fork()).ldelim(); + } + if (message.tally_params !== undefined) { + TallyParams.encode(message.tally_params, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.starting_proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 3: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 4: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 5: + message.deposit_params = DepositParams.decode(reader, reader.uint32()); + break; + case 6: + message.voting_params = VotingParams.decode(reader, reader.uint32()); + break; + case 7: + message.tally_params = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + starting_proposal_id: isSet(object.starting_proposal_id) ? String(object.starting_proposal_id) : "0", + deposits: Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + deposit_params: isSet(object.deposit_params) ? DepositParams.fromJSON(object.deposit_params) : undefined, + voting_params: isSet(object.voting_params) ? VotingParams.fromJSON(object.voting_params) : undefined, + tally_params: isSet(object.tally_params) ? TallyParams.fromJSON(object.tally_params) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.starting_proposal_id !== undefined && (obj.starting_proposal_id = message.starting_proposal_id); + if (message.deposits) { + obj.deposits = message.deposits.map((e) => e ? Deposit.toJSON(e) : undefined); + } else { + obj.deposits = []; + } + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + message.deposit_params !== undefined && + (obj.deposit_params = message.deposit_params ? DepositParams.toJSON(message.deposit_params) : undefined); + message.voting_params !== undefined && + (obj.voting_params = message.voting_params ? VotingParams.toJSON(message.voting_params) : undefined); + message.tally_params !== undefined && + (obj.tally_params = message.tally_params ? TallyParams.toJSON(message.tally_params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.starting_proposal_id = object.starting_proposal_id ?? "0"; + message.deposits = object.deposits?.map((e) => Deposit.fromPartial(e)) || []; + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.proposals = object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.deposit_params = (object.deposit_params !== undefined && object.deposit_params !== null) + ? DepositParams.fromPartial(object.deposit_params) + : undefined; + message.voting_params = (object.voting_params !== undefined && object.voting_params !== null) + ? VotingParams.fromPartial(object.voting_params) + : undefined; + message.tally_params = (object.tally_params !== undefined && object.tally_params !== null) + ? TallyParams.fromPartial(object.tally_params) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/gov/v1beta1/gov.ts b/common/types/src/lcd/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 00000000..add603cb --- /dev/null +++ b/common/types/src/lcd/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1054 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.gov.v1beta1"; + +/** 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 = "VOTE_OPTION_UNSPECIFIED", + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = "VOTE_OPTION_YES", + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = "VOTE_OPTION_ABSTAIN", + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = "VOTE_OPTION_NO", + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = "VOTE_OPTION_NO_WITH_VETO", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function voteOptionToNumber(object: VoteOption): number { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return 0; + case VoteOption.VOTE_OPTION_YES: + return 1; + case VoteOption.VOTE_OPTION_ABSTAIN: + return 2; + case VoteOption.VOTE_OPTION_NO: + return 3; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return 4; + case VoteOption.UNRECOGNIZED: + default: + return -1; + } +} + +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. */ + PROPOSAL_STATUS_UNSPECIFIED = "PROPOSAL_STATUS_UNSPECIFIED", + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = "PROPOSAL_STATUS_DEPOSIT_PERIOD", + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = "PROPOSAL_STATUS_VOTING_PERIOD", + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = "PROPOSAL_STATUS_PASSED", + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = "PROPOSAL_STATUS_REJECTED", + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = "PROPOSAL_STATUS_FAILED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function proposalStatusToNumber(object: ProposalStatus): number { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return 0; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return 1; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return 2; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return 3; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return 4; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return 5; + case ProposalStatus.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOption { + option: VoteOption; + weight: string; +} + +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposal { + title: string; + description: string; +} + +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + proposal_id: string; + depositor: string; + amount: Coin[]; +} + +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + proposal_id: string; + content?: Any; + 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?: TallyResult; + submit_time?: Date; + deposit_end_time?: Date; + total_deposit: Coin[]; + voting_start_time?: Date; + voting_end_time?: Date; +} + +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + yes: string; + abstain: string; + no: string; + no_with_veto: string; +} + +/** + * 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: string; + 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; + /** Since: cosmos-sdk 0.43 */ + options: WeightedVoteOption[]; +} + +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: Duration; +} + +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Length of the voting period. */ + voting_period?: Duration; +} + +/** 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. + */ + veto_threshold: Uint8Array; +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: VoteOption.VOTE_OPTION_UNSPECIFIED, weight: "" }; +} + +export const WeightedVoteOption = { + encode(message: WeightedVoteOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.option !== VoteOption.VOTE_OPTION_UNSPECIFIED) { + writer.uint32(8).int32(voteOptionToNumber(message.option)); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = voteOptionFromJSON(reader.int32()); + break; + case 2: + message.weight = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : VoteOption.VOTE_OPTION_UNSPECIFIED, + weight: isSet(object.weight) ? String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.weight !== undefined && (obj.weight = message.weight); + return obj; + }, + + fromPartial, I>>(object: I): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? VoteOption.VOTE_OPTION_UNSPECIFIED; + message.weight = object.weight ?? ""; + return message; + }, +}; + +function createBaseTextProposal(): TextProposal { + return { title: "", description: "" }; +} + +export const TextProposal = { + encode(message: TextProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): TextProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + + toJSON(message: TextProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + + fromPartial, I>>(object: I): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseDeposit(): Deposit { + return { proposal_id: "0", depositor: "", amount: [] }; +} + +export const Deposit = { + encode(message: Deposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): Deposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): Deposit { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Deposit): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Deposit { + const message = createBaseDeposit(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + proposal_id: "0", + content: undefined, + status: ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED, + final_tally_result: undefined, + submit_time: undefined, + deposit_end_time: undefined, + total_deposit: [], + voting_start_time: undefined, + voting_end_time: undefined, + }; +} + +export const Proposal = { + encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(18).fork()).ldelim(); + } + if (message.status !== ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED) { + writer.uint32(24).int32(proposalStatusToNumber(message.status)); + } + if (message.final_tally_result !== undefined) { + TallyResult.encode(message.final_tally_result, writer.uint32(34).fork()).ldelim(); + } + if (message.submit_time !== undefined) { + Timestamp.encode(toTimestamp(message.submit_time), writer.uint32(42).fork()).ldelim(); + } + if (message.deposit_end_time !== undefined) { + Timestamp.encode(toTimestamp(message.deposit_end_time), writer.uint32(50).fork()).ldelim(); + } + for (const v of message.total_deposit) { + Coin.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.voting_start_time !== undefined) { + Timestamp.encode(toTimestamp(message.voting_start_time), writer.uint32(66).fork()).ldelim(); + } + if (message.voting_end_time !== undefined) { + Timestamp.encode(toTimestamp(message.voting_end_time), writer.uint32(74).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.content = Any.decode(reader, reader.uint32()); + break; + case 3: + message.status = proposalStatusFromJSON(reader.int32()); + break; + case 4: + message.final_tally_result = TallyResult.decode(reader, reader.uint32()); + break; + case 5: + message.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.deposit_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.total_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 8: + message.voting_start_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 9: + message.voting_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED, + final_tally_result: isSet(object.final_tally_result) + ? TallyResult.fromJSON(object.final_tally_result) + : undefined, + submit_time: isSet(object.submit_time) ? fromJsonTimestamp(object.submit_time) : undefined, + deposit_end_time: isSet(object.deposit_end_time) ? fromJsonTimestamp(object.deposit_end_time) : undefined, + total_deposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromJSON(e)) : [], + voting_start_time: isSet(object.voting_start_time) ? fromJsonTimestamp(object.voting_start_time) : undefined, + voting_end_time: isSet(object.voting_end_time) ? fromJsonTimestamp(object.voting_end_time) : undefined, + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); + message.status !== undefined && (obj.status = proposalStatusToJSON(message.status)); + message.final_tally_result !== undefined && + (obj.final_tally_result = message.final_tally_result + ? TallyResult.toJSON(message.final_tally_result) + : undefined); + message.submit_time !== undefined && (obj.submit_time = message.submit_time.toISOString()); + message.deposit_end_time !== undefined && (obj.deposit_end_time = message.deposit_end_time.toISOString()); + if (message.total_deposit) { + obj.total_deposit = message.total_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.total_deposit = []; + } + message.voting_start_time !== undefined && (obj.voting_start_time = message.voting_start_time.toISOString()); + message.voting_end_time !== undefined && (obj.voting_end_time = message.voting_end_time.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.proposal_id = object.proposal_id ?? "0"; + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.status = object.status ?? ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + message.final_tally_result = (object.final_tally_result !== undefined && object.final_tally_result !== null) + ? TallyResult.fromPartial(object.final_tally_result) + : undefined; + message.submit_time = object.submit_time ?? undefined; + message.deposit_end_time = object.deposit_end_time ?? undefined; + message.total_deposit = object.total_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.voting_start_time = object.voting_start_time ?? undefined; + message.voting_end_time = object.voting_end_time ?? undefined; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes: "", abstain: "", no: "", no_with_veto: "" }; +} + +export const TallyResult = { + encode(message: TallyResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.no_with_veto !== "") { + writer.uint32(34).string(message.no_with_veto); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.no_with_veto = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes: isSet(object.yes) ? String(object.yes) : "", + abstain: isSet(object.abstain) ? String(object.abstain) : "", + no: isSet(object.no) ? String(object.no) : "", + no_with_veto: isSet(object.no_with_veto) ? String(object.no_with_veto) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + message.yes !== undefined && (obj.yes = message.yes); + message.abstain !== undefined && (obj.abstain = message.abstain); + message.no !== undefined && (obj.no = message.no); + message.no_with_veto !== undefined && (obj.no_with_veto = message.no_with_veto); + return obj; + }, + + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.no_with_veto = object.no_with_veto ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { proposal_id: "0", voter: "", option: VoteOption.VOTE_OPTION_UNSPECIFIED, options: [] }; +} + +export const Vote = { + encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== VoteOption.VOTE_OPTION_UNSPECIFIED) { + writer.uint32(24).int32(voteOptionToNumber(message.option)); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Vote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = voteOptionFromJSON(reader.int32()); + break; + case 4: + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : VoteOption.VOTE_OPTION_UNSPECIFIED, + options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [], + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + if (message.options) { + obj.options = message.options.map((e) => e ? WeightedVoteOption.toJSON(e) : undefined); + } else { + obj.options = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.option = object.option ?? VoteOption.VOTE_OPTION_UNSPECIFIED; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDepositParams(): DepositParams { + return { min_deposit: [], max_deposit_period: undefined }; +} + +export const DepositParams = { + encode(message: DepositParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.min_deposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.max_deposit_period !== undefined) { + Duration.encode(message.max_deposit_period, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.min_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.max_deposit_period = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + min_deposit: Array.isArray(object?.min_deposit) ? object.min_deposit.map((e: any) => Coin.fromJSON(e)) : [], + max_deposit_period: isSet(object.max_deposit_period) ? Duration.fromJSON(object.max_deposit_period) : undefined, + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.min_deposit) { + obj.min_deposit = message.min_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.min_deposit = []; + } + message.max_deposit_period !== undefined && + (obj.max_deposit_period = message.max_deposit_period ? Duration.toJSON(message.max_deposit_period) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.min_deposit = object.min_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.max_deposit_period = (object.max_deposit_period !== undefined && object.max_deposit_period !== null) + ? Duration.fromPartial(object.max_deposit_period) + : undefined; + return message; + }, +}; + +function createBaseVotingParams(): VotingParams { + return { voting_period: undefined }; +} + +export const VotingParams = { + encode(message: VotingParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voting_period !== undefined) { + Duration.encode(message.voting_period, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.voting_period = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { voting_period: isSet(object.voting_period) ? Duration.fromJSON(object.voting_period) : undefined }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + message.voting_period !== undefined && + (obj.voting_period = message.voting_period ? Duration.toJSON(message.voting_period) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.voting_period = (object.voting_period !== undefined && object.voting_period !== null) + ? Duration.fromPartial(object.voting_period) + : undefined; + return message; + }, +}; + +function createBaseTallyParams(): TallyParams { + return { quorum: new Uint8Array(), threshold: new Uint8Array(), veto_threshold: new Uint8Array() }; +} + +export const TallyParams = { + encode(message: TallyParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.veto_threshold.length !== 0) { + writer.uint32(26).bytes(message.veto_threshold); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.veto_threshold = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? bytesFromBase64(object.quorum) : new Uint8Array(), + threshold: isSet(object.threshold) ? bytesFromBase64(object.threshold) : new Uint8Array(), + veto_threshold: isSet(object.veto_threshold) ? bytesFromBase64(object.veto_threshold) : new Uint8Array(), + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + message.quorum !== undefined && + (obj.quorum = base64FromBytes(message.quorum !== undefined ? message.quorum : new Uint8Array())); + message.threshold !== undefined && + (obj.threshold = base64FromBytes(message.threshold !== undefined ? message.threshold : new Uint8Array())); + message.veto_threshold !== undefined && + (obj.veto_threshold = base64FromBytes( + message.veto_threshold !== undefined ? message.veto_threshold : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? new Uint8Array(); + message.threshold = object.threshold ?? new Uint8Array(); + message.veto_threshold = object.veto_threshold ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/gov/v1beta1/query.ts b/common/types/src/lcd/cosmos/gov/v1beta1/query.ts new file mode 100644 index 00000000..5b2ac2a5 --- /dev/null +++ b/common/types/src/lcd/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,1184 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + Deposit, + DepositParams, + Proposal, + ProposalStatus, + proposalStatusFromJSON, + proposalStatusToJSON, + proposalStatusToNumber, + TallyParams, + TallyResult, + Vote, + VotingParams, +} from "./gov"; + +export const protobufPackage = "cosmos.gov.v1beta1"; + +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} + +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal?: Proposal; +} + +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** 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?: PageRequest; +} + +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter defines the oter address for the proposals. */ + voter: string; +} + +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponse { + /** vote defined the queried vote. */ + vote?: Vote; +} + +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defined the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** 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". + */ + params_type: string; +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + voting_params?: VotingParams; + /** deposit_params defines the parameters related to deposit. */ + deposit_params?: DepositParams; + /** tally_params defines the parameters related to tally. */ + tally_params?: TallyParams; +} + +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} + +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponse { + /** deposit defines the requested deposit. */ + deposit?: Deposit; +} + +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} + +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally?: TallyResult; +} + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposal_id: "0" }; +} + +export const QueryProposalRequest = { + encode(message: QueryProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse = { + encode(message: QueryProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = (object.proposal !== undefined && object.proposal !== null) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { + proposal_status: ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED, + voter: "", + depositor: "", + pagination: undefined, + }; +} + +export const QueryProposalsRequest = { + encode(message: QueryProposalsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_status !== ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED) { + writer.uint32(8).int32(proposalStatusToNumber(message.proposal_status)); + } + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_status = proposalStatusFromJSON(reader.int32()); + 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; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposal_status: isSet(object.proposal_status) + ? proposalStatusFromJSON(object.proposal_status) + : ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED, + voter: isSet(object.voter) ? String(object.voter) : "", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsRequest): unknown { + const obj: any = {}; + message.proposal_status !== undefined && (obj.proposal_status = proposalStatusToJSON(message.proposal_status)); + message.voter !== undefined && (obj.voter = message.voter); + message.depositor !== undefined && (obj.depositor = message.depositor); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + message.proposal_status = object.proposal_status ?? ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsResponse = { + encode(message: QueryProposalsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsResponse): unknown { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposal_id: "0", voter: "" }; +} + +export const QueryVoteRequest = { + encode(message: QueryVoteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + return obj; + }, + + fromPartial, I>>(object: I): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +export const QueryVoteResponse = { + encode(message: QueryVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + message.vote = (object.vote !== undefined && object.vote !== null) ? Vote.fromPartial(object.vote) : undefined; + return message; + }, +}; + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposal_id: "0", pagination: undefined }; +} + +export const QueryVotesRequest = { + encode(message: QueryVotesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVotesResponse(): QueryVotesResponse { + return { votes: [], pagination: undefined }; +} + +export const QueryVotesResponse = { + encode(message: QueryVotesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesResponse): unknown { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { params_type: "" }; +} + +export const QueryParamsRequest = { + encode(message: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params_type !== "") { + writer.uint32(10).string(message.params_type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.params_type = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { params_type: isSet(object.params_type) ? String(object.params_type) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + message.params_type !== undefined && (obj.params_type = message.params_type); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.params_type = object.params_type ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { voting_params: undefined, deposit_params: undefined, tally_params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voting_params !== undefined) { + VotingParams.encode(message.voting_params, writer.uint32(10).fork()).ldelim(); + } + if (message.deposit_params !== undefined) { + DepositParams.encode(message.deposit_params, writer.uint32(18).fork()).ldelim(); + } + if (message.tally_params !== undefined) { + TallyParams.encode(message.tally_params, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.voting_params = VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.deposit_params = DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tally_params = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + voting_params: isSet(object.voting_params) ? VotingParams.fromJSON(object.voting_params) : undefined, + deposit_params: isSet(object.deposit_params) ? DepositParams.fromJSON(object.deposit_params) : undefined, + tally_params: isSet(object.tally_params) ? TallyParams.fromJSON(object.tally_params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.voting_params !== undefined && + (obj.voting_params = message.voting_params ? VotingParams.toJSON(message.voting_params) : undefined); + message.deposit_params !== undefined && + (obj.deposit_params = message.deposit_params ? DepositParams.toJSON(message.deposit_params) : undefined); + message.tally_params !== undefined && + (obj.tally_params = message.tally_params ? TallyParams.toJSON(message.tally_params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.voting_params = (object.voting_params !== undefined && object.voting_params !== null) + ? VotingParams.fromPartial(object.voting_params) + : undefined; + message.deposit_params = (object.deposit_params !== undefined && object.deposit_params !== null) + ? DepositParams.fromPartial(object.deposit_params) + : undefined; + message.tally_params = (object.tally_params !== undefined && object.tally_params !== null) + ? TallyParams.fromPartial(object.tally_params) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposal_id: "0", depositor: "" }; +} + +export const QueryDepositRequest = { + encode(message: QueryDepositRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +export const QueryDepositResponse = { + encode(message: QueryDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + message.deposit !== undefined && (obj.deposit = message.deposit ? Deposit.toJSON(message.deposit) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + message.deposit = (object.deposit !== undefined && object.deposit !== null) + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposal_id: "0", pagination: undefined }; +} + +export const QueryDepositsRequest = { + encode(message: QueryDepositsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDepositsResponse(): QueryDepositsResponse { + return { deposits: [], pagination: undefined }; +} + +export const QueryDepositsResponse = { + encode(message: QueryDepositsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + deposits: Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsResponse): unknown { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => e ? Deposit.toJSON(e) : undefined); + } else { + obj.deposits = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposal_id: "0" }; +} + +export const QueryTallyResultRequest = { + encode(message: QueryTallyResultRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse = { + encode(message: QueryTallyResultResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = (object.tally !== undefined && object.tally !== null) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Proposal queries proposal details based on ProposalID. */ + Proposal(request: QueryProposalRequest): Promise; + /** Proposals queries all proposals based on given status. */ + Proposals(request: QueryProposalsRequest): Promise; + /** Vote queries voted information based on proposalID, voterAddr. */ + Vote(request: QueryVoteRequest): Promise; + /** Votes queries votes of a given proposal. */ + Votes(request: QueryVotesRequest): Promise; + /** Params queries all parameters of the gov module. */ + Params(request: QueryParamsRequest): Promise; + /** Deposit queries single deposit information based proposalID, depositAddr. */ + Deposit(request: QueryDepositRequest): Promise; + /** Deposits queries all deposits of a single proposal. */ + Deposits(request: QueryDepositsRequest): Promise; + /** TallyResult queries the tally of a proposal vote. */ + TallyResult(request: QueryTallyResultRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.gov.v1beta1.Query"; + this.rpc = rpc; + this.Proposal = this.Proposal.bind(this); + this.Proposals = this.Proposals.bind(this); + this.Vote = this.Vote.bind(this); + this.Votes = this.Votes.bind(this); + this.Params = this.Params.bind(this); + this.Deposit = this.Deposit.bind(this); + this.Deposits = this.Deposits.bind(this); + this.TallyResult = this.TallyResult.bind(this); + } + Proposal(request: QueryProposalRequest): Promise { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Proposal", data); + return promise.then((data) => QueryProposalResponse.decode(new _m0.Reader(data))); + } + + Proposals(request: QueryProposalsRequest): Promise { + const data = QueryProposalsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Proposals", data); + return promise.then((data) => QueryProposalsResponse.decode(new _m0.Reader(data))); + } + + Vote(request: QueryVoteRequest): Promise { + const data = QueryVoteRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Vote", data); + return promise.then((data) => QueryVoteResponse.decode(new _m0.Reader(data))); + } + + Votes(request: QueryVotesRequest): Promise { + const data = QueryVotesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Votes", data); + return promise.then((data) => QueryVotesResponse.decode(new _m0.Reader(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + Deposit(request: QueryDepositRequest): Promise { + const data = QueryDepositRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposit", data); + return promise.then((data) => QueryDepositResponse.decode(new _m0.Reader(data))); + } + + Deposits(request: QueryDepositsRequest): Promise { + const data = QueryDepositsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposits", data); + return promise.then((data) => QueryDepositsResponse.decode(new _m0.Reader(data))); + } + + TallyResult(request: QueryTallyResultRequest): Promise { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TallyResult", data); + return promise.then((data) => QueryTallyResultResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/gov/v1beta1/tx.ts b/common/types/src/lcd/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 00000000..44101be2 --- /dev/null +++ b/common/types/src/lcd/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,592 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Coin } from "../../base/v1beta1/coin"; +import { VoteOption, voteOptionFromJSON, voteOptionToJSON, voteOptionToNumber, WeightedVoteOption } from "./gov"; + +export const protobufPackage = "cosmos.gov.v1beta1"; + +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + content?: Any; + initial_deposit: Coin[]; + proposer: string; +} + +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + proposal_id: string; +} + +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + proposal_id: string; + voter: string; + option: VoteOption; +} + +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeighted { + proposal_id: string; + voter: string; + options: WeightedVoteOption[]; +} + +/** + * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedResponse { +} + +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + proposal_id: string; + depositor: string; + amount: Coin[]; +} + +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse { +} + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { content: undefined, initial_deposit: [], proposer: "" }; +} + +export const MsgSubmitProposal = { + encode(message: MsgSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initial_deposit) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = Any.decode(reader, reader.uint32()); + break; + case 2: + message.initial_deposit.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + initial_deposit: Array.isArray(object?.initial_deposit) + ? object.initial_deposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? String(object.proposer) : "", + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); + if (message.initial_deposit) { + obj.initial_deposit = message.initial_deposit.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.initial_deposit = []; + } + message.proposer !== undefined && (obj.proposer = message.proposer); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = (object.content !== undefined && object.content !== null) + ? Any.fromPartial(object.content) + : undefined; + message.initial_deposit = object.initial_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposal_id: "0" }; +} + +export const MsgSubmitProposalResponse = { + encode(message: MsgSubmitProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { proposal_id: "0", voter: "", option: VoteOption.VOTE_OPTION_UNSPECIFIED }; +} + +export const MsgVote = { + encode(message: MsgVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== VoteOption.VOTE_OPTION_UNSPECIFIED) { + writer.uint32(24).int32(voteOptionToNumber(message.option)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = voteOptionFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : VoteOption.VOTE_OPTION_UNSPECIFIED, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + return obj; + }, + + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.option = object.option ?? VoteOption.VOTE_OPTION_UNSPECIFIED; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse = { + encode(_: MsgVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposal_id: "0", voter: "", options: [] }; +} + +export const MsgVoteWeighted = { + encode(message: MsgVoteWeighted, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + if (message.options) { + obj.options = message.options.map((e) => e ? WeightedVoteOption.toJSON(e) : undefined); + } else { + obj.options = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +export const MsgVoteWeightedResponse = { + encode(_: MsgVoteWeightedResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +function createBaseMsgDeposit(): MsgDeposit { + return { proposal_id: "0", depositor: "", amount: [] }; +} + +export const MsgDeposit = { + encode(message: MsgDeposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + 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: _m0.Reader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDeposit): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposal_id = object.proposal_id ?? "0"; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +export const MsgDepositResponse = { + encode(_: MsgDepositResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * + * Since: cosmos-sdk 0.43 + */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.gov.v1beta1.Msg"; + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + } + SubmitProposal(request: MsgSubmitProposal): Promise { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitProposal", data); + return promise.then((data) => MsgSubmitProposalResponse.decode(new _m0.Reader(data))); + } + + Vote(request: MsgVote): Promise { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "Vote", data); + return promise.then((data) => MsgVoteResponse.decode(new _m0.Reader(data))); + } + + VoteWeighted(request: MsgVoteWeighted): Promise { + const data = MsgVoteWeighted.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteWeighted", data); + return promise.then((data) => MsgVoteWeightedResponse.decode(new _m0.Reader(data))); + } + + Deposit(request: MsgDeposit): Promise { + const data = MsgDeposit.encode(request).finish(); + const promise = this.rpc.request(this.service, "Deposit", data); + return promise.then((data) => MsgDepositResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/group/v1/events.ts b/common/types/src/lcd/cosmos/group/v1/events.ts new file mode 100644 index 00000000..cb80cf9c --- /dev/null +++ b/common/types/src/lcd/cosmos/group/v1/events.ts @@ -0,0 +1,540 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { + ProposalExecutorResult, + proposalExecutorResultFromJSON, + proposalExecutorResultToJSON, + proposalExecutorResultToNumber, +} from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroup { + /** group_id is the unique ID of the group. */ + group_id: string; +} + +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroup { + /** group_id is the unique ID of the group. */ + group_id: string; +} + +/** EventCreateGroupPolicy is an event emitted when a group policy is created. */ +export interface EventCreateGroupPolicy { + /** address is the account address of the group policy. */ + address: string; +} + +/** EventUpdateGroupPolicy is an event emitted when a group policy is updated. */ +export interface EventUpdateGroupPolicy { + /** address is the account address of the group policy. */ + address: string; +} + +/** EventSubmitProposal is an event emitted when a proposal is created. */ +export interface EventSubmitProposal { + /** proposal_id is the unique ID of the proposal. */ + proposal_id: string; +} + +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposal { + /** proposal_id is the unique ID of the proposal. */ + proposal_id: string; +} + +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVote { + /** proposal_id is the unique ID of the proposal. */ + proposal_id: string; +} + +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExec { + /** proposal_id is the unique ID of the proposal. */ + proposal_id: string; + /** result is the proposal execution result. */ + result: ProposalExecutorResult; +} + +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroup { + /** group_id is the unique ID of the group. */ + group_id: string; + /** address is the account address of the group member. */ + address: string; +} + +function createBaseEventCreateGroup(): EventCreateGroup { + return { group_id: "0" }; +} + +export const EventCreateGroup = { + encode(message: EventCreateGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateGroup { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventCreateGroup { + return { group_id: isSet(object.group_id) ? String(object.group_id) : "0" }; + }, + + toJSON(message: EventCreateGroup): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + return obj; + }, + + fromPartial, I>>(object: I): EventCreateGroup { + const message = createBaseEventCreateGroup(); + message.group_id = object.group_id ?? "0"; + return message; + }, +}; + +function createBaseEventUpdateGroup(): EventUpdateGroup { + return { group_id: "0" }; +} + +export const EventUpdateGroup = { + encode(message: EventUpdateGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateGroup { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventUpdateGroup { + return { group_id: isSet(object.group_id) ? String(object.group_id) : "0" }; + }, + + toJSON(message: EventUpdateGroup): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + return obj; + }, + + fromPartial, I>>(object: I): EventUpdateGroup { + const message = createBaseEventUpdateGroup(); + message.group_id = object.group_id ?? "0"; + return message; + }, +}; + +function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { + return { address: "" }; +} + +export const EventCreateGroupPolicy = { + encode(message: EventCreateGroupPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateGroupPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreateGroupPolicy(); + 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; + }, + + fromJSON(object: any): EventCreateGroupPolicy { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: EventCreateGroupPolicy): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): EventCreateGroupPolicy { + const message = createBaseEventCreateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { + return { address: "" }; +} + +export const EventUpdateGroupPolicy = { + encode(message: EventUpdateGroupPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateGroupPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateGroupPolicy(); + 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; + }, + + fromJSON(object: any): EventUpdateGroupPolicy { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: EventUpdateGroupPolicy): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): EventUpdateGroupPolicy { + const message = createBaseEventUpdateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseEventSubmitProposal(): EventSubmitProposal { + return { proposal_id: "0" }; +} + +export const EventSubmitProposal = { + encode(message: EventSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventSubmitProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventSubmitProposal { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: EventSubmitProposal): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): EventSubmitProposal { + const message = createBaseEventSubmitProposal(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseEventWithdrawProposal(): EventWithdrawProposal { + return { proposal_id: "0" }; +} + +export const EventWithdrawProposal = { + encode(message: EventWithdrawProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventWithdrawProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventWithdrawProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventWithdrawProposal { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: EventWithdrawProposal): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): EventWithdrawProposal { + const message = createBaseEventWithdrawProposal(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseEventVote(): EventVote { + return { proposal_id: "0" }; +} + +export const EventVote = { + encode(message: EventVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventVote { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: EventVote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): EventVote { + const message = createBaseEventVote(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseEventExec(): EventExec { + return { proposal_id: "0", result: ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED }; +} + +export const EventExec = { + encode(message: EventExec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.result !== ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED) { + writer.uint32(16).int32(proposalExecutorResultToNumber(message.result)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventExec { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.result = proposalExecutorResultFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventExec { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + result: isSet(object.result) + ? proposalExecutorResultFromJSON(object.result) + : ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED, + }; + }, + + toJSON(message: EventExec): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.result !== undefined && (obj.result = proposalExecutorResultToJSON(message.result)); + return obj; + }, + + fromPartial, I>>(object: I): EventExec { + const message = createBaseEventExec(); + message.proposal_id = object.proposal_id ?? "0"; + message.result = object.result ?? ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED; + return message; + }, +}; + +function createBaseEventLeaveGroup(): EventLeaveGroup { + return { group_id: "0", address: "" }; +} + +export const EventLeaveGroup = { + encode(message: EventLeaveGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventLeaveGroup { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventLeaveGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventLeaveGroup { + return { + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + address: isSet(object.address) ? String(object.address) : "", + }; + }, + + toJSON(message: EventLeaveGroup): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): EventLeaveGroup { + const message = createBaseEventLeaveGroup(); + message.group_id = object.group_id ?? "0"; + message.address = object.address ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/group/v1/genesis.ts b/common/types/src/lcd/cosmos/group/v1/genesis.ts new file mode 100644 index 00000000..d9da567e --- /dev/null +++ b/common/types/src/lcd/cosmos/group/v1/genesis.ts @@ -0,0 +1,204 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** GenesisState defines the group module's genesis state. */ +export interface GenesisState { + /** + * group_seq is the group table orm.Sequence, + * it is used to get the next group ID. + */ + group_seq: string; + /** groups is the list of groups info. */ + groups: GroupInfo[]; + /** group_members is the list of groups members. */ + group_members: GroupMember[]; + /** + * group_policy_seq is the group policy table orm.Sequence, + * it is used to generate the next group policy account address. + */ + group_policy_seq: string; + /** group_policies is the list of group policies info. */ + group_policies: GroupPolicyInfo[]; + /** + * proposal_seq is the proposal table orm.Sequence, + * it is used to get the next proposal ID. + */ + proposal_seq: string; + /** proposals is the list of proposals. */ + proposals: Proposal[]; + /** votes is the list of votes. */ + votes: Vote[]; +} + +function createBaseGenesisState(): GenesisState { + return { + group_seq: "0", + groups: [], + group_members: [], + group_policy_seq: "0", + group_policies: [], + proposal_seq: "0", + proposals: [], + votes: [], + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_seq !== "0") { + writer.uint32(8).uint64(message.group_seq); + } + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.group_members) { + GroupMember.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.group_policy_seq !== "0") { + writer.uint32(32).uint64(message.group_policy_seq); + } + for (const v of message.group_policies) { + GroupPolicyInfo.encode(v!, writer.uint32(42).fork()).ldelim(); + } + if (message.proposal_seq !== "0") { + writer.uint32(48).uint64(message.proposal_seq); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_seq = longToString(reader.uint64() as Long); + break; + case 2: + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + break; + case 3: + message.group_members.push(GroupMember.decode(reader, reader.uint32())); + break; + case 4: + message.group_policy_seq = longToString(reader.uint64() as Long); + break; + case 5: + message.group_policies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + break; + case 6: + message.proposal_seq = longToString(reader.uint64() as Long); + break; + case 7: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 8: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + group_seq: isSet(object.group_seq) ? String(object.group_seq) : "0", + groups: Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + group_members: Array.isArray(object?.group_members) + ? object.group_members.map((e: any) => GroupMember.fromJSON(e)) + : [], + group_policy_seq: isSet(object.group_policy_seq) ? String(object.group_policy_seq) : "0", + group_policies: Array.isArray(object?.group_policies) + ? object.group_policies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + proposal_seq: isSet(object.proposal_seq) ? String(object.proposal_seq) : "0", + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.group_seq !== undefined && (obj.group_seq = message.group_seq); + if (message.groups) { + obj.groups = message.groups.map((e) => e ? GroupInfo.toJSON(e) : undefined); + } else { + obj.groups = []; + } + if (message.group_members) { + obj.group_members = message.group_members.map((e) => e ? GroupMember.toJSON(e) : undefined); + } else { + obj.group_members = []; + } + message.group_policy_seq !== undefined && (obj.group_policy_seq = message.group_policy_seq); + if (message.group_policies) { + obj.group_policies = message.group_policies.map((e) => e ? GroupPolicyInfo.toJSON(e) : undefined); + } else { + obj.group_policies = []; + } + message.proposal_seq !== undefined && (obj.proposal_seq = message.proposal_seq); + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.group_seq = object.group_seq ?? "0"; + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.group_members = object.group_members?.map((e) => GroupMember.fromPartial(e)) || []; + message.group_policy_seq = object.group_policy_seq ?? "0"; + message.group_policies = object.group_policies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.proposal_seq = object.proposal_seq ?? "0"; + message.proposals = object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/group/v1/query.ts b/common/types/src/lcd/cosmos/group/v1/query.ts new file mode 100644 index 00000000..a8c76c01 --- /dev/null +++ b/common/types/src/lcd/cosmos/group/v1/query.ts @@ -0,0 +1,1869 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupMember, GroupPolicyInfo, Proposal, TallyResult, Vote } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequest { + /** group_id is the unique ID of the group. */ + group_id: string; +} + +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponse { + /** info is the GroupInfo for the group. */ + info?: GroupInfo; +} + +/** QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type. */ +export interface QueryGroupPolicyInfoRequest { + /** address is the account address of the group policy. */ + address: string; +} + +/** QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. */ +export interface QueryGroupPolicyInfoResponse { + /** info is the GroupPolicyInfo for the group policy. */ + info?: GroupPolicyInfo; +} + +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequest { + /** group_id is the unique ID of the group. */ + group_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGroupMembersResponse is the Query/GroupMembersResponse response type. */ +export interface QueryGroupMembersResponse { + /** members are the members of the group with given group_id. */ + members: GroupMember[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type. */ +export interface QueryGroupsByAdminRequest { + /** admin is the account address of a group's admin. */ + admin: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type. */ +export interface QueryGroupsByAdminResponse { + /** groups are the groups info with the provided admin. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequest { + /** group_id is the unique ID of the group policy's group. */ + group_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponse { + /** group_policies are the group policies info associated with the provided group. */ + group_policies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type. */ +export interface QueryGroupPoliciesByAdminRequest { + /** admin is the admin address of the group policy. */ + admin: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponse { + /** group_policies are the group policies info with provided admin. */ + group_policies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposal_id: string; +} + +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponse { + /** proposal is the proposal info. */ + proposal?: Proposal; +} + +/** QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type. */ +export interface QueryProposalsByGroupPolicyRequest { + /** address is the account address of the group policy related to proposals. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type. */ +export interface QueryProposalsByGroupPolicyResponse { + /** proposals are the proposals with given group policy. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequest { + /** proposal_id is the unique ID of a proposal. */ + proposal_id: string; + /** voter is a proposal voter account address. */ + voter: string; +} + +/** QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. */ +export interface QueryVoteByProposalVoterResponse { + /** vote is the vote with given proposal_id and voter. */ + vote?: Vote; +} + +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryVotesByProposalResponse is the Query/VotesByProposal response type. */ +export interface QueryVotesByProposalResponse { + /** votes are the list of votes for given proposal_id. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryVotesByVoterRequest is the Query/VotesByVoter request type. */ +export interface QueryVotesByVoterRequest { + /** voter is a proposal voter account address. */ + voter: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryVotesByVoterResponse is the Query/VotesByVoter response type. */ +export interface QueryVotesByVoterResponse { + /** votes are the list of votes by given voter. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryGroupsByMemberRequest is the Query/GroupsByMember request type. */ +export interface QueryGroupsByMemberRequest { + /** address is the group member address. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryGroupsByMemberResponse is the Query/GroupsByMember response type. */ +export interface QueryGroupsByMemberResponse { + /** groups are the groups info with the provided group member. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequest { + /** proposal_id is the unique id of a proposal. */ + proposal_id: string; +} + +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally?: TallyResult; +} + +function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { + return { group_id: "0" }; +} + +export const QueryGroupInfoRequest = { + encode(message: QueryGroupInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoRequest { + return { group_id: isSet(object.group_id) ? String(object.group_id) : "0" }; + }, + + toJSON(message: QueryGroupInfoRequest): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupInfoRequest { + const message = createBaseQueryGroupInfoRequest(); + message.group_id = object.group_id ?? "0"; + return message; + }, +}; + +function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { + return { info: undefined }; +} + +export const QueryGroupInfoResponse = { + encode(message: QueryGroupInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.info !== undefined) { + GroupInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info = GroupInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupInfoResponse { + return { info: isSet(object.info) ? GroupInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupInfoResponse): unknown { + const obj: any = {}; + message.info !== undefined && (obj.info = message.info ? GroupInfo.toJSON(message.info) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupInfoResponse { + const message = createBaseQueryGroupInfoResponse(); + message.info = (object.info !== undefined && object.info !== null) ? GroupInfo.fromPartial(object.info) : undefined; + return message; + }, +}; + +function createBaseQueryGroupPolicyInfoRequest(): QueryGroupPolicyInfoRequest { + return { address: "" }; +} + +export const QueryGroupPolicyInfoRequest = { + encode(message: QueryGroupPolicyInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPolicyInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPolicyInfoRequest(); + 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; + }, + + fromJSON(object: any): QueryGroupPolicyInfoRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryGroupPolicyInfoRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupPolicyInfoRequest { + const message = createBaseQueryGroupPolicyInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { + return { info: undefined }; +} + +export const QueryGroupPolicyInfoResponse = { + encode(message: QueryGroupPolicyInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.info !== undefined) { + GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPolicyInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPolicyInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info = GroupPolicyInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupPolicyInfoResponse { + return { info: isSet(object.info) ? GroupPolicyInfo.fromJSON(object.info) : undefined }; + }, + + toJSON(message: QueryGroupPolicyInfoResponse): unknown { + const obj: any = {}; + message.info !== undefined && (obj.info = message.info ? GroupPolicyInfo.toJSON(message.info) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupPolicyInfoResponse { + const message = createBaseQueryGroupPolicyInfoResponse(); + message.info = (object.info !== undefined && object.info !== null) + ? GroupPolicyInfo.fromPartial(object.info) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupMembersRequest(): QueryGroupMembersRequest { + return { group_id: "0", pagination: undefined }; +} + +export const QueryGroupMembersRequest = { + encode(message: QueryGroupMembersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupMembersRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupMembersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersRequest { + return { + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupMembersRequest): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupMembersRequest { + const message = createBaseQueryGroupMembersRequest(); + message.group_id = object.group_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupMembersResponse(): QueryGroupMembersResponse { + return { members: [], pagination: undefined }; +} + +export const QueryGroupMembersResponse = { + encode(message: QueryGroupMembersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.members) { + GroupMember.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupMembersResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.members.push(GroupMember.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupMembersResponse { + return { + members: Array.isArray(object?.members) ? object.members.map((e: any) => GroupMember.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupMembersResponse): unknown { + const obj: any = {}; + if (message.members) { + obj.members = message.members.map((e) => e ? GroupMember.toJSON(e) : undefined); + } else { + obj.members = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupMembersResponse { + const message = createBaseQueryGroupMembersResponse(); + message.members = object.members?.map((e) => GroupMember.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsByAdminRequest(): QueryGroupsByAdminRequest { + return { admin: "", pagination: undefined }; +} + +export const QueryGroupsByAdminRequest = { + encode(message: QueryGroupsByAdminRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupsByAdminRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByAdminRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminRequest { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByAdminRequest): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupsByAdminRequest { + const message = createBaseQueryGroupsByAdminRequest(); + message.admin = object.admin ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsByAdminResponse(): QueryGroupsByAdminResponse { + return { groups: [], pagination: undefined }; +} + +export const QueryGroupsByAdminResponse = { + encode(message: QueryGroupsByAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupsByAdminResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupsByAdminResponse { + return { + groups: Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByAdminResponse): unknown { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map((e) => e ? GroupInfo.toJSON(e) : undefined); + } else { + obj.groups = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupsByAdminResponse { + const message = createBaseQueryGroupsByAdminResponse(); + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByGroupRequest(): QueryGroupPoliciesByGroupRequest { + return { group_id: "0", pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupRequest = { + encode(message: QueryGroupPoliciesByGroupRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByGroupRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByGroupRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupRequest { + return { + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupRequest): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupRequest { + const message = createBaseQueryGroupPoliciesByGroupRequest(); + message.group_id = object.group_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { + return { group_policies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByGroupResponse = { + encode(message: QueryGroupPoliciesByGroupResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.group_policies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByGroupResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_policies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByGroupResponse { + return { + group_policies: Array.isArray(object?.group_policies) + ? object.group_policies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByGroupResponse): unknown { + const obj: any = {}; + if (message.group_policies) { + obj.group_policies = message.group_policies.map((e) => e ? GroupPolicyInfo.toJSON(e) : undefined); + } else { + obj.group_policies = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByGroupResponse { + const message = createBaseQueryGroupPoliciesByGroupResponse(); + message.group_policies = object.group_policies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByAdminRequest(): QueryGroupPoliciesByAdminRequest { + return { admin: "", pagination: undefined }; +} + +export const QueryGroupPoliciesByAdminRequest = { + encode(message: QueryGroupPoliciesByAdminRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByAdminRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByAdminRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminRequest { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminRequest): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByAdminRequest { + const message = createBaseQueryGroupPoliciesByAdminRequest(); + message.admin = object.admin ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupPoliciesByAdminResponse(): QueryGroupPoliciesByAdminResponse { + return { group_policies: [], pagination: undefined }; +} + +export const QueryGroupPoliciesByAdminResponse = { + encode(message: QueryGroupPoliciesByAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.group_policies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupPoliciesByAdminResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.group_policies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupPoliciesByAdminResponse { + return { + group_policies: Array.isArray(object?.group_policies) + ? object.group_policies.map((e: any) => GroupPolicyInfo.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupPoliciesByAdminResponse): unknown { + const obj: any = {}; + if (message.group_policies) { + obj.group_policies = message.group_policies.map((e) => e ? GroupPolicyInfo.toJSON(e) : undefined); + } else { + obj.group_policies = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryGroupPoliciesByAdminResponse { + const message = createBaseQueryGroupPoliciesByAdminResponse(); + message.group_policies = object.group_policies?.map((e) => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposal_id: "0" }; +} + +export const QueryProposalRequest = { + encode(message: QueryProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +export const QueryProposalResponse = { + encode(message: QueryProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = (object.proposal !== undefined && object.proposal !== null) + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { + return { address: "", pagination: undefined }; +} + +export const QueryProposalsByGroupPolicyRequest = { + encode(message: QueryProposalsByGroupPolicyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsByGroupPolicyRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsByGroupPolicyRequest(); + 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; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsByGroupPolicyRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryProposalsByGroupPolicyRequest { + const message = createBaseQueryProposalsByGroupPolicyRequest(); + message.address = object.address ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryProposalsByGroupPolicyResponse(): QueryProposalsByGroupPolicyResponse { + return { proposals: [], pagination: undefined }; +} + +export const QueryProposalsByGroupPolicyResponse = { + encode(message: QueryProposalsByGroupPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryProposalsByGroupPolicyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsByGroupPolicyResponse(); + 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; + }, + + fromJSON(object: any): QueryProposalsByGroupPolicyResponse { + return { + proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsByGroupPolicyResponse): unknown { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposals = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryProposalsByGroupPolicyResponse { + const message = createBaseQueryProposalsByGroupPolicyResponse(); + message.proposals = object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVoteByProposalVoterRequest(): QueryVoteByProposalVoterRequest { + return { proposal_id: "0", voter: "" }; +} + +export const QueryVoteByProposalVoterRequest = { + encode(message: QueryVoteByProposalVoterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteByProposalVoterRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteByProposalVoterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVoteByProposalVoterRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteByProposalVoterRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryVoteByProposalVoterRequest { + const message = createBaseQueryVoteByProposalVoterRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + return message; + }, +}; + +function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { + return { vote: undefined }; +} + +export const QueryVoteByProposalVoterResponse = { + encode(message: QueryVoteByProposalVoterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteByProposalVoterResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteByProposalVoterResponse(); + 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; + }, + + fromJSON(object: any): QueryVoteByProposalVoterResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteByProposalVoterResponse): unknown { + const obj: any = {}; + message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryVoteByProposalVoterResponse { + const message = createBaseQueryVoteByProposalVoterResponse(); + message.vote = (object.vote !== undefined && object.vote !== null) ? Vote.fromPartial(object.vote) : undefined; + return message; + }, +}; + +function createBaseQueryVotesByProposalRequest(): QueryVotesByProposalRequest { + return { proposal_id: "0", pagination: undefined }; +} + +export const QueryVotesByProposalRequest = { + encode(message: QueryVotesByProposalRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesByProposalRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVotesByProposalRequest { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByProposalRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesByProposalRequest { + const message = createBaseQueryVotesByProposalRequest(); + message.proposal_id = object.proposal_id ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVotesByProposalResponse(): QueryVotesByProposalResponse { + return { votes: [], pagination: undefined }; +} + +export const QueryVotesByProposalResponse = { + encode(message: QueryVotesByProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryVotesByProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByProposalResponse(); + 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; + }, + + fromJSON(object: any): QueryVotesByProposalResponse { + return { + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByProposalResponse): unknown { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesByProposalResponse { + const message = createBaseQueryVotesByProposalResponse(); + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVotesByVoterRequest(): QueryVotesByVoterRequest { + return { voter: "", pagination: undefined }; +} + +export const QueryVotesByVoterRequest = { + encode(message: QueryVotesByVoterRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voter !== "") { + writer.uint32(10).string(message.voter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesByVoterRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByVoterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voter = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryVotesByVoterRequest { + return { + voter: isSet(object.voter) ? String(object.voter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByVoterRequest): unknown { + const obj: any = {}; + message.voter !== undefined && (obj.voter = message.voter); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesByVoterRequest { + const message = createBaseQueryVotesByVoterRequest(); + message.voter = object.voter ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryVotesByVoterResponse(): QueryVotesByVoterResponse { + return { votes: [], pagination: undefined }; +} + +export const QueryVotesByVoterResponse = { + encode(message: QueryVotesByVoterResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryVotesByVoterResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByVoterResponse(); + 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; + }, + + fromJSON(object: any): QueryVotesByVoterResponse { + return { + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesByVoterResponse): unknown { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => e ? Vote.toJSON(e) : undefined); + } else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryVotesByVoterResponse { + const message = createBaseQueryVotesByVoterResponse(); + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsByMemberRequest(): QueryGroupsByMemberRequest { + return { address: "", pagination: undefined }; +} + +export const QueryGroupsByMemberRequest = { + encode(message: QueryGroupsByMemberRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryGroupsByMemberRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByMemberRequest(); + 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; + }, + + fromJSON(object: any): QueryGroupsByMemberRequest { + return { + address: isSet(object.address) ? String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByMemberRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupsByMemberRequest { + const message = createBaseQueryGroupsByMemberRequest(); + message.address = object.address ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryGroupsByMemberResponse(): QueryGroupsByMemberResponse { + return { groups: [], pagination: undefined }; +} + +export const QueryGroupsByMemberResponse = { + encode(message: QueryGroupsByMemberResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryGroupsByMemberResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByMemberResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGroupsByMemberResponse { + return { + groups: Array.isArray(object?.groups) ? object.groups.map((e: any) => GroupInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGroupsByMemberResponse): unknown { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map((e) => e ? GroupInfo.toJSON(e) : undefined); + } else { + obj.groups = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryGroupsByMemberResponse { + const message = createBaseQueryGroupsByMemberResponse(); + message.groups = object.groups?.map((e) => GroupInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposal_id: "0" }; +} + +export const QueryTallyResultRequest = { + encode(message: QueryTallyResultRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +export const QueryTallyResultResponse = { + encode(message: QueryTallyResultResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = (object.tally !== undefined && object.tally !== null) + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, +}; + +/** Query is the cosmos.group.v1 Query service. */ +export interface Query { + /** GroupInfo queries group info based on group id. */ + GroupInfo(request: QueryGroupInfoRequest): Promise; + /** GroupPolicyInfo queries group policy info based on account address of group policy. */ + GroupPolicyInfo(request: QueryGroupPolicyInfoRequest): Promise; + /** GroupMembers queries members of a group */ + GroupMembers(request: QueryGroupMembersRequest): Promise; + /** GroupsByAdmin queries groups by admin address. */ + GroupsByAdmin(request: QueryGroupsByAdminRequest): Promise; + /** GroupPoliciesByGroup queries group policies by group id. */ + GroupPoliciesByGroup(request: QueryGroupPoliciesByGroupRequest): Promise; + /** GroupsByAdmin queries group policies by admin address. */ + GroupPoliciesByAdmin(request: QueryGroupPoliciesByAdminRequest): Promise; + /** Proposal queries a proposal based on proposal id. */ + Proposal(request: QueryProposalRequest): Promise; + /** ProposalsByGroupPolicy queries proposals based on account address of group policy. */ + ProposalsByGroupPolicy(request: QueryProposalsByGroupPolicyRequest): Promise; + /** VoteByProposalVoter queries a vote by proposal id and voter. */ + VoteByProposalVoter(request: QueryVoteByProposalVoterRequest): Promise; + /** VotesByProposal queries a vote by proposal. */ + VotesByProposal(request: QueryVotesByProposalRequest): Promise; + /** VotesByVoter queries a vote by voter. */ + VotesByVoter(request: QueryVotesByVoterRequest): Promise; + /** GroupsByMember queries groups by member address. */ + GroupsByMember(request: QueryGroupsByMemberRequest): Promise; + /** TallyResult queries the tally of a proposal votes. */ + TallyResult(request: QueryTallyResultRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.group.v1.Query"; + this.rpc = rpc; + this.GroupInfo = this.GroupInfo.bind(this); + this.GroupPolicyInfo = this.GroupPolicyInfo.bind(this); + this.GroupMembers = this.GroupMembers.bind(this); + this.GroupsByAdmin = this.GroupsByAdmin.bind(this); + this.GroupPoliciesByGroup = this.GroupPoliciesByGroup.bind(this); + this.GroupPoliciesByAdmin = this.GroupPoliciesByAdmin.bind(this); + this.Proposal = this.Proposal.bind(this); + this.ProposalsByGroupPolicy = this.ProposalsByGroupPolicy.bind(this); + this.VoteByProposalVoter = this.VoteByProposalVoter.bind(this); + this.VotesByProposal = this.VotesByProposal.bind(this); + this.VotesByVoter = this.VotesByVoter.bind(this); + this.GroupsByMember = this.GroupsByMember.bind(this); + this.TallyResult = this.TallyResult.bind(this); + } + GroupInfo(request: QueryGroupInfoRequest): Promise { + const data = QueryGroupInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupInfo", data); + return promise.then((data) => QueryGroupInfoResponse.decode(new _m0.Reader(data))); + } + + GroupPolicyInfo(request: QueryGroupPolicyInfoRequest): Promise { + const data = QueryGroupPolicyInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupPolicyInfo", data); + return promise.then((data) => QueryGroupPolicyInfoResponse.decode(new _m0.Reader(data))); + } + + GroupMembers(request: QueryGroupMembersRequest): Promise { + const data = QueryGroupMembersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupMembers", data); + return promise.then((data) => QueryGroupMembersResponse.decode(new _m0.Reader(data))); + } + + GroupsByAdmin(request: QueryGroupsByAdminRequest): Promise { + const data = QueryGroupsByAdminRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupsByAdmin", data); + return promise.then((data) => QueryGroupsByAdminResponse.decode(new _m0.Reader(data))); + } + + GroupPoliciesByGroup(request: QueryGroupPoliciesByGroupRequest): Promise { + const data = QueryGroupPoliciesByGroupRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupPoliciesByGroup", data); + return promise.then((data) => QueryGroupPoliciesByGroupResponse.decode(new _m0.Reader(data))); + } + + GroupPoliciesByAdmin(request: QueryGroupPoliciesByAdminRequest): Promise { + const data = QueryGroupPoliciesByAdminRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupPoliciesByAdmin", data); + return promise.then((data) => QueryGroupPoliciesByAdminResponse.decode(new _m0.Reader(data))); + } + + Proposal(request: QueryProposalRequest): Promise { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Proposal", data); + return promise.then((data) => QueryProposalResponse.decode(new _m0.Reader(data))); + } + + ProposalsByGroupPolicy(request: QueryProposalsByGroupPolicyRequest): Promise { + const data = QueryProposalsByGroupPolicyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ProposalsByGroupPolicy", data); + return promise.then((data) => QueryProposalsByGroupPolicyResponse.decode(new _m0.Reader(data))); + } + + VoteByProposalVoter(request: QueryVoteByProposalVoterRequest): Promise { + const data = QueryVoteByProposalVoterRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteByProposalVoter", data); + return promise.then((data) => QueryVoteByProposalVoterResponse.decode(new _m0.Reader(data))); + } + + VotesByProposal(request: QueryVotesByProposalRequest): Promise { + const data = QueryVotesByProposalRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VotesByProposal", data); + return promise.then((data) => QueryVotesByProposalResponse.decode(new _m0.Reader(data))); + } + + VotesByVoter(request: QueryVotesByVoterRequest): Promise { + const data = QueryVotesByVoterRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "VotesByVoter", data); + return promise.then((data) => QueryVotesByVoterResponse.decode(new _m0.Reader(data))); + } + + GroupsByMember(request: QueryGroupsByMemberRequest): Promise { + const data = QueryGroupsByMemberRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GroupsByMember", data); + return promise.then((data) => QueryGroupsByMemberResponse.decode(new _m0.Reader(data))); + } + + TallyResult(request: QueryTallyResultRequest): Promise { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TallyResult", data); + return promise.then((data) => QueryTallyResultResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/group/v1/tx.ts b/common/types/src/lcd/cosmos/group/v1/tx.ts new file mode 100644 index 00000000..2eb9ea22 --- /dev/null +++ b/common/types/src/lcd/cosmos/group/v1/tx.ts @@ -0,0 +1,2088 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Member, VoteOption, voteOptionFromJSON, voteOptionToJSON, voteOptionToNumber } from "./types"; + +export const protobufPackage = "cosmos.group.v1"; + +/** 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 = "EXEC_UNSPECIFIED", + /** + * 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 = "EXEC_TRY", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function execToNumber(object: Exec): number { + switch (object) { + case Exec.EXEC_UNSPECIFIED: + return 0; + case Exec.EXEC_TRY: + return 1; + case Exec.UNRECOGNIZED: + default: + return -1; + } +} + +/** 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: Member[]; + /** metadata is any arbitrary metadata to attached to the group. */ + metadata: string; +} + +/** MsgCreateGroupResponse is the Msg/CreateGroup response type. */ +export interface MsgCreateGroupResponse { + /** group_id is the unique ID of the newly created group. */ + group_id: string; +} + +/** 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. */ + group_id: string; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + member_updates: Member[]; +} + +/** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ +export interface MsgUpdateGroupMembersResponse { +} + +/** 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. */ + group_id: string; + /** new_admin is the group new admin account address. */ + new_admin: string; +} + +/** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ +export interface MsgUpdateGroupAdminResponse { +} + +/** 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. */ + group_id: string; + /** metadata is the updated group's metadata. */ + metadata: string; +} + +/** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ +export interface MsgUpdateGroupMetadataResponse { +} + +/** 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. */ + 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?: Any; +} + +/** MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. */ +export interface MsgCreateGroupPolicyResponse { + /** address is the account address of the newly created group policy. */ + address: string; +} + +/** MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. */ +export interface MsgUpdateGroupPolicyAdmin { + /** admin is the account address of the group admin. */ + admin: string; + /** address is the account address of the group policy. */ + address: string; + /** new_admin is the new group policy admin. */ + new_admin: string; +} + +/** 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: Member[]; + /** 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?: Any; +} + +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponse { + /** 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; +} + +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponse { +} + +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** address is the account address of group policy. */ + address: string; + /** decision_policy is the updated group policy's decision policy. */ + decision_policy?: Any; +} + +/** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ +export interface MsgUpdateGroupPolicyDecisionPolicyResponse { +} + +/** MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. */ +export interface MsgUpdateGroupPolicyMetadata { + /** admin is the account address of the group admin. */ + admin: string; + /** address is the account address of group policy. */ + address: string; + /** metadata is the updated group policy metadata. */ + metadata: string; +} + +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponse { +} + +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposal { + /** address is the account address of 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 to 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; +} + +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal is the unique ID of the proposal. */ + proposal_id: string; +} + +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposal { + /** 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; +} + +/** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ +export interface MsgWithdrawProposalResponse { +} + +/** MsgVote is the Msg/Vote request type. */ +export interface MsgVote { + /** 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 to attached to the vote. */ + metadata: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec: Exec; +} + +/** MsgVoteResponse is the Msg/Vote response type. */ +export interface MsgVoteResponse { +} + +/** MsgExec is the Msg/Exec request type. */ +export interface MsgExec { + /** proposal is the unique ID of the proposal. */ + proposal_id: string; + /** signer is the account address used to execute the proposal. */ + signer: string; +} + +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponse { +} + +/** 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. */ + group_id: string; +} + +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponse { +} + +function createBaseMsgCreateGroup(): MsgCreateGroup { + return { admin: "", members: [], metadata: "" }; +} + +export const MsgCreateGroup = { + encode(message: MsgCreateGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + Member.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroup { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(Member.decode(reader, reader.uint32())); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateGroup { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [], + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgCreateGroup): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + if (message.members) { + obj.members = message.members.map((e) => e ? Member.toJSON(e) : undefined); + } else { + obj.members = []; + } + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => Member.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { + return { group_id: "0" }; +} + +export const MsgCreateGroupResponse = { + encode(message: MsgCreateGroupResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupResponse { + return { group_id: isSet(object.group_id) ? String(object.group_id) : "0" }; + }, + + toJSON(message: MsgCreateGroupResponse): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + message.group_id = object.group_id ?? "0"; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { + return { admin: "", group_id: "0", member_updates: [] }; +} + +export const MsgUpdateGroupMembers = { + encode(message: MsgUpdateGroupMembers, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + for (const v of message.member_updates) { + Member.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMembers { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 3: + message.member_updates.push(Member.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMembers { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + member_updates: Array.isArray(object?.member_updates) + ? object.member_updates.map((e: any) => Member.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgUpdateGroupMembers): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.group_id !== undefined && (obj.group_id = message.group_id); + if (message.member_updates) { + obj.member_updates = message.member_updates.map((e) => e ? Member.toJSON(e) : undefined); + } else { + obj.member_updates = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + message.admin = object.admin ?? ""; + message.group_id = object.group_id ?? "0"; + message.member_updates = object.member_updates?.map((e) => Member.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { + return {}; +} + +export const MsgUpdateGroupMembersResponse = { + encode(_: MsgUpdateGroupMembersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupMembersResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMembersResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { + return { admin: "", group_id: "0", new_admin: "" }; +} + +export const MsgUpdateGroupAdmin = { + encode(message: MsgUpdateGroupAdmin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + if (message.new_admin !== "") { + writer.uint32(26).string(message.new_admin); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupAdmin { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 3: + message.new_admin = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupAdmin { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + new_admin: isSet(object.new_admin) ? String(object.new_admin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupAdmin): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.group_id !== undefined && (obj.group_id = message.group_id); + message.new_admin !== undefined && (obj.new_admin = message.new_admin); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + message.admin = object.admin ?? ""; + message.group_id = object.group_id ?? "0"; + message.new_admin = object.new_admin ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { + return {}; +} + +export const MsgUpdateGroupAdminResponse = { + encode(_: MsgUpdateGroupAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { + return { admin: "", group_id: "0", metadata: "" }; +} + +export const MsgUpdateGroupMetadata = { + encode(message: MsgUpdateGroupMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMetadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupMetadata { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupMetadata): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.group_id !== undefined && (obj.group_id = message.group_id); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + message.admin = object.admin ?? ""; + message.group_id = object.group_id ?? "0"; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { + return {}; +} + +export const MsgUpdateGroupMetadataResponse = { + encode(_: MsgUpdateGroupMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, +}; + +function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { + return { admin: "", group_id: "0", metadata: "", decision_policy: undefined }; +} + +export const MsgCreateGroupPolicy = { + encode(message: MsgCreateGroupPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.decision_policy !== undefined) { + Any.encode(message.decision_policy, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.decision_policy = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupPolicy { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + decision_policy: isSet(object.decision_policy) ? Any.fromJSON(object.decision_policy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupPolicy): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.group_id !== undefined && (obj.group_id = message.group_id); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.decision_policy !== undefined && + (obj.decision_policy = message.decision_policy ? Any.toJSON(message.decision_policy) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + message.admin = object.admin ?? ""; + message.group_id = object.group_id ?? "0"; + message.metadata = object.metadata ?? ""; + message.decision_policy = (object.decision_policy !== undefined && object.decision_policy !== null) + ? Any.fromPartial(object.decision_policy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { + return { address: "" }; +} + +export const MsgCreateGroupPolicyResponse = { + encode(message: MsgCreateGroupPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): MsgCreateGroupPolicyResponse { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: MsgCreateGroupPolicyResponse): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { + return { admin: "", address: "", new_admin: "" }; +} + +export const MsgUpdateGroupPolicyAdmin = { + encode(message: MsgUpdateGroupPolicyAdmin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.new_admin !== "") { + writer.uint32(26).string(message.new_admin); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address = reader.string(); + break; + case 3: + message.new_admin = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyAdmin { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + address: isSet(object.address) ? String(object.address) : "", + new_admin: isSet(object.new_admin) ? String(object.new_admin) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyAdmin): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.address !== undefined && (obj.address = message.address); + message.new_admin !== undefined && (obj.new_admin = message.new_admin); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + message.admin = object.admin ?? ""; + message.address = object.address ?? ""; + message.new_admin = object.new_admin ?? ""; + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { + return { + admin: "", + members: [], + group_metadata: "", + group_policy_metadata: "", + group_policy_as_admin: false, + decision_policy: undefined, + }; +} + +export const MsgCreateGroupWithPolicy = { + encode(message: MsgCreateGroupWithPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + Member.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.group_metadata !== "") { + writer.uint32(26).string(message.group_metadata); + } + if (message.group_policy_metadata !== "") { + writer.uint32(34).string(message.group_policy_metadata); + } + if (message.group_policy_as_admin === true) { + writer.uint32(40).bool(message.group_policy_as_admin); + } + if (message.decision_policy !== undefined) { + Any.encode(message.decision_policy, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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(Member.decode(reader, reader.uint32())); + break; + case 3: + message.group_metadata = reader.string(); + break; + case 4: + message.group_policy_metadata = reader.string(); + break; + case 5: + message.group_policy_as_admin = reader.bool(); + break; + case 6: + message.decision_policy = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicy { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [], + group_metadata: isSet(object.group_metadata) ? String(object.group_metadata) : "", + group_policy_metadata: isSet(object.group_policy_metadata) ? String(object.group_policy_metadata) : "", + group_policy_as_admin: isSet(object.group_policy_as_admin) ? Boolean(object.group_policy_as_admin) : false, + decision_policy: isSet(object.decision_policy) ? Any.fromJSON(object.decision_policy) : undefined, + }; + }, + + toJSON(message: MsgCreateGroupWithPolicy): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + if (message.members) { + obj.members = message.members.map((e) => e ? Member.toJSON(e) : undefined); + } else { + obj.members = []; + } + message.group_metadata !== undefined && (obj.group_metadata = message.group_metadata); + message.group_policy_metadata !== undefined && (obj.group_policy_metadata = message.group_policy_metadata); + message.group_policy_as_admin !== undefined && (obj.group_policy_as_admin = message.group_policy_as_admin); + message.decision_policy !== undefined && + (obj.decision_policy = message.decision_policy ? Any.toJSON(message.decision_policy) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + message.admin = object.admin ?? ""; + message.members = object.members?.map((e) => Member.fromPartial(e)) || []; + message.group_metadata = object.group_metadata ?? ""; + message.group_policy_metadata = object.group_policy_metadata ?? ""; + message.group_policy_as_admin = object.group_policy_as_admin ?? false; + message.decision_policy = (object.decision_policy !== undefined && object.decision_policy !== null) + ? Any.fromPartial(object.decision_policy) + : undefined; + return message; + }, +}; + +function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { + return { group_id: "0", group_policy_address: "" }; +} + +export const MsgCreateGroupWithPolicyResponse = { + encode(message: MsgCreateGroupWithPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + if (message.group_policy_address !== "") { + writer.uint32(18).string(message.group_policy_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 2: + message.group_policy_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateGroupWithPolicyResponse { + return { + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + group_policy_address: isSet(object.group_policy_address) ? String(object.group_policy_address) : "", + }; + }, + + toJSON(message: MsgCreateGroupWithPolicyResponse): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + message.group_policy_address !== undefined && (obj.group_policy_address = message.group_policy_address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + message.group_id = object.group_id ?? "0"; + message.group_policy_address = object.group_policy_address ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { + return {}; +} + +export const MsgUpdateGroupPolicyAdminResponse = { + encode(_: MsgUpdateGroupPolicyAdminResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyAdminResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { + return { admin: "", address: "", decision_policy: undefined }; +} + +export const MsgUpdateGroupPolicyDecisionPolicy = { + encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.decision_policy !== undefined) { + Any.encode(message.decision_policy, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address = reader.string(); + break; + case 3: + message.decision_policy = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyDecisionPolicy { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + address: isSet(object.address) ? String(object.address) : "", + decision_policy: isSet(object.decision_policy) ? Any.fromJSON(object.decision_policy) : undefined, + }; + }, + + toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.address !== undefined && (obj.address = message.address); + message.decision_policy !== undefined && + (obj.decision_policy = message.decision_policy ? Any.toJSON(message.decision_policy) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + message.admin = object.admin ?? ""; + message.address = object.address ?? ""; + message.decision_policy = (object.decision_policy !== undefined && object.decision_policy !== null) + ? Any.fromPartial(object.decision_policy) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; +} + +export const MsgUpdateGroupPolicyDecisionPolicyResponse = { + encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { + return { admin: "", address: "", metadata: "" }; +} + +export const MsgUpdateGroupPolicyMetadata = { + encode(message: MsgUpdateGroupPolicyMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateGroupPolicyMetadata { + return { + admin: isSet(object.admin) ? String(object.admin) : "", + address: isSet(object.address) ? String(object.address) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + + toJSON(message: MsgUpdateGroupPolicyMetadata): unknown { + const obj: any = {}; + message.admin !== undefined && (obj.admin = message.admin); + message.address !== undefined && (obj.address = message.address); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + message.admin = object.admin ?? ""; + message.address = object.address ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { + return {}; +} + +export const MsgUpdateGroupPolicyMetadataResponse = { + encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateGroupPolicyMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateGroupPolicyMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, +}; + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { address: "", proposers: [], metadata: "", messages: [], exec: Exec.EXEC_UNSPECIFIED }; +} + +export const MsgSubmitProposal = { + encode(message: MsgSubmitProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + 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 !== Exec.EXEC_UNSPECIFIED) { + writer.uint32(40).int32(execToNumber(message.exec)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.address = 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 = execFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + address: isSet(object.address) ? String(object.address) : "", + proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => String(e)) : [], + metadata: isSet(object.metadata) ? String(object.metadata) : "", + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + exec: isSet(object.exec) ? execFromJSON(object.exec) : Exec.EXEC_UNSPECIFIED, + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.proposers) { + obj.proposers = message.proposers.map((e) => e); + } else { + obj.proposers = []; + } + message.metadata !== undefined && (obj.metadata = message.metadata); + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + message.exec !== undefined && (obj.exec = execToJSON(message.exec)); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.address = object.address ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.metadata = object.metadata ?? ""; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.exec = object.exec ?? Exec.EXEC_UNSPECIFIED; + return message; + }, +}; + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposal_id: "0" }; +} + +export const MsgSubmitProposalResponse = { + encode(message: MsgSubmitProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposal_id = object.proposal_id ?? "0"; + return message; + }, +}; + +function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { + return { proposal_id: "0", address: "" }; +} + +export const MsgWithdrawProposal = { + encode(message: MsgWithdrawProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgWithdrawProposal { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + address: isSet(object.address) ? String(object.address) : "", + }; + }, + + toJSON(message: MsgWithdrawProposal): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + message.proposal_id = object.proposal_id ?? "0"; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { + return {}; +} + +export const MsgWithdrawProposalResponse = { + encode(_: MsgWithdrawProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgWithdrawProposalResponse { + return {}; + }, + + toJSON(_: MsgWithdrawProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, +}; + +function createBaseMsgVote(): MsgVote { + return { + proposal_id: "0", + voter: "", + option: VoteOption.VOTE_OPTION_UNSPECIFIED, + metadata: "", + exec: Exec.EXEC_UNSPECIFIED, + }; +} + +export const MsgVote = { + encode(message: MsgVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== VoteOption.VOTE_OPTION_UNSPECIFIED) { + writer.uint32(24).int32(voteOptionToNumber(message.option)); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.exec !== Exec.EXEC_UNSPECIFIED) { + writer.uint32(40).int32(execToNumber(message.exec)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = voteOptionFromJSON(reader.int32()); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.exec = execFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : VoteOption.VOTE_OPTION_UNSPECIFIED, + metadata: isSet(object.metadata) ? String(object.metadata) : "", + exec: isSet(object.exec) ? execFromJSON(object.exec) : Exec.EXEC_UNSPECIFIED, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.exec !== undefined && (obj.exec = execToJSON(message.exec)); + return obj; + }, + + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.option = object.option ?? VoteOption.VOTE_OPTION_UNSPECIFIED; + message.metadata = object.metadata ?? ""; + message.exec = object.exec ?? Exec.EXEC_UNSPECIFIED; + return message; + }, +}; + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +export const MsgVoteResponse = { + encode(_: MsgVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +function createBaseMsgExec(): MsgExec { + return { proposal_id: "0", signer: "" }; +} + +export const MsgExec = { + encode(message: MsgExec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + signer: isSet(object.signer) ? String(object.signer) : "", + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.proposal_id = object.proposal_id ?? "0"; + message.signer = object.signer ?? ""; + return message; + }, +}; + +function createBaseMsgExecResponse(): MsgExecResponse { + return {}; +} + +export const MsgExecResponse = { + encode(_: MsgExecResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgExecResponse { + return {}; + }, + + toJSON(_: MsgExecResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + return message; + }, +}; + +function createBaseMsgLeaveGroup(): MsgLeaveGroup { + return { address: "", group_id: "0" }; +} + +export const MsgLeaveGroup = { + encode(message: MsgLeaveGroup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeaveGroup { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgLeaveGroup { + return { + address: isSet(object.address) ? String(object.address) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + }; + }, + + toJSON(message: MsgLeaveGroup): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.group_id !== undefined && (obj.group_id = message.group_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + message.address = object.address ?? ""; + message.group_id = object.group_id ?? "0"; + return message; + }, +}; + +function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { + return {}; +} + +export const MsgLeaveGroupResponse = { + encode(_: MsgLeaveGroupResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeaveGroupResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgLeaveGroupResponse { + return {}; + }, + + toJSON(_: MsgLeaveGroupResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgLeaveGroupResponse { + const message = createBaseMsgLeaveGroupResponse(); + return message; + }, +}; + +/** Msg is the cosmos.group.v1 Msg service. */ +export interface Msg { + /** CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. */ + CreateGroup(request: MsgCreateGroup): Promise; + /** UpdateGroupMembers updates the group members with given group id and admin address. */ + UpdateGroupMembers(request: MsgUpdateGroupMembers): Promise; + /** UpdateGroupAdmin updates the group admin with given group id and previous admin address. */ + UpdateGroupAdmin(request: MsgUpdateGroupAdmin): Promise; + /** UpdateGroupMetadata updates the group metadata with given group id and admin address. */ + UpdateGroupMetadata(request: MsgUpdateGroupMetadata): Promise; + /** CreateGroupPolicy creates a new group policy using given DecisionPolicy. */ + CreateGroupPolicy(request: MsgCreateGroupPolicy): Promise; + /** CreateGroupWithPolicy creates a new group with policy. */ + CreateGroupWithPolicy(request: MsgCreateGroupWithPolicy): Promise; + /** UpdateGroupPolicyAdmin updates a group policy admin. */ + UpdateGroupPolicyAdmin(request: MsgUpdateGroupPolicyAdmin): Promise; + /** UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. */ + UpdateGroupPolicyDecisionPolicy( + request: MsgUpdateGroupPolicyDecisionPolicy, + ): Promise; + /** UpdateGroupPolicyMetadata updates a group policy metadata. */ + UpdateGroupPolicyMetadata(request: MsgUpdateGroupPolicyMetadata): Promise; + /** SubmitProposal submits a new proposal. */ + SubmitProposal(request: MsgSubmitProposal): Promise; + /** WithdrawProposal aborts a proposal. */ + WithdrawProposal(request: MsgWithdrawProposal): Promise; + /** Vote allows a voter to vote on a proposal. */ + Vote(request: MsgVote): Promise; + /** Exec executes a proposal. */ + Exec(request: MsgExec): Promise; + /** LeaveGroup allows a group member to leave the group. */ + LeaveGroup(request: MsgLeaveGroup): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.group.v1.Msg"; + this.rpc = rpc; + this.CreateGroup = this.CreateGroup.bind(this); + this.UpdateGroupMembers = this.UpdateGroupMembers.bind(this); + this.UpdateGroupAdmin = this.UpdateGroupAdmin.bind(this); + this.UpdateGroupMetadata = this.UpdateGroupMetadata.bind(this); + this.CreateGroupPolicy = this.CreateGroupPolicy.bind(this); + this.CreateGroupWithPolicy = this.CreateGroupWithPolicy.bind(this); + this.UpdateGroupPolicyAdmin = this.UpdateGroupPolicyAdmin.bind(this); + this.UpdateGroupPolicyDecisionPolicy = this.UpdateGroupPolicyDecisionPolicy.bind(this); + this.UpdateGroupPolicyMetadata = this.UpdateGroupPolicyMetadata.bind(this); + this.SubmitProposal = this.SubmitProposal.bind(this); + this.WithdrawProposal = this.WithdrawProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.Exec = this.Exec.bind(this); + this.LeaveGroup = this.LeaveGroup.bind(this); + } + CreateGroup(request: MsgCreateGroup): Promise { + const data = MsgCreateGroup.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateGroup", data); + return promise.then((data) => MsgCreateGroupResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupMembers(request: MsgUpdateGroupMembers): Promise { + const data = MsgUpdateGroupMembers.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupMembers", data); + return promise.then((data) => MsgUpdateGroupMembersResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupAdmin(request: MsgUpdateGroupAdmin): Promise { + const data = MsgUpdateGroupAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupAdmin", data); + return promise.then((data) => MsgUpdateGroupAdminResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupMetadata(request: MsgUpdateGroupMetadata): Promise { + const data = MsgUpdateGroupMetadata.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupMetadata", data); + return promise.then((data) => MsgUpdateGroupMetadataResponse.decode(new _m0.Reader(data))); + } + + CreateGroupPolicy(request: MsgCreateGroupPolicy): Promise { + const data = MsgCreateGroupPolicy.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateGroupPolicy", data); + return promise.then((data) => MsgCreateGroupPolicyResponse.decode(new _m0.Reader(data))); + } + + CreateGroupWithPolicy(request: MsgCreateGroupWithPolicy): Promise { + const data = MsgCreateGroupWithPolicy.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateGroupWithPolicy", data); + return promise.then((data) => MsgCreateGroupWithPolicyResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupPolicyAdmin(request: MsgUpdateGroupPolicyAdmin): Promise { + const data = MsgUpdateGroupPolicyAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupPolicyAdmin", data); + return promise.then((data) => MsgUpdateGroupPolicyAdminResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupPolicyDecisionPolicy( + request: MsgUpdateGroupPolicyDecisionPolicy, + ): Promise { + const data = MsgUpdateGroupPolicyDecisionPolicy.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupPolicyDecisionPolicy", data); + return promise.then((data) => MsgUpdateGroupPolicyDecisionPolicyResponse.decode(new _m0.Reader(data))); + } + + UpdateGroupPolicyMetadata(request: MsgUpdateGroupPolicyMetadata): Promise { + const data = MsgUpdateGroupPolicyMetadata.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateGroupPolicyMetadata", data); + return promise.then((data) => MsgUpdateGroupPolicyMetadataResponse.decode(new _m0.Reader(data))); + } + + SubmitProposal(request: MsgSubmitProposal): Promise { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitProposal", data); + return promise.then((data) => MsgSubmitProposalResponse.decode(new _m0.Reader(data))); + } + + WithdrawProposal(request: MsgWithdrawProposal): Promise { + const data = MsgWithdrawProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "WithdrawProposal", data); + return promise.then((data) => MsgWithdrawProposalResponse.decode(new _m0.Reader(data))); + } + + Vote(request: MsgVote): Promise { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request(this.service, "Vote", data); + return promise.then((data) => MsgVoteResponse.decode(new _m0.Reader(data))); + } + + Exec(request: MsgExec): Promise { + const data = MsgExec.encode(request).finish(); + const promise = this.rpc.request(this.service, "Exec", data); + return promise.then((data) => MsgExecResponse.decode(new _m0.Reader(data))); + } + + LeaveGroup(request: MsgLeaveGroup): Promise { + const data = MsgLeaveGroup.encode(request).finish(); + const promise = this.rpc.request(this.service, "LeaveGroup", data); + return promise.then((data) => MsgLeaveGroupResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/group/v1/types.ts b/common/types/src/lcd/cosmos/group/v1/types.ts new file mode 100644 index 00000000..be385da8 --- /dev/null +++ b/common/types/src/lcd/cosmos/group/v1/types.ts @@ -0,0 +1,1470 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.group.v1"; + +/** VoteOption enumerates the valid vote options for a given proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = "VOTE_OPTION_UNSPECIFIED", + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = "VOTE_OPTION_YES", + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = "VOTE_OPTION_ABSTAIN", + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = "VOTE_OPTION_NO", + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = "VOTE_OPTION_NO_WITH_VETO", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function voteOptionToNumber(object: VoteOption): number { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return 0; + case VoteOption.VOTE_OPTION_YES: + return 1; + case VoteOption.VOTE_OPTION_ABSTAIN: + return 2; + case VoteOption.VOTE_OPTION_NO: + return 3; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return 4; + case VoteOption.UNRECOGNIZED: + default: + return -1; + } +} + +/** ProposalStatus defines proposal statuses. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - An empty value is invalid and not allowed. */ + PROPOSAL_STATUS_UNSPECIFIED = "PROPOSAL_STATUS_UNSPECIFIED", + /** PROPOSAL_STATUS_SUBMITTED - Initial status of a proposal when persisted. */ + PROPOSAL_STATUS_SUBMITTED = "PROPOSAL_STATUS_SUBMITTED", + /** PROPOSAL_STATUS_CLOSED - Final status of a proposal when the final tally was executed. */ + PROPOSAL_STATUS_CLOSED = "PROPOSAL_STATUS_CLOSED", + /** PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group was modified before the final tally. */ + PROPOSAL_STATUS_ABORTED = "PROPOSAL_STATUS_ABORTED", + /** + * PROPOSAL_STATUS_WITHDRAWN - A proposal can be deleted before the voting start time by the owner. When this happens the final status + * is Withdrawn. + */ + PROPOSAL_STATUS_WITHDRAWN = "PROPOSAL_STATUS_WITHDRAWN", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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_CLOSED": + return ProposalStatus.PROPOSAL_STATUS_CLOSED; + case 3: + case "PROPOSAL_STATUS_ABORTED": + return ProposalStatus.PROPOSAL_STATUS_ABORTED; + case 4: + 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_CLOSED: + return "PROPOSAL_STATUS_CLOSED"; + case ProposalStatus.PROPOSAL_STATUS_ABORTED: + return "PROPOSAL_STATUS_ABORTED"; + case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: + return "PROPOSAL_STATUS_WITHDRAWN"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function proposalStatusToNumber(object: ProposalStatus): number { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return 0; + case ProposalStatus.PROPOSAL_STATUS_SUBMITTED: + return 1; + case ProposalStatus.PROPOSAL_STATUS_CLOSED: + return 2; + case ProposalStatus.PROPOSAL_STATUS_ABORTED: + return 3; + case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: + return 4; + case ProposalStatus.UNRECOGNIZED: + default: + return -1; + } +} + +/** ProposalResult defines types of proposal results. */ +export enum ProposalResult { + /** PROPOSAL_RESULT_UNSPECIFIED - An empty value is invalid and not allowed */ + PROPOSAL_RESULT_UNSPECIFIED = "PROPOSAL_RESULT_UNSPECIFIED", + /** PROPOSAL_RESULT_UNFINALIZED - Until a final tally has happened the status is unfinalized */ + PROPOSAL_RESULT_UNFINALIZED = "PROPOSAL_RESULT_UNFINALIZED", + /** PROPOSAL_RESULT_ACCEPTED - Final result of the tally */ + PROPOSAL_RESULT_ACCEPTED = "PROPOSAL_RESULT_ACCEPTED", + /** PROPOSAL_RESULT_REJECTED - Final result of the tally */ + PROPOSAL_RESULT_REJECTED = "PROPOSAL_RESULT_REJECTED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function proposalResultFromJSON(object: any): ProposalResult { + switch (object) { + case 0: + case "PROPOSAL_RESULT_UNSPECIFIED": + return ProposalResult.PROPOSAL_RESULT_UNSPECIFIED; + case 1: + case "PROPOSAL_RESULT_UNFINALIZED": + return ProposalResult.PROPOSAL_RESULT_UNFINALIZED; + case 2: + case "PROPOSAL_RESULT_ACCEPTED": + return ProposalResult.PROPOSAL_RESULT_ACCEPTED; + case 3: + case "PROPOSAL_RESULT_REJECTED": + return ProposalResult.PROPOSAL_RESULT_REJECTED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalResult.UNRECOGNIZED; + } +} + +export function proposalResultToJSON(object: ProposalResult): string { + switch (object) { + case ProposalResult.PROPOSAL_RESULT_UNSPECIFIED: + return "PROPOSAL_RESULT_UNSPECIFIED"; + case ProposalResult.PROPOSAL_RESULT_UNFINALIZED: + return "PROPOSAL_RESULT_UNFINALIZED"; + case ProposalResult.PROPOSAL_RESULT_ACCEPTED: + return "PROPOSAL_RESULT_ACCEPTED"; + case ProposalResult.PROPOSAL_RESULT_REJECTED: + return "PROPOSAL_RESULT_REJECTED"; + case ProposalResult.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function proposalResultToNumber(object: ProposalResult): number { + switch (object) { + case ProposalResult.PROPOSAL_RESULT_UNSPECIFIED: + return 0; + case ProposalResult.PROPOSAL_RESULT_UNFINALIZED: + return 1; + case ProposalResult.PROPOSAL_RESULT_ACCEPTED: + return 2; + case ProposalResult.PROPOSAL_RESULT_REJECTED: + return 3; + case ProposalResult.UNRECOGNIZED: + default: + return -1; + } +} + +/** ProposalExecutorResult defines types of proposal executor results. */ +export enum ProposalExecutorResult { + /** PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - An empty value is not allowed. */ + PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED", + /** PROPOSAL_EXECUTOR_RESULT_NOT_RUN - We have not yet run the executor. */ + PROPOSAL_EXECUTOR_RESULT_NOT_RUN = "PROPOSAL_EXECUTOR_RESULT_NOT_RUN", + /** PROPOSAL_EXECUTOR_RESULT_SUCCESS - The executor was successful and proposed action updated state. */ + PROPOSAL_EXECUTOR_RESULT_SUCCESS = "PROPOSAL_EXECUTOR_RESULT_SUCCESS", + /** PROPOSAL_EXECUTOR_RESULT_FAILURE - The executor returned an error and proposed action didn't update state. */ + PROPOSAL_EXECUTOR_RESULT_FAILURE = "PROPOSAL_EXECUTOR_RESULT_FAILURE", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function proposalExecutorResultToNumber(object: ProposalExecutorResult): number { + switch (object) { + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: + return 0; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN: + return 1; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS: + return 2; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE: + return 3; + case ProposalExecutorResult.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * Member represents a group member with an account address, + * non-zero weight and metadata. + */ +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 to attached to the member. */ + metadata: string; + /** added_at is a timestamp specifying when a member was added. */ + added_at?: Date; +} + +/** Members defines a repeated slice of Member objects. */ +export interface Members { + /** members is the list of members. */ + members: Member[]; +} + +/** ThresholdDecisionPolicy implements the DecisionPolicy interface */ +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; +} + +/** PercentageDecisionPolicy implements the DecisionPolicy interface */ +export interface PercentageDecisionPolicy { + /** percentage is the minimum percentage 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; +} + +/** 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. + */ + voting_period?: 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. + */ + min_execution_period?: Duration; +} + +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfo { + /** 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. */ + 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?: Date; +} + +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMember { + /** group_id is the unique ID of the group. */ + group_id: string; + /** member is the member data. */ + member?: Member; +} + +/** 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. */ + group_id: string; + /** admin is the account address of the group admin. */ + admin: string; + /** metadata is any arbitrary metadata to attached to the group policy. */ + 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?: Any; + /** created_at is a timestamp specifying when a group policy was created. */ + created_at?: Date; +} + +/** + * 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: string; + /** address is the account address of group policy. */ + address: string; + /** metadata is any arbitrary metadata to attached to the proposal. */ + 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?: Date; + /** + * group_version tracks the version of the group that this proposal corresponds to. + * When group membership is changed, existing proposals from previous group versions will become invalid. + */ + group_version: string; + /** + * group_policy_version tracks the version of the group policy that this proposal corresponds to. + * When a decision policy is changed, existing proposals from previous policy versions will become invalid. + */ + group_policy_version: string; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status: ProposalStatus; + /** + * result is the final result based on the votes and election rule. Initial value is unfinalized. + * The result is persisted so that clients can always rely on this state and not have to replicate the logic. + */ + result: ProposalResult; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option, after tallying. When querying a proposal + * via gRPC, this field is not populated until the proposal's voting period + * has ended. + */ + final_tally_result?: TallyResult; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successfull 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`, as well + * as `status` and `result` fields will be accordingly updated. + */ + voting_period_end?: Date; + /** executor_result is the final result based on the votes and election rule. Initial value is NotRun. */ + executor_result: ProposalExecutorResult; + /** messages is a list of Msgs that will be executed if the proposal passes. */ + messages: Any[]; +} + +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResult { + /** yes_count is the weighted sum of yes votes. */ + yes_count: string; + /** abstain_count is the weighted sum of abstainers. */ + abstain_count: string; + /** no 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; +} + +/** Vote represents a vote for a proposal. */ +export interface Vote { + /** 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 to attached to the vote. */ + metadata: string; + /** submit_time is the timestamp when the vote was submitted. */ + submit_time?: Date; +} + +function createBaseMember(): Member { + return { address: "", weight: "", metadata: "", added_at: undefined }; +} + +export const Member = { + encode(message: Member, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.added_at !== undefined) { + Timestamp.encode(toTimestamp(message.added_at), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Member { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.added_at = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Member { + return { + address: isSet(object.address) ? String(object.address) : "", + weight: isSet(object.weight) ? String(object.weight) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + added_at: isSet(object.added_at) ? fromJsonTimestamp(object.added_at) : undefined, + }; + }, + + toJSON(message: Member): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.weight !== undefined && (obj.weight = message.weight); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.added_at !== undefined && (obj.added_at = message.added_at.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): Member { + const message = createBaseMember(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + message.added_at = object.added_at ?? undefined; + return message; + }, +}; + +function createBaseMembers(): Members { + return { members: [] }; +} + +export const Members = { + encode(message: Members, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.members) { + Member.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Members { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMembers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.members.push(Member.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Members { + return { members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [] }; + }, + + toJSON(message: Members): unknown { + const obj: any = {}; + if (message.members) { + obj.members = message.members.map((e) => e ? Member.toJSON(e) : undefined); + } else { + obj.members = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Members { + const message = createBaseMembers(); + message.members = object.members?.map((e) => Member.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { + return { threshold: "", windows: undefined }; +} + +export const ThresholdDecisionPolicy = { + encode(message: ThresholdDecisionPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): ThresholdDecisionPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ThresholdDecisionPolicy { + return { + threshold: isSet(object.threshold) ? String(object.threshold) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: ThresholdDecisionPolicy): unknown { + const obj: any = {}; + message.threshold !== undefined && (obj.threshold = message.threshold); + message.windows !== undefined && + (obj.windows = message.windows ? DecisionPolicyWindows.toJSON(message.windows) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): ThresholdDecisionPolicy { + const message = createBaseThresholdDecisionPolicy(); + message.threshold = object.threshold ?? ""; + message.windows = (object.windows !== undefined && object.windows !== null) + ? DecisionPolicyWindows.fromPartial(object.windows) + : undefined; + return message; + }, +}; + +function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { + return { percentage: "", windows: undefined }; +} + +export const PercentageDecisionPolicy = { + encode(message: PercentageDecisionPolicy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): PercentageDecisionPolicy { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PercentageDecisionPolicy { + return { + percentage: isSet(object.percentage) ? String(object.percentage) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined, + }; + }, + + toJSON(message: PercentageDecisionPolicy): unknown { + const obj: any = {}; + message.percentage !== undefined && (obj.percentage = message.percentage); + message.windows !== undefined && + (obj.windows = message.windows ? DecisionPolicyWindows.toJSON(message.windows) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): PercentageDecisionPolicy { + const message = createBasePercentageDecisionPolicy(); + message.percentage = object.percentage ?? ""; + message.windows = (object.windows !== undefined && object.windows !== null) + ? DecisionPolicyWindows.fromPartial(object.windows) + : undefined; + return message; + }, +}; + +function createBaseDecisionPolicyWindows(): DecisionPolicyWindows { + return { voting_period: undefined, min_execution_period: undefined }; +} + +export const DecisionPolicyWindows = { + encode(message: DecisionPolicyWindows, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.voting_period !== undefined) { + Duration.encode(message.voting_period, writer.uint32(10).fork()).ldelim(); + } + if (message.min_execution_period !== undefined) { + Duration.encode(message.min_execution_period, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecisionPolicyWindows { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.voting_period = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.min_execution_period = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DecisionPolicyWindows { + return { + voting_period: isSet(object.voting_period) ? Duration.fromJSON(object.voting_period) : undefined, + min_execution_period: isSet(object.min_execution_period) + ? Duration.fromJSON(object.min_execution_period) + : undefined, + }; + }, + + toJSON(message: DecisionPolicyWindows): unknown { + const obj: any = {}; + message.voting_period !== undefined && + (obj.voting_period = message.voting_period ? Duration.toJSON(message.voting_period) : undefined); + message.min_execution_period !== undefined && (obj.min_execution_period = message.min_execution_period + ? Duration.toJSON(message.min_execution_period) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + message.voting_period = (object.voting_period !== undefined && object.voting_period !== null) + ? Duration.fromPartial(object.voting_period) + : undefined; + message.min_execution_period = (object.min_execution_period !== undefined && object.min_execution_period !== null) + ? Duration.fromPartial(object.min_execution_period) + : undefined; + return message; + }, +}; + +function createBaseGroupInfo(): GroupInfo { + return { id: "0", admin: "", metadata: "", version: "0", total_weight: "", created_at: undefined }; +} + +export const GroupInfo = { + encode(message: GroupInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "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 !== "0") { + writer.uint32(32).uint64(message.version); + } + if (message.total_weight !== "") { + writer.uint32(42).string(message.total_weight); + } + if (message.created_at !== undefined) { + Timestamp.encode(toTimestamp(message.created_at), writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GroupInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.admin = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.version = longToString(reader.uint64() as Long); + break; + case 5: + message.total_weight = reader.string(); + break; + case 6: + message.created_at = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GroupInfo { + return { + id: isSet(object.id) ? String(object.id) : "0", + admin: isSet(object.admin) ? String(object.admin) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + version: isSet(object.version) ? String(object.version) : "0", + total_weight: isSet(object.total_weight) ? String(object.total_weight) : "", + created_at: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined, + }; + }, + + toJSON(message: GroupInfo): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.admin !== undefined && (obj.admin = message.admin); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.version !== undefined && (obj.version = message.version); + message.total_weight !== undefined && (obj.total_weight = message.total_weight); + message.created_at !== undefined && (obj.created_at = message.created_at.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): GroupInfo { + const message = createBaseGroupInfo(); + message.id = object.id ?? "0"; + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version ?? "0"; + message.total_weight = object.total_weight ?? ""; + message.created_at = object.created_at ?? undefined; + return message; + }, +}; + +function createBaseGroupMember(): GroupMember { + return { group_id: "0", member: undefined }; +} + +export const GroupMember = { + encode(message: GroupMember, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.group_id !== "0") { + writer.uint32(8).uint64(message.group_id); + } + if (message.member !== undefined) { + Member.encode(message.member, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GroupMember { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 2: + message.member = Member.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GroupMember { + return { + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + member: isSet(object.member) ? Member.fromJSON(object.member) : undefined, + }; + }, + + toJSON(message: GroupMember): unknown { + const obj: any = {}; + message.group_id !== undefined && (obj.group_id = message.group_id); + message.member !== undefined && (obj.member = message.member ? Member.toJSON(message.member) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GroupMember { + const message = createBaseGroupMember(); + message.group_id = object.group_id ?? "0"; + message.member = (object.member !== undefined && object.member !== null) + ? Member.fromPartial(object.member) + : undefined; + return message; + }, +}; + +function createBaseGroupPolicyInfo(): GroupPolicyInfo { + return { + address: "", + group_id: "0", + admin: "", + metadata: "", + version: "0", + decision_policy: undefined, + created_at: undefined, + }; +} + +export const GroupPolicyInfo = { + encode(message: GroupPolicyInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.group_id !== "0") { + writer.uint32(16).uint64(message.group_id); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.version !== "0") { + writer.uint32(40).uint64(message.version); + } + if (message.decision_policy !== undefined) { + Any.encode(message.decision_policy, writer.uint32(50).fork()).ldelim(); + } + if (message.created_at !== undefined) { + Timestamp.encode(toTimestamp(message.created_at), writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GroupPolicyInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.group_id = longToString(reader.uint64() as Long); + break; + case 3: + message.admin = reader.string(); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.version = longToString(reader.uint64() as Long); + break; + case 6: + message.decision_policy = Any.decode(reader, reader.uint32()); + break; + case 7: + message.created_at = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GroupPolicyInfo { + return { + address: isSet(object.address) ? String(object.address) : "", + group_id: isSet(object.group_id) ? String(object.group_id) : "0", + admin: isSet(object.admin) ? String(object.admin) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + version: isSet(object.version) ? String(object.version) : "0", + decision_policy: isSet(object.decision_policy) ? Any.fromJSON(object.decision_policy) : undefined, + created_at: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined, + }; + }, + + toJSON(message: GroupPolicyInfo): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.group_id !== undefined && (obj.group_id = message.group_id); + message.admin !== undefined && (obj.admin = message.admin); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.version !== undefined && (obj.version = message.version); + message.decision_policy !== undefined && + (obj.decision_policy = message.decision_policy ? Any.toJSON(message.decision_policy) : undefined); + message.created_at !== undefined && (obj.created_at = message.created_at.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + message.address = object.address ?? ""; + message.group_id = object.group_id ?? "0"; + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version ?? "0"; + message.decision_policy = (object.decision_policy !== undefined && object.decision_policy !== null) + ? Any.fromPartial(object.decision_policy) + : undefined; + message.created_at = object.created_at ?? undefined; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + id: "0", + address: "", + metadata: "", + proposers: [], + submit_time: undefined, + group_version: "0", + group_policy_version: "0", + status: ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED, + result: ProposalResult.PROPOSAL_RESULT_UNSPECIFIED, + final_tally_result: undefined, + voting_period_end: undefined, + executor_result: ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED, + messages: [], + }; +} + +export const Proposal = { + encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.proposers) { + writer.uint32(34).string(v!); + } + if (message.submit_time !== undefined) { + Timestamp.encode(toTimestamp(message.submit_time), writer.uint32(42).fork()).ldelim(); + } + if (message.group_version !== "0") { + writer.uint32(48).uint64(message.group_version); + } + if (message.group_policy_version !== "0") { + writer.uint32(56).uint64(message.group_policy_version); + } + if (message.status !== ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED) { + writer.uint32(64).int32(proposalStatusToNumber(message.status)); + } + if (message.result !== ProposalResult.PROPOSAL_RESULT_UNSPECIFIED) { + writer.uint32(72).int32(proposalResultToNumber(message.result)); + } + if (message.final_tally_result !== undefined) { + TallyResult.encode(message.final_tally_result, writer.uint32(82).fork()).ldelim(); + } + if (message.voting_period_end !== undefined) { + Timestamp.encode(toTimestamp(message.voting_period_end), writer.uint32(90).fork()).ldelim(); + } + if (message.executor_result !== ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED) { + writer.uint32(96).int32(proposalExecutorResultToNumber(message.executor_result)); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(106).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.proposers.push(reader.string()); + break; + case 5: + message.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.group_version = longToString(reader.uint64() as Long); + break; + case 7: + message.group_policy_version = longToString(reader.uint64() as Long); + break; + case 8: + message.status = proposalStatusFromJSON(reader.int32()); + break; + case 9: + message.result = proposalResultFromJSON(reader.int32()); + break; + case 10: + message.final_tally_result = TallyResult.decode(reader, reader.uint32()); + break; + case 11: + message.voting_period_end = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 12: + message.executor_result = proposalExecutorResultFromJSON(reader.int32()); + break; + case 13: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? String(object.id) : "0", + address: isSet(object.address) ? String(object.address) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => String(e)) : [], + submit_time: isSet(object.submit_time) ? fromJsonTimestamp(object.submit_time) : undefined, + group_version: isSet(object.group_version) ? String(object.group_version) : "0", + group_policy_version: isSet(object.group_policy_version) ? String(object.group_policy_version) : "0", + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED, + result: isSet(object.result) ? proposalResultFromJSON(object.result) : ProposalResult.PROPOSAL_RESULT_UNSPECIFIED, + final_tally_result: isSet(object.final_tally_result) + ? TallyResult.fromJSON(object.final_tally_result) + : undefined, + voting_period_end: isSet(object.voting_period_end) ? fromJsonTimestamp(object.voting_period_end) : undefined, + executor_result: isSet(object.executor_result) + ? proposalExecutorResultFromJSON(object.executor_result) + : ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED, + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.address !== undefined && (obj.address = message.address); + message.metadata !== undefined && (obj.metadata = message.metadata); + if (message.proposers) { + obj.proposers = message.proposers.map((e) => e); + } else { + obj.proposers = []; + } + message.submit_time !== undefined && (obj.submit_time = message.submit_time.toISOString()); + message.group_version !== undefined && (obj.group_version = message.group_version); + message.group_policy_version !== undefined && (obj.group_policy_version = message.group_policy_version); + message.status !== undefined && (obj.status = proposalStatusToJSON(message.status)); + message.result !== undefined && (obj.result = proposalResultToJSON(message.result)); + message.final_tally_result !== undefined && + (obj.final_tally_result = message.final_tally_result + ? TallyResult.toJSON(message.final_tally_result) + : undefined); + message.voting_period_end !== undefined && (obj.voting_period_end = message.voting_period_end.toISOString()); + message.executor_result !== undefined && + (obj.executor_result = proposalExecutorResultToJSON(message.executor_result)); + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.id = object.id ?? "0"; + message.address = object.address ?? ""; + message.metadata = object.metadata ?? ""; + message.proposers = object.proposers?.map((e) => e) || []; + message.submit_time = object.submit_time ?? undefined; + message.group_version = object.group_version ?? "0"; + message.group_policy_version = object.group_policy_version ?? "0"; + message.status = object.status ?? ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + message.result = object.result ?? ProposalResult.PROPOSAL_RESULT_UNSPECIFIED; + message.final_tally_result = (object.final_tally_result !== undefined && object.final_tally_result !== null) + ? TallyResult.fromPartial(object.final_tally_result) + : undefined; + message.voting_period_end = object.voting_period_end ?? undefined; + message.executor_result = object.executor_result ?? ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseTallyResult(): TallyResult { + return { yes_count: "", abstain_count: "", no_count: "", no_with_veto_count: "" }; +} + +export const TallyResult = { + encode(message: TallyResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.yes_count !== "") { + writer.uint32(10).string(message.yes_count); + } + if (message.abstain_count !== "") { + writer.uint32(18).string(message.abstain_count); + } + if (message.no_count !== "") { + writer.uint32(26).string(message.no_count); + } + if (message.no_with_veto_count !== "") { + writer.uint32(34).string(message.no_with_veto_count); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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_count = reader.string(); + break; + case 2: + message.abstain_count = reader.string(); + break; + case 3: + message.no_count = reader.string(); + break; + case 4: + message.no_with_veto_count = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes_count: isSet(object.yes_count) ? String(object.yes_count) : "", + abstain_count: isSet(object.abstain_count) ? String(object.abstain_count) : "", + no_count: isSet(object.no_count) ? String(object.no_count) : "", + no_with_veto_count: isSet(object.no_with_veto_count) ? String(object.no_with_veto_count) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + message.yes_count !== undefined && (obj.yes_count = message.yes_count); + message.abstain_count !== undefined && (obj.abstain_count = message.abstain_count); + message.no_count !== undefined && (obj.no_count = message.no_count); + message.no_with_veto_count !== undefined && (obj.no_with_veto_count = message.no_with_veto_count); + return obj; + }, + + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes_count = object.yes_count ?? ""; + message.abstain_count = object.abstain_count ?? ""; + message.no_count = object.no_count ?? ""; + message.no_with_veto_count = object.no_with_veto_count ?? ""; + return message; + }, +}; + +function createBaseVote(): Vote { + return { + proposal_id: "0", + voter: "", + option: VoteOption.VOTE_OPTION_UNSPECIFIED, + metadata: "", + submit_time: undefined, + }; +} + +export const Vote = { + encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.proposal_id !== "0") { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== VoteOption.VOTE_OPTION_UNSPECIFIED) { + writer.uint32(24).int32(voteOptionToNumber(message.option)); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.submit_time !== undefined) { + Timestamp.encode(toTimestamp(message.submit_time), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Vote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.proposal_id = longToString(reader.uint64() as Long); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = voteOptionFromJSON(reader.int32()); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : VoteOption.VOTE_OPTION_UNSPECIFIED, + metadata: isSet(object.metadata) ? String(object.metadata) : "", + submit_time: isSet(object.submit_time) ? fromJsonTimestamp(object.submit_time) : undefined, + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.submit_time !== undefined && (obj.submit_time = message.submit_time.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposal_id = object.proposal_id ?? "0"; + message.voter = object.voter ?? ""; + message.option = object.option ?? VoteOption.VOTE_OPTION_UNSPECIFIED; + message.metadata = object.metadata ?? ""; + message.submit_time = object.submit_time ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/mint/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/mint/v1beta1/genesis.ts new file mode 100644 index 00000000..b1725bfe --- /dev/null +++ b/common/types/src/lcd/cosmos/mint/v1beta1/genesis.ts @@ -0,0 +1,90 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Minter, Params } from "./mint"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** GenesisState defines the mint module's genesis state. */ +export interface GenesisState { + /** minter is a space for holding current inflation information. */ + minter?: Minter; + /** params defines all the paramaters of the module. */ + params?: Params; +} + +function createBaseGenesisState(): GenesisState { + return { minter: undefined, params: undefined }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(10).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minter = Minter.decode(reader, reader.uint32()); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + minter: isSet(object.minter) ? Minter.fromJSON(object.minter) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.minter !== undefined && (obj.minter = message.minter ? Minter.toJSON(message.minter) : undefined); + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.minter = (object.minter !== undefined && object.minter !== null) + ? Minter.fromPartial(object.minter) + : undefined; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/mint/v1beta1/mint.ts b/common/types/src/lcd/cosmos/mint/v1beta1/mint.ts new file mode 100644 index 00000000..2606feac --- /dev/null +++ b/common/types/src/lcd/cosmos/mint/v1beta1/mint.ts @@ -0,0 +1,212 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** Minter represents the minting state. */ +export interface Minter { + /** current annual inflation rate */ + inflation: string; + /** current annual expected provisions */ + annual_provisions: string; +} + +/** Params holds parameters for the mint module. */ +export interface Params { + /** type of coin to mint */ + mint_denom: string; + /** maximum annual change in inflation rate */ + inflation_rate_change: string; + /** maximum inflation rate */ + inflation_max: string; + /** minimum inflation rate */ + inflation_min: string; + /** goal of percent bonded atoms */ + goal_bonded: string; + /** expected blocks per year */ + blocks_per_year: string; +} + +function createBaseMinter(): Minter { + return { inflation: "", annual_provisions: "" }; +} + +export const Minter = { + encode(message: Minter, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.inflation !== "") { + writer.uint32(10).string(message.inflation); + } + if (message.annual_provisions !== "") { + writer.uint32(18).string(message.annual_provisions); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Minter { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMinter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inflation = reader.string(); + break; + case 2: + message.annual_provisions = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Minter { + return { + inflation: isSet(object.inflation) ? String(object.inflation) : "", + annual_provisions: isSet(object.annual_provisions) ? String(object.annual_provisions) : "", + }; + }, + + toJSON(message: Minter): unknown { + const obj: any = {}; + message.inflation !== undefined && (obj.inflation = message.inflation); + message.annual_provisions !== undefined && (obj.annual_provisions = message.annual_provisions); + return obj; + }, + + fromPartial, I>>(object: I): Minter { + const message = createBaseMinter(); + message.inflation = object.inflation ?? ""; + message.annual_provisions = object.annual_provisions ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { + mint_denom: "", + inflation_rate_change: "", + inflation_max: "", + inflation_min: "", + goal_bonded: "", + blocks_per_year: "0", + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.mint_denom !== "") { + writer.uint32(10).string(message.mint_denom); + } + if (message.inflation_rate_change !== "") { + writer.uint32(18).string(message.inflation_rate_change); + } + if (message.inflation_max !== "") { + writer.uint32(26).string(message.inflation_max); + } + if (message.inflation_min !== "") { + writer.uint32(34).string(message.inflation_min); + } + if (message.goal_bonded !== "") { + writer.uint32(42).string(message.goal_bonded); + } + if (message.blocks_per_year !== "0") { + writer.uint32(48).uint64(message.blocks_per_year); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.mint_denom = reader.string(); + break; + case 2: + message.inflation_rate_change = reader.string(); + break; + case 3: + message.inflation_max = reader.string(); + break; + case 4: + message.inflation_min = reader.string(); + break; + case 5: + message.goal_bonded = reader.string(); + break; + case 6: + message.blocks_per_year = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + mint_denom: isSet(object.mint_denom) ? String(object.mint_denom) : "", + inflation_rate_change: isSet(object.inflation_rate_change) ? String(object.inflation_rate_change) : "", + inflation_max: isSet(object.inflation_max) ? String(object.inflation_max) : "", + inflation_min: isSet(object.inflation_min) ? String(object.inflation_min) : "", + goal_bonded: isSet(object.goal_bonded) ? String(object.goal_bonded) : "", + blocks_per_year: isSet(object.blocks_per_year) ? String(object.blocks_per_year) : "0", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.mint_denom !== undefined && (obj.mint_denom = message.mint_denom); + message.inflation_rate_change !== undefined && (obj.inflation_rate_change = message.inflation_rate_change); + message.inflation_max !== undefined && (obj.inflation_max = message.inflation_max); + message.inflation_min !== undefined && (obj.inflation_min = message.inflation_min); + message.goal_bonded !== undefined && (obj.goal_bonded = message.goal_bonded); + message.blocks_per_year !== undefined && (obj.blocks_per_year = message.blocks_per_year); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.mint_denom = object.mint_denom ?? ""; + message.inflation_rate_change = object.inflation_rate_change ?? ""; + message.inflation_max = object.inflation_max ?? ""; + message.inflation_min = object.inflation_min ?? ""; + message.goal_bonded = object.goal_bonded ?? ""; + message.blocks_per_year = object.blocks_per_year ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/mint/v1beta1/query.ts b/common/types/src/lcd/cosmos/mint/v1beta1/query.ts new file mode 100644 index 00000000..20642bf4 --- /dev/null +++ b/common/types/src/lcd/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,414 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./mint"; + +export const protobufPackage = "cosmos.mint.v1beta1"; + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +/** QueryInflationRequest is the request type for the Query/Inflation RPC method. */ +export interface QueryInflationRequest { +} + +/** + * QueryInflationResponse is the response type for the Query/Inflation RPC + * method. + */ +export interface QueryInflationResponse { + /** inflation is the current minting inflation value. */ + inflation: Uint8Array; +} + +/** + * QueryAnnualProvisionsRequest is the request type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsRequest { +} + +/** + * QueryAnnualProvisionsResponse is the response type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsResponse { + /** annual_provisions is the current minting annual provisions value. */ + annual_provisions: Uint8Array; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQueryInflationRequest(): QueryInflationRequest { + return {}; +} + +export const QueryInflationRequest = { + encode(_: QueryInflationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryInflationRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryInflationRequest { + return {}; + }, + + toJSON(_: QueryInflationRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, +}; + +function createBaseQueryInflationResponse(): QueryInflationResponse { + return { inflation: new Uint8Array() }; +} + +export const QueryInflationResponse = { + encode(message: QueryInflationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.inflation.length !== 0) { + writer.uint32(10).bytes(message.inflation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryInflationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inflation = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryInflationResponse { + return { inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array() }; + }, + + toJSON(message: QueryInflationResponse): unknown { + const obj: any = {}; + message.inflation !== undefined && + (obj.inflation = base64FromBytes(message.inflation !== undefined ? message.inflation : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + message.inflation = object.inflation ?? new Uint8Array(); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { + return {}; +} + +export const QueryAnnualProvisionsRequest = { + encode(_: QueryAnnualProvisionsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAnnualProvisionsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryAnnualProvisionsRequest { + return {}; + }, + + toJSON(_: QueryAnnualProvisionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, +}; + +function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { + return { annual_provisions: new Uint8Array() }; +} + +export const QueryAnnualProvisionsResponse = { + encode(message: QueryAnnualProvisionsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.annual_provisions.length !== 0) { + writer.uint32(10).bytes(message.annual_provisions); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAnnualProvisionsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.annual_provisions = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAnnualProvisionsResponse { + return { + annual_provisions: isSet(object.annual_provisions) ? bytesFromBase64(object.annual_provisions) : new Uint8Array(), + }; + }, + + toJSON(message: QueryAnnualProvisionsResponse): unknown { + const obj: any = {}; + message.annual_provisions !== undefined && + (obj.annual_provisions = base64FromBytes( + message.annual_provisions !== undefined ? message.annual_provisions : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + message.annual_provisions = object.annual_provisions ?? new Uint8Array(); + return message; + }, +}; + +/** Query provides defines the gRPC querier service. */ +export interface Query { + /** Params returns the total set of minting parameters. */ + Params(request: QueryParamsRequest): Promise; + /** Inflation returns the current minting inflation value. */ + Inflation(request: QueryInflationRequest): Promise; + /** AnnualProvisions current minting annual provisions value. */ + AnnualProvisions(request: QueryAnnualProvisionsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.mint.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Inflation = this.Inflation.bind(this); + this.AnnualProvisions = this.AnnualProvisions.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + Inflation(request: QueryInflationRequest): Promise { + const data = QueryInflationRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Inflation", data); + return promise.then((data) => QueryInflationResponse.decode(new _m0.Reader(data))); + } + + AnnualProvisions(request: QueryAnnualProvisionsRequest): Promise { + const data = QueryAnnualProvisionsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AnnualProvisions", data); + return promise.then((data) => QueryAnnualProvisionsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/msg/v1/msg.ts b/common/types/src/lcd/cosmos/msg/v1/msg.ts new file mode 100644 index 00000000..093dfbba --- /dev/null +++ b/common/types/src/lcd/cosmos/msg/v1/msg.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export const protobufPackage = "cosmos.msg.v1"; diff --git a/common/types/src/lcd/cosmos/nft/v1beta1/event.ts b/common/types/src/lcd/cosmos/nft/v1beta1/event.ts new file mode 100644 index 00000000..ce6086aa --- /dev/null +++ b/common/types/src/lcd/cosmos/nft/v1beta1/event.ts @@ -0,0 +1,251 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** EventSend is emitted on Msg/Send */ +export interface EventSend { + class_id: string; + id: string; + sender: string; + receiver: string; +} + +/** EventMint is emitted on Mint */ +export interface EventMint { + class_id: string; + id: string; + owner: string; +} + +/** EventBurn is emitted on Burn */ +export interface EventBurn { + class_id: string; + id: string; + owner: string; +} + +function createBaseEventSend(): EventSend { + return { class_id: "", id: "", sender: "", receiver: "" }; +} + +export const EventSend = { + encode(message: EventSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(34).string(message.receiver); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventSend { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.sender = reader.string(); + break; + case 4: + message.receiver = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventSend { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + sender: isSet(object.sender) ? String(object.sender) : "", + receiver: isSet(object.receiver) ? String(object.receiver) : "", + }; + }, + + toJSON(message: EventSend): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + message.sender !== undefined && (obj.sender = message.sender); + message.receiver !== undefined && (obj.receiver = message.receiver); + return obj; + }, + + fromPartial, I>>(object: I): EventSend { + const message = createBaseEventSend(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseEventMint(): EventMint { + return { class_id: "", id: "", owner: "" }; +} + +export const EventMint = { + encode(message: EventMint, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventMint { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.owner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventMint { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + }; + }, + + toJSON(message: EventMint): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + message.owner !== undefined && (obj.owner = message.owner); + return obj; + }, + + fromPartial, I>>(object: I): EventMint { + const message = createBaseEventMint(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseEventBurn(): EventBurn { + return { class_id: "", id: "", owner: "" }; +} + +export const EventBurn = { + encode(message: EventBurn, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventBurn { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.owner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventBurn { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + }; + }, + + toJSON(message: EventBurn): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + message.owner !== undefined && (obj.owner = message.owner); + return obj; + }, + + fromPartial, I>>(object: I): EventBurn { + const message = createBaseEventBurn(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/nft/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/nft/v1beta1/genesis.ts new file mode 100644 index 00000000..6257458c --- /dev/null +++ b/common/types/src/lcd/cosmos/nft/v1beta1/genesis.ts @@ -0,0 +1,163 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Class, NFT } from "./nft"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** GenesisState defines the nft module's genesis state. */ +export interface GenesisState { + /** class defines the class of the nft type. */ + classes: Class[]; + entries: Entry[]; +} + +/** Entry Defines all nft owned by a person */ +export interface Entry { + /** owner is the owner address of the following nft */ + owner: string; + /** nfts is a group of nfts of the same owner */ + nfts: NFT[]; +} + +function createBaseGenesisState(): GenesisState { + return { classes: [], entries: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.entries) { + Entry.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.classes.push(Class.decode(reader, reader.uint32())); + break; + case 2: + message.entries.push(Entry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + classes: Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => Entry.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.classes) { + obj.classes = message.classes.map((e) => e ? Class.toJSON(e) : undefined); + } else { + obj.classes = []; + } + if (message.entries) { + obj.entries = message.entries.map((e) => e ? Entry.toJSON(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.classes = object.classes?.map((e) => Class.fromPartial(e)) || []; + message.entries = object.entries?.map((e) => Entry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEntry(): Entry { + return { owner: "", nfts: [] }; +} + +export const Entry = { + encode(message: Entry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Entry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.nfts.push(NFT.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Entry { + return { + owner: isSet(object.owner) ? String(object.owner) : "", + nfts: Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], + }; + }, + + toJSON(message: Entry): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + if (message.nfts) { + obj.nfts = message.nfts.map((e) => e ? NFT.toJSON(e) : undefined); + } else { + obj.nfts = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Entry { + const message = createBaseEntry(); + message.owner = object.owner ?? ""; + message.nfts = object.nfts?.map((e) => NFT.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/nft/v1beta1/nft.ts b/common/types/src/lcd/cosmos/nft/v1beta1/nft.ts new file mode 100644 index 00000000..d98d6e78 --- /dev/null +++ b/common/types/src/lcd/cosmos/nft/v1beta1/nft.ts @@ -0,0 +1,240 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** Class defines the class of the nft type. */ +export interface Class { + /** id defines the unique identifier of the NFT classification, similar to the contract address of ERC721 */ + id: string; + /** name defines the human-readable name of the NFT classification. Optional */ + name: string; + /** symbol is an abbreviated name for nft classification. Optional */ + symbol: string; + /** description is a brief description of nft classification. Optional */ + description: string; + /** uri for the class metadata stored off chain. It can define schema for Class and NFT `Data` attributes. Optional */ + uri: string; + /** uri_hash is a hash of the document pointed by uri. Optional */ + uri_hash: string; + /** data is the app specific metadata of the NFT class. Optional */ + data?: Any; +} + +/** NFT defines the NFT. */ +export interface NFT { + /** class_id associated with the NFT, similar to the contract address of ERC721 */ + class_id: string; + /** id is a unique identifier of the NFT */ + id: string; + /** uri for the NFT metadata stored off chain */ + uri: string; + /** uri_hash is a hash of the document pointed by uri */ + uri_hash: string; + /** data is an app specific data of the NFT. Optional */ + data?: Any; +} + +function createBaseClass(): Class { + return { id: "", name: "", symbol: "", description: "", uri: "", uri_hash: "", data: undefined }; +} + +export const Class = { + encode(message: Class, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(26).string(message.symbol); + } + if (message.description !== "") { + writer.uint32(34).string(message.description); + } + if (message.uri !== "") { + writer.uint32(42).string(message.uri); + } + if (message.uri_hash !== "") { + writer.uint32(50).string(message.uri_hash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Class { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClass(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.symbol = reader.string(); + break; + case 4: + message.description = reader.string(); + break; + case 5: + message.uri = reader.string(); + break; + case 6: + message.uri_hash = reader.string(); + break; + case 7: + message.data = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Class { + return { + id: isSet(object.id) ? String(object.id) : "", + name: isSet(object.name) ? String(object.name) : "", + symbol: isSet(object.symbol) ? String(object.symbol) : "", + description: isSet(object.description) ? String(object.description) : "", + uri: isSet(object.uri) ? String(object.uri) : "", + uri_hash: isSet(object.uri_hash) ? String(object.uri_hash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: Class): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.name !== undefined && (obj.name = message.name); + message.symbol !== undefined && (obj.symbol = message.symbol); + message.description !== undefined && (obj.description = message.description); + message.uri !== undefined && (obj.uri = message.uri); + message.uri_hash !== undefined && (obj.uri_hash = message.uri_hash); + message.data !== undefined && (obj.data = message.data ? Any.toJSON(message.data) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Class { + const message = createBaseClass(); + message.id = object.id ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.description = object.description ?? ""; + message.uri = object.uri ?? ""; + message.uri_hash = object.uri_hash ?? ""; + message.data = (object.data !== undefined && object.data !== null) ? Any.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseNFT(): NFT { + return { class_id: "", id: "", uri: "", uri_hash: "", data: undefined }; +} + +export const NFT = { + encode(message: NFT, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.uri !== "") { + writer.uint32(26).string(message.uri); + } + if (message.uri_hash !== "") { + writer.uint32(34).string(message.uri_hash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(82).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NFT { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNFT(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.uri = reader.string(); + break; + case 4: + message.uri_hash = reader.string(); + break; + case 10: + message.data = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NFT { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + uri: isSet(object.uri) ? String(object.uri) : "", + uri_hash: isSet(object.uri_hash) ? String(object.uri_hash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + + toJSON(message: NFT): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + message.uri !== undefined && (obj.uri = message.uri); + message.uri_hash !== undefined && (obj.uri_hash = message.uri_hash); + message.data !== undefined && (obj.data = message.data ? Any.toJSON(message.data) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): NFT { + const message = createBaseNFT(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + message.uri = object.uri ?? ""; + message.uri_hash = object.uri_hash ?? ""; + message.data = (object.data !== undefined && object.data !== null) ? Any.fromPartial(object.data) : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/nft/v1beta1/query.ts b/common/types/src/lcd/cosmos/nft/v1beta1/query.ts new file mode 100644 index 00000000..53e32d15 --- /dev/null +++ b/common/types/src/lcd/cosmos/nft/v1beta1/query.ts @@ -0,0 +1,944 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Class, NFT } from "./nft"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** QueryBalanceRequest is the request type for the Query/Balance RPC method */ +export interface QueryBalanceRequest { + class_id: string; + owner: string; +} + +/** QueryBalanceResponse is the response type for the Query/Balance RPC method */ +export interface QueryBalanceResponse { + amount: string; +} + +/** QueryOwnerRequest is the request type for the Query/Owner RPC method */ +export interface QueryOwnerRequest { + class_id: string; + id: string; +} + +/** QueryOwnerResponse is the response type for the Query/Owner RPC method */ +export interface QueryOwnerResponse { + owner: string; +} + +/** QuerySupplyRequest is the request type for the Query/Supply RPC method */ +export interface QuerySupplyRequest { + class_id: string; +} + +/** QuerySupplyResponse is the response type for the Query/Supply RPC method */ +export interface QuerySupplyResponse { + amount: string; +} + +/** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ +export interface QueryNFTsRequest { + class_id: string; + owner: string; + pagination?: PageRequest; +} + +/** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ +export interface QueryNFTsResponse { + nfts: NFT[]; + pagination?: PageResponse; +} + +/** QueryNFTRequest is the request type for the Query/NFT RPC method */ +export interface QueryNFTRequest { + class_id: string; + id: string; +} + +/** QueryNFTResponse is the response type for the Query/NFT RPC method */ +export interface QueryNFTResponse { + nft?: NFT; +} + +/** QueryClassRequest is the request type for the Query/Class RPC method */ +export interface QueryClassRequest { + class_id: string; +} + +/** QueryClassResponse is the response type for the Query/Class RPC method */ +export interface QueryClassResponse { + class?: Class; +} + +/** QueryClassesRequest is the request type for the Query/Classes RPC method */ +export interface QueryClassesRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryClassesResponse is the response type for the Query/Classes RPC method */ +export interface QueryClassesResponse { + classes: Class[]; + pagination?: PageResponse; +} + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { class_id: "", owner: "" }; +} + +export const QueryBalanceRequest = { + encode(message: QueryBalanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.class_id = reader.string(); + break; + case 2: + message.owner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.owner !== undefined && (obj.owner = message.owner); + return obj; + }, + + fromPartial, I>>(object: I): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.class_id = object.class_id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { amount: "0" }; +} + +export const QueryBalanceResponse = { + encode(message: QueryBalanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== "0") { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { amount: isSet(object.amount) ? String(object.amount) : "0" }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseQueryOwnerRequest(): QueryOwnerRequest { + return { class_id: "", id: "" }; +} + +export const QueryOwnerRequest = { + encode(message: QueryOwnerRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryOwnerRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOwnerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryOwnerRequest { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + }; + }, + + toJSON(message: QueryOwnerRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): QueryOwnerRequest { + const message = createBaseQueryOwnerRequest(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryOwnerResponse(): QueryOwnerResponse { + return { owner: "" }; +} + +export const QueryOwnerResponse = { + encode(message: QueryOwnerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryOwnerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOwnerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryOwnerResponse { + return { owner: isSet(object.owner) ? String(object.owner) : "" }; + }, + + toJSON(message: QueryOwnerResponse): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + return obj; + }, + + fromPartial, I>>(object: I): QueryOwnerResponse { + const message = createBaseQueryOwnerResponse(); + message.owner = object.owner ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyRequest(): QuerySupplyRequest { + return { class_id: "" }; +} + +export const QuerySupplyRequest = { + encode(message: QuerySupplyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySupplyRequest { + return { class_id: isSet(object.class_id) ? String(object.class_id) : "" }; + }, + + toJSON(message: QuerySupplyRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + return obj; + }, + + fromPartial, I>>(object: I): QuerySupplyRequest { + const message = createBaseQuerySupplyRequest(); + message.class_id = object.class_id ?? ""; + return message; + }, +}; + +function createBaseQuerySupplyResponse(): QuerySupplyResponse { + return { amount: "0" }; +} + +export const QuerySupplyResponse = { + encode(message: QuerySupplyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== "0") { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySupplyResponse { + return { amount: isSet(object.amount) ? String(object.amount) : "0" }; + }, + + toJSON(message: QuerySupplyResponse): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): QuerySupplyResponse { + const message = createBaseQuerySupplyResponse(); + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseQueryNFTsRequest(): QueryNFTsRequest { + return { class_id: "", owner: "", pagination: undefined }; +} + +export const QueryNFTsRequest = { + encode(message: QueryNFTsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.owner = reader.string(); + break; + case 3: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryNFTsRequest { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryNFTsRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.owner !== undefined && (obj.owner = message.owner); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryNFTsRequest { + const message = createBaseQueryNFTsRequest(); + message.class_id = object.class_id ?? ""; + message.owner = object.owner ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryNFTsResponse(): QueryNFTsResponse { + return { nfts: [], pagination: undefined }; +} + +export const QueryNFTsResponse = { + encode(message: QueryNFTsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.nfts) { + NFT.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nfts.push(NFT.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryNFTsResponse { + return { + nfts: Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryNFTsResponse): unknown { + const obj: any = {}; + if (message.nfts) { + obj.nfts = message.nfts.map((e) => e ? NFT.toJSON(e) : undefined); + } else { + obj.nfts = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryNFTsResponse { + const message = createBaseQueryNFTsResponse(); + message.nfts = object.nfts?.map((e) => NFT.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryNFTRequest(): QueryNFTRequest { + return { class_id: "", id: "" }; +} + +export const QueryNFTRequest = { + encode(message: QueryNFTRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryNFTRequest { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + }; + }, + + toJSON(message: QueryNFTRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): QueryNFTRequest { + const message = createBaseQueryNFTRequest(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseQueryNFTResponse(): QueryNFTResponse { + return { nft: undefined }; +} + +export const QueryNFTResponse = { + encode(message: QueryNFTResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.nft !== undefined) { + NFT.encode(message.nft, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryNFTResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nft = NFT.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryNFTResponse { + return { nft: isSet(object.nft) ? NFT.fromJSON(object.nft) : undefined }; + }, + + toJSON(message: QueryNFTResponse): unknown { + const obj: any = {}; + message.nft !== undefined && (obj.nft = message.nft ? NFT.toJSON(message.nft) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryNFTResponse { + const message = createBaseQueryNFTResponse(); + message.nft = (object.nft !== undefined && object.nft !== null) ? NFT.fromPartial(object.nft) : undefined; + return message; + }, +}; + +function createBaseQueryClassRequest(): QueryClassRequest { + return { class_id: "" }; +} + +export const QueryClassRequest = { + encode(message: QueryClassRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryClassRequest { + return { class_id: isSet(object.class_id) ? String(object.class_id) : "" }; + }, + + toJSON(message: QueryClassRequest): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryClassRequest { + const message = createBaseQueryClassRequest(); + message.class_id = object.class_id ?? ""; + return message; + }, +}; + +function createBaseQueryClassResponse(): QueryClassResponse { + return { class: undefined }; +} + +export const QueryClassResponse = { + encode(message: QueryClassResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class !== undefined) { + Class.encode(message.class, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.class = Class.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryClassResponse { + return { class: isSet(object.class) ? Class.fromJSON(object.class) : undefined }; + }, + + toJSON(message: QueryClassResponse): unknown { + const obj: any = {}; + message.class !== undefined && (obj.class = message.class ? Class.toJSON(message.class) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryClassResponse { + const message = createBaseQueryClassResponse(); + message.class = (object.class !== undefined && object.class !== null) ? Class.fromPartial(object.class) : undefined; + return message; + }, +}; + +function createBaseQueryClassesRequest(): QueryClassesRequest { + return { pagination: undefined }; +} + +export const QueryClassesRequest = { + encode(message: QueryClassesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesRequest(); + 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; + }, + + fromJSON(object: any): QueryClassesRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryClassesRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryClassesRequest { + const message = createBaseQueryClassesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryClassesResponse(): QueryClassesResponse { + return { classes: [], pagination: undefined }; +} + +export const QueryClassesResponse = { + encode(message: QueryClassesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.classes) { + Class.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryClassesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.classes.push(Class.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryClassesResponse { + return { + classes: Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryClassesResponse): unknown { + const obj: any = {}; + if (message.classes) { + obj.classes = message.classes.map((e) => e ? Class.toJSON(e) : undefined); + } else { + obj.classes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryClassesResponse { + const message = createBaseQueryClassesResponse(); + message.classes = object.classes?.map((e) => Class.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 */ + Balance(request: QueryBalanceRequest): Promise; + /** Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 */ + Owner(request: QueryOwnerRequest): Promise; + /** Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. */ + Supply(request: QuerySupplyRequest): Promise; + /** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + */ + NFTs(request: QueryNFTsRequest): Promise; + /** NFT queries an NFT based on its class and id. */ + NFT(request: QueryNFTRequest): Promise; + /** Class queries an NFT class based on its id */ + Class(request: QueryClassRequest): Promise; + /** Classes queries all NFT classes */ + Classes(request: QueryClassesRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.nft.v1beta1.Query"; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.Owner = this.Owner.bind(this); + this.Supply = this.Supply.bind(this); + this.NFTs = this.NFTs.bind(this); + this.NFT = this.NFT.bind(this); + this.Class = this.Class.bind(this); + this.Classes = this.Classes.bind(this); + } + Balance(request: QueryBalanceRequest): Promise { + const data = QueryBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Balance", data); + return promise.then((data) => QueryBalanceResponse.decode(new _m0.Reader(data))); + } + + Owner(request: QueryOwnerRequest): Promise { + const data = QueryOwnerRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Owner", data); + return promise.then((data) => QueryOwnerResponse.decode(new _m0.Reader(data))); + } + + Supply(request: QuerySupplyRequest): Promise { + const data = QuerySupplyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Supply", data); + return promise.then((data) => QuerySupplyResponse.decode(new _m0.Reader(data))); + } + + NFTs(request: QueryNFTsRequest): Promise { + const data = QueryNFTsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "NFTs", data); + return promise.then((data) => QueryNFTsResponse.decode(new _m0.Reader(data))); + } + + NFT(request: QueryNFTRequest): Promise { + const data = QueryNFTRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "NFT", data); + return promise.then((data) => QueryNFTResponse.decode(new _m0.Reader(data))); + } + + Class(request: QueryClassRequest): Promise { + const data = QueryClassRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Class", data); + return promise.then((data) => QueryClassResponse.decode(new _m0.Reader(data))); + } + + Classes(request: QueryClassesRequest): Promise { + const data = QueryClassesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Classes", data); + return promise.then((data) => QueryClassesResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/nft/v1beta1/tx.ts b/common/types/src/lcd/cosmos/nft/v1beta1/tx.ts new file mode 100644 index 00000000..e0a8855a --- /dev/null +++ b/common/types/src/lcd/cosmos/nft/v1beta1/tx.ts @@ -0,0 +1,175 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.nft.v1beta1"; + +/** MsgSend represents a message to send a nft from one account to another account. */ +export interface MsgSend { + /** class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 */ + class_id: string; + /** id defines the unique identification of nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; +} + +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponse { +} + +function createBaseMsgSend(): MsgSend { + return { class_id: "", id: "", sender: "", receiver: "" }; +} + +export const MsgSend = { + encode(message: MsgSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.class_id !== "") { + writer.uint32(10).string(message.class_id); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(34).string(message.receiver); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.class_id = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.sender = reader.string(); + break; + case 4: + message.receiver = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + class_id: isSet(object.class_id) ? String(object.class_id) : "", + id: isSet(object.id) ? String(object.id) : "", + sender: isSet(object.sender) ? String(object.sender) : "", + receiver: isSet(object.receiver) ? String(object.receiver) : "", + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + message.class_id !== undefined && (obj.class_id = message.class_id); + message.id !== undefined && (obj.id = message.id); + message.sender !== undefined && (obj.sender = message.sender); + message.receiver !== undefined && (obj.receiver = message.receiver); + return obj; + }, + + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.class_id = object.class_id ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +export const MsgSendResponse = { + encode(_: MsgSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +/** Msg defines the nft Msg service. */ +export interface Msg { + /** Send defines a method to send a nft from one account to another account. */ + Send(request: MsgSend): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.nft.v1beta1.Msg"; + this.rpc = rpc; + this.Send = this.Send.bind(this); + } + Send(request: MsgSend): Promise { + const data = MsgSend.encode(request).finish(); + const promise = this.rpc.request(this.service, "Send", data); + return promise.then((data) => MsgSendResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/orm/v1/orm.ts b/common/types/src/lcd/cosmos/orm/v1/orm.ts new file mode 100644 index 00000000..512affa0 --- /dev/null +++ b/common/types/src/lcd/cosmos/orm/v1/orm.ts @@ -0,0 +1,356 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.orm.v1"; + +/** TableDescriptor describes an ORM table. */ +export interface TableDescriptor { + /** primary_key defines the primary key for the table. */ + primary_key?: PrimaryKeyDescriptor; + /** index defines one or more secondary indexes. */ + index: SecondaryIndexDescriptor[]; + /** + * id is a non-zero integer ID that must be unique within the + * tables and singletons in this file. It may be deprecated in the future when this + * can be auto-generated. + */ + id: number; +} + +/** PrimaryKeyDescriptor describes a table primary key. */ +export interface PrimaryKeyDescriptor { + /** + * fields is a comma-separated list of fields in the primary key. Spaces are + * not allowed. Supported field types, their encodings, and any applicable constraints + * are described below. + * - uint32 are encoded as 2,3,4 or 5 bytes using a compact encoding that + * is suitable for sorted iteration (not varint encoding). This type is + * well-suited for small integers. + * - uint64 are encoded as 2,4,6 or 9 bytes using a compact encoding that + * is suitable for sorted iteration (not varint encoding). This type is + * well-suited for small integers such as auto-incrementing sequences. + * - fixed32, fixed64 are encoded as big-endian fixed width bytes and support + * sorted iteration. These types are well-suited for encoding fixed with + * decimals as integers. + * - string's are encoded as raw bytes in terminal key segments and null-terminated + * in non-terminal segments. Null characters are thus forbidden in strings. + * string fields support sorted iteration. + * - bytes are encoded as raw bytes in terminal segments and length-prefixed + * with a 32-bit unsigned varint in non-terminal segments. + * - int32, sint32, int64, sint64, sfixed32, sfixed64 are encoded as fixed width bytes with + * an encoding that enables sorted iteration. + * - google.protobuf.Timestamp and google.protobuf.Duration are encoded + * as 12 bytes using an encoding that enables sorted iteration. + * - enum fields are encoded using varint encoding and do not support sorted + * iteration. + * - bool fields are encoded as a single byte 0 or 1. + * + * All other fields types are unsupported in keys including repeated and + * oneof fields. + * + * Primary keys are prefixed by the varint encoded table id and the byte 0x0 + * plus any additional prefix specified by the schema. + */ + fields: string; + /** + * auto_increment specifies that the primary key is generated by an + * auto-incrementing integer. If this is set to true fields must only + * contain one field of that is of type uint64. + */ + auto_increment: boolean; +} + +/** PrimaryKeyDescriptor describes a table secondary index. */ +export interface SecondaryIndexDescriptor { + /** + * fields is a comma-separated list of fields in the index. The supported + * field types are the same as those for PrimaryKeyDescriptor.fields. + * Index keys are prefixed by the varint encoded table id and the varint + * encoded index id plus any additional prefix specified by the schema. + * + * In addition the the field segments, non-unique index keys are suffixed with + * any additional primary key fields not present in the index fields so that the + * primary key can be reconstructed. Unique indexes instead of being suffixed + * store the remaining primary key fields in the value.. + */ + fields: string; + /** + * id is a non-zero integer ID that must be unique within the indexes for this + * table and less than 32768. It may be deprecated in the future when this can + * be auto-generated. + */ + id: number; + /** unique specifies that this an unique index. */ + unique: boolean; +} + +/** TableDescriptor describes an ORM singleton table which has at most one instance. */ +export interface SingletonDescriptor { + /** + * id is a non-zero integer ID that must be unique within the + * tables and singletons in this file. It may be deprecated in the future when this + * can be auto-generated. + */ + id: number; +} + +function createBaseTableDescriptor(): TableDescriptor { + return { primary_key: undefined, index: [], id: 0 }; +} + +export const TableDescriptor = { + encode(message: TableDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.primary_key !== undefined) { + PrimaryKeyDescriptor.encode(message.primary_key, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.index) { + SecondaryIndexDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.id !== 0) { + writer.uint32(24).uint32(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TableDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTableDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.primary_key = PrimaryKeyDescriptor.decode(reader, reader.uint32()); + break; + case 2: + message.index.push(SecondaryIndexDescriptor.decode(reader, reader.uint32())); + break; + case 3: + message.id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TableDescriptor { + return { + primary_key: isSet(object.primary_key) ? PrimaryKeyDescriptor.fromJSON(object.primary_key) : undefined, + index: Array.isArray(object?.index) ? object.index.map((e: any) => SecondaryIndexDescriptor.fromJSON(e)) : [], + id: isSet(object.id) ? Number(object.id) : 0, + }; + }, + + toJSON(message: TableDescriptor): unknown { + const obj: any = {}; + message.primary_key !== undefined && + (obj.primary_key = message.primary_key ? PrimaryKeyDescriptor.toJSON(message.primary_key) : undefined); + if (message.index) { + obj.index = message.index.map((e) => e ? SecondaryIndexDescriptor.toJSON(e) : undefined); + } else { + obj.index = []; + } + message.id !== undefined && (obj.id = Math.round(message.id)); + return obj; + }, + + fromPartial, I>>(object: I): TableDescriptor { + const message = createBaseTableDescriptor(); + message.primary_key = (object.primary_key !== undefined && object.primary_key !== null) + ? PrimaryKeyDescriptor.fromPartial(object.primary_key) + : undefined; + message.index = object.index?.map((e) => SecondaryIndexDescriptor.fromPartial(e)) || []; + message.id = object.id ?? 0; + return message; + }, +}; + +function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { + return { fields: "", auto_increment: false }; +} + +export const PrimaryKeyDescriptor = { + encode(message: PrimaryKeyDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.auto_increment === true) { + writer.uint32(16).bool(message.auto_increment); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PrimaryKeyDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrimaryKeyDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fields = reader.string(); + break; + case 2: + message.auto_increment = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PrimaryKeyDescriptor { + return { + fields: isSet(object.fields) ? String(object.fields) : "", + auto_increment: isSet(object.auto_increment) ? Boolean(object.auto_increment) : false, + }; + }, + + toJSON(message: PrimaryKeyDescriptor): unknown { + const obj: any = {}; + message.fields !== undefined && (obj.fields = message.fields); + message.auto_increment !== undefined && (obj.auto_increment = message.auto_increment); + return obj; + }, + + fromPartial, I>>(object: I): PrimaryKeyDescriptor { + const message = createBasePrimaryKeyDescriptor(); + message.fields = object.fields ?? ""; + message.auto_increment = object.auto_increment ?? false; + return message; + }, +}; + +function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { + return { fields: "", id: 0, unique: false }; +} + +export const SecondaryIndexDescriptor = { + encode(message: SecondaryIndexDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fields !== "") { + writer.uint32(10).string(message.fields); + } + if (message.id !== 0) { + writer.uint32(16).uint32(message.id); + } + if (message.unique === true) { + writer.uint32(24).bool(message.unique); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SecondaryIndexDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecondaryIndexDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fields = reader.string(); + break; + case 2: + message.id = reader.uint32(); + break; + case 3: + message.unique = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SecondaryIndexDescriptor { + return { + fields: isSet(object.fields) ? String(object.fields) : "", + id: isSet(object.id) ? Number(object.id) : 0, + unique: isSet(object.unique) ? Boolean(object.unique) : false, + }; + }, + + toJSON(message: SecondaryIndexDescriptor): unknown { + const obj: any = {}; + message.fields !== undefined && (obj.fields = message.fields); + message.id !== undefined && (obj.id = Math.round(message.id)); + message.unique !== undefined && (obj.unique = message.unique); + return obj; + }, + + fromPartial, I>>(object: I): SecondaryIndexDescriptor { + const message = createBaseSecondaryIndexDescriptor(); + message.fields = object.fields ?? ""; + message.id = object.id ?? 0; + message.unique = object.unique ?? false; + return message; + }, +}; + +function createBaseSingletonDescriptor(): SingletonDescriptor { + return { id: 0 }; +} + +export const SingletonDescriptor = { + encode(message: SingletonDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SingletonDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSingletonDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SingletonDescriptor { + return { id: isSet(object.id) ? Number(object.id) : 0 }; + }, + + toJSON(message: SingletonDescriptor): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + return obj; + }, + + fromPartial, I>>(object: I): SingletonDescriptor { + const message = createBaseSingletonDescriptor(); + message.id = object.id ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/orm/v1alpha1/schema.ts b/common/types/src/lcd/cosmos/orm/v1alpha1/schema.ts new file mode 100644 index 00000000..f316cdc5 --- /dev/null +++ b/common/types/src/lcd/cosmos/orm/v1alpha1/schema.ts @@ -0,0 +1,334 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.orm.v1alpha1"; + +/** StorageType */ +export enum StorageType { + /** + * STORAGE_TYPE_DEFAULT_UNSPECIFIED - STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent + * KV-storage where primary key entries are stored in merkle-tree + * backed commitment storage and indexes and seqs are stored in + * fast index storage. Note that the Cosmos SDK before store/v2alpha1 + * does not support this. + */ + STORAGE_TYPE_DEFAULT_UNSPECIFIED = "STORAGE_TYPE_DEFAULT_UNSPECIFIED", + /** + * STORAGE_TYPE_MEMORY - STORAGE_TYPE_MEMORY indicates in-memory storage that will be + * reloaded every time an app restarts. Tables with this type of storage + * will by default be ignored when importing and exporting a module's + * state from JSON. + */ + STORAGE_TYPE_MEMORY = "STORAGE_TYPE_MEMORY", + /** + * STORAGE_TYPE_TRANSIENT - STORAGE_TYPE_TRANSIENT indicates transient storage that is reset + * at the end of every block. Tables with this type of storage + * will by default be ignored when importing and exporting a module's + * state from JSON. + */ + STORAGE_TYPE_TRANSIENT = "STORAGE_TYPE_TRANSIENT", + /** + * STORAGE_TYPE_INDEX - STORAGE_TYPE_INDEX indicates persistent storage which is not backed + * by a merkle-tree and won't affect the app hash. Note that the Cosmos SDK + * before store/v2alpha1 does not support this. + */ + STORAGE_TYPE_INDEX = "STORAGE_TYPE_INDEX", + /** + * STORAGE_TYPE_COMMITMENT - STORAGE_TYPE_INDEX indicates persistent storage which is backed by + * a merkle-tree. With this type of storage, both primary and index keys + * will affect the app hash and this is generally less efficient + * than using STORAGE_TYPE_DEFAULT_UNSPECIFIED which separates index + * keys into index storage. Note that modules built with the + * Cosmos SDK before store/v2alpha1 must specify STORAGE_TYPE_COMMITMENT + * instead of STORAGE_TYPE_DEFAULT_UNSPECIFIED or STORAGE_TYPE_INDEX + * because this is the only type of persistent storage available. + */ + STORAGE_TYPE_COMMITMENT = "STORAGE_TYPE_COMMITMENT", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function storageTypeFromJSON(object: any): StorageType { + switch (object) { + case 0: + case "STORAGE_TYPE_DEFAULT_UNSPECIFIED": + return StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED; + case 1: + case "STORAGE_TYPE_MEMORY": + return StorageType.STORAGE_TYPE_MEMORY; + case 2: + case "STORAGE_TYPE_TRANSIENT": + return StorageType.STORAGE_TYPE_TRANSIENT; + case 3: + case "STORAGE_TYPE_INDEX": + return StorageType.STORAGE_TYPE_INDEX; + case 4: + case "STORAGE_TYPE_COMMITMENT": + return StorageType.STORAGE_TYPE_COMMITMENT; + case -1: + case "UNRECOGNIZED": + default: + return StorageType.UNRECOGNIZED; + } +} + +export function storageTypeToJSON(object: StorageType): string { + switch (object) { + case StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED: + return "STORAGE_TYPE_DEFAULT_UNSPECIFIED"; + case StorageType.STORAGE_TYPE_MEMORY: + return "STORAGE_TYPE_MEMORY"; + case StorageType.STORAGE_TYPE_TRANSIENT: + return "STORAGE_TYPE_TRANSIENT"; + case StorageType.STORAGE_TYPE_INDEX: + return "STORAGE_TYPE_INDEX"; + case StorageType.STORAGE_TYPE_COMMITMENT: + return "STORAGE_TYPE_COMMITMENT"; + case StorageType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function storageTypeToNumber(object: StorageType): number { + switch (object) { + case StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED: + return 0; + case StorageType.STORAGE_TYPE_MEMORY: + return 1; + case StorageType.STORAGE_TYPE_TRANSIENT: + return 2; + case StorageType.STORAGE_TYPE_INDEX: + return 3; + case StorageType.STORAGE_TYPE_COMMITMENT: + return 4; + case StorageType.UNRECOGNIZED: + default: + return -1; + } +} + +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptor { + schema_file: ModuleSchemaDescriptor_FileEntry[]; + /** + * prefix is an optional prefix that precedes all keys in this module's + * store. + */ + prefix: Uint8Array; +} + +/** FileEntry describes an ORM file used in a module. */ +export interface ModuleSchemaDescriptor_FileEntry { + /** + * id is a prefix that will be varint encoded and prepended to all the + * table keys specified in the file's tables. + */ + id: number; + /** + * proto_file_name is the name of a file .proto in that contains + * table definitions. The .proto file must be in a package that the + * module has referenced using cosmos.app.v1.ModuleDescriptor.use_package. + */ + proto_file_name: string; + /** + * storage_type optionally indicates the type of storage this file's + * tables should used. If it is left unspecified, the default KV-storage + * of the app will be used. + */ + storage_type: StorageType; +} + +function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { + return { schema_file: [], prefix: new Uint8Array() }; +} + +export const ModuleSchemaDescriptor = { + encode(message: ModuleSchemaDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.schema_file) { + ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleSchemaDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleSchemaDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.schema_file.push(ModuleSchemaDescriptor_FileEntry.decode(reader, reader.uint32())); + break; + case 2: + message.prefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor { + return { + schema_file: Array.isArray(object?.schema_file) + ? object.schema_file.map((e: any) => ModuleSchemaDescriptor_FileEntry.fromJSON(e)) + : [], + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(), + }; + }, + + toJSON(message: ModuleSchemaDescriptor): unknown { + const obj: any = {}; + if (message.schema_file) { + obj.schema_file = message.schema_file.map((e) => e ? ModuleSchemaDescriptor_FileEntry.toJSON(e) : undefined); + } else { + obj.schema_file = []; + } + message.prefix !== undefined && + (obj.prefix = base64FromBytes(message.prefix !== undefined ? message.prefix : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): ModuleSchemaDescriptor { + const message = createBaseModuleSchemaDescriptor(); + message.schema_file = object.schema_file?.map((e) => ModuleSchemaDescriptor_FileEntry.fromPartial(e)) || []; + message.prefix = object.prefix ?? new Uint8Array(); + return message; + }, +}; + +function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { + return { id: 0, proto_file_name: "", storage_type: StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED }; +} + +export const ModuleSchemaDescriptor_FileEntry = { + encode(message: ModuleSchemaDescriptor_FileEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.proto_file_name !== "") { + writer.uint32(18).string(message.proto_file_name); + } + if (message.storage_type !== StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED) { + writer.uint32(24).int32(storageTypeToNumber(message.storage_type)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleSchemaDescriptor_FileEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleSchemaDescriptor_FileEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + case 2: + message.proto_file_name = reader.string(); + break; + case 3: + message.storage_type = storageTypeFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleSchemaDescriptor_FileEntry { + return { + id: isSet(object.id) ? Number(object.id) : 0, + proto_file_name: isSet(object.proto_file_name) ? String(object.proto_file_name) : "", + storage_type: isSet(object.storage_type) + ? storageTypeFromJSON(object.storage_type) + : StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED, + }; + }, + + toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + message.proto_file_name !== undefined && (obj.proto_file_name = message.proto_file_name); + message.storage_type !== undefined && (obj.storage_type = storageTypeToJSON(message.storage_type)); + return obj; + }, + + fromPartial, I>>( + object: I, + ): ModuleSchemaDescriptor_FileEntry { + const message = createBaseModuleSchemaDescriptor_FileEntry(); + message.id = object.id ?? 0; + message.proto_file_name = object.proto_file_name ?? ""; + message.storage_type = object.storage_type ?? StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/params/v1beta1/params.ts b/common/types/src/lcd/cosmos/params/v1beta1/params.ts new file mode 100644 index 00000000..ebcaa371 --- /dev/null +++ b/common/types/src/lcd/cosmos/params/v1beta1/params.ts @@ -0,0 +1,174 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.params.v1beta1"; + +/** ParameterChangeProposal defines a proposal to change one or more parameters. */ +export interface ParameterChangeProposal { + title: string; + description: string; + changes: ParamChange[]; +} + +/** + * ParamChange defines an individual parameter change, for use in + * ParameterChangeProposal. + */ +export interface ParamChange { + subspace: string; + key: string; + value: string; +} + +function createBaseParameterChangeProposal(): ParameterChangeProposal { + return { title: "", description: "", changes: [] }; +} + +export const ParameterChangeProposal = { + encode(message: ParameterChangeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + for (const v of message.changes) { + ParamChange.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ParameterChangeProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParameterChangeProposal(); + 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.changes.push(ParamChange.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ParameterChangeProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + changes: Array.isArray(object?.changes) ? object.changes.map((e: any) => ParamChange.fromJSON(e)) : [], + }; + }, + + toJSON(message: ParameterChangeProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + if (message.changes) { + obj.changes = message.changes.map((e) => e ? ParamChange.toJSON(e) : undefined); + } else { + obj.changes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ParameterChangeProposal { + const message = createBaseParameterChangeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.changes = object.changes?.map((e) => ParamChange.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseParamChange(): ParamChange { + return { subspace: "", key: "", value: "" }; +} + +export const ParamChange = { + encode(message: ParamChange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.value !== "") { + writer.uint32(26).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ParamChange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParamChange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subspace = reader.string(); + break; + case 2: + message.key = reader.string(); + break; + case 3: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ParamChange { + return { + subspace: isSet(object.subspace) ? String(object.subspace) : "", + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "", + }; + }, + + toJSON(message: ParamChange): unknown { + const obj: any = {}; + message.subspace !== undefined && (obj.subspace = message.subspace); + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + fromPartial, I>>(object: I): ParamChange { + const message = createBaseParamChange(); + message.subspace = object.subspace ?? ""; + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/params/v1beta1/query.ts b/common/types/src/lcd/cosmos/params/v1beta1/query.ts new file mode 100644 index 00000000..f70bdfcc --- /dev/null +++ b/common/types/src/lcd/cosmos/params/v1beta1/query.ts @@ -0,0 +1,356 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { ParamChange } from "./params"; + +export const protobufPackage = "cosmos.params.v1beta1"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** subspace defines the module to query the parameter for. */ + subspace: string; + /** key defines the key of the parameter in the subspace. */ + key: string; +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** param defines the queried parameter. */ + param?: ParamChange; +} + +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + */ +export interface QuerySubspacesRequest { +} + +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + */ +export interface QuerySubspacesResponse { + subspaces: Subspace[]; +} + +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + */ +export interface Subspace { + subspace: string; + keys: string[]; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { subspace: "", key: "" }; +} + +export const QueryParamsRequest = { + encode(message: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.subspace = reader.string(); + break; + case 2: + message.key = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { + subspace: isSet(object.subspace) ? String(object.subspace) : "", + key: isSet(object.key) ? String(object.key) : "", + }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + message.subspace !== undefined && (obj.subspace = message.subspace); + message.key !== undefined && (obj.key = message.key); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.subspace = object.subspace ?? ""; + message.key = object.key ?? ""; + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { param: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.param !== undefined) { + ParamChange.encode(message.param, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.param = ParamChange.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.param !== undefined && (obj.param = message.param ? ParamChange.toJSON(message.param) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.param = (object.param !== undefined && object.param !== null) + ? ParamChange.fromPartial(object.param) + : undefined; + return message; + }, +}; + +function createBaseQuerySubspacesRequest(): QuerySubspacesRequest { + return {}; +} + +export const QuerySubspacesRequest = { + encode(_: QuerySubspacesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySubspacesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QuerySubspacesRequest { + return {}; + }, + + toJSON(_: QuerySubspacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QuerySubspacesRequest { + const message = createBaseQuerySubspacesRequest(); + return message; + }, +}; + +function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { + return { subspaces: [] }; +} + +export const QuerySubspacesResponse = { + encode(message: QuerySubspacesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.subspaces) { + Subspace.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySubspacesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subspaces.push(Subspace.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySubspacesResponse { + return { + subspaces: Array.isArray(object?.subspaces) ? object.subspaces.map((e: any) => Subspace.fromJSON(e)) : [], + }; + }, + + toJSON(message: QuerySubspacesResponse): unknown { + const obj: any = {}; + if (message.subspaces) { + obj.subspaces = message.subspaces.map((e) => e ? Subspace.toJSON(e) : undefined); + } else { + obj.subspaces = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QuerySubspacesResponse { + const message = createBaseQuerySubspacesResponse(); + message.subspaces = object.subspaces?.map((e) => Subspace.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSubspace(): Subspace { + return { subspace: "", keys: [] }; +} + +export const Subspace = { + encode(message: Subspace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + for (const v of message.keys) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Subspace { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubspace(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subspace = reader.string(); + break; + case 2: + message.keys.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Subspace { + return { + subspace: isSet(object.subspace) ? String(object.subspace) : "", + keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: Subspace): unknown { + const obj: any = {}; + message.subspace !== undefined && (obj.subspace = message.subspace); + if (message.keys) { + obj.keys = message.keys.map((e) => e); + } else { + obj.keys = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Subspace { + const message = createBaseSubspace(); + message.subspace = object.subspace ?? ""; + message.keys = object.keys?.map((e) => e) || []; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Params queries a specific parameter of a module, given its subspace and + * key. + */ + Params(request: QueryParamsRequest): Promise; + /** Subspaces queries for all registered subspaces and all keys for a subspace. */ + Subspaces(request: QuerySubspacesRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.params.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Subspaces = this.Subspaces.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + Subspaces(request: QuerySubspacesRequest): Promise { + const data = QuerySubspacesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Subspaces", data); + return promise.then((data) => QuerySubspacesResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/slashing/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/slashing/v1beta1/genesis.ts new file mode 100644 index 00000000..01f795e0 --- /dev/null +++ b/common/types/src/lcd/cosmos/slashing/v1beta1/genesis.ts @@ -0,0 +1,341 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Params, ValidatorSigningInfo } from "./slashing"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** GenesisState defines the slashing module's genesis state. */ +export interface GenesisState { + /** params defines all the paramaters of related to deposit. */ + params?: Params; + /** + * signing_infos represents a map between validator addresses and their + * signing infos. + */ + signing_infos: SigningInfo[]; + /** + * missed_blocks represents a map between validator addresses and their + * missed blocks. + */ + missed_blocks: ValidatorMissedBlocks[]; +} + +/** SigningInfo stores validator signing info of corresponding address. */ +export interface SigningInfo { + /** address is the validator address. */ + address: string; + /** validator_signing_info represents the signing info of this validator. */ + validator_signing_info?: ValidatorSigningInfo; +} + +/** + * ValidatorMissedBlocks contains array of missed blocks of corresponding + * address. + */ +export interface ValidatorMissedBlocks { + /** address is the validator address. */ + address: string; + /** missed_blocks is an array of missed blocks by the validator. */ + missed_blocks: MissedBlock[]; +} + +/** MissedBlock contains height and missed status as boolean. */ +export interface MissedBlock { + /** index is the height at which the block was missed. */ + index: string; + /** missed is the missed status. */ + missed: boolean; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, signing_infos: [], missed_blocks: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.signing_infos) { + SigningInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.missed_blocks) { + ValidatorMissedBlocks.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.signing_infos.push(SigningInfo.decode(reader, reader.uint32())); + break; + case 3: + message.missed_blocks.push(ValidatorMissedBlocks.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + signing_infos: Array.isArray(object?.signing_infos) + ? object.signing_infos.map((e: any) => SigningInfo.fromJSON(e)) + : [], + missed_blocks: Array.isArray(object?.missed_blocks) + ? object.missed_blocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.signing_infos) { + obj.signing_infos = message.signing_infos.map((e) => e ? SigningInfo.toJSON(e) : undefined); + } else { + obj.signing_infos = []; + } + if (message.missed_blocks) { + obj.missed_blocks = message.missed_blocks.map((e) => e ? ValidatorMissedBlocks.toJSON(e) : undefined); + } else { + obj.missed_blocks = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.signing_infos = object.signing_infos?.map((e) => SigningInfo.fromPartial(e)) || []; + message.missed_blocks = object.missed_blocks?.map((e) => ValidatorMissedBlocks.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSigningInfo(): SigningInfo { + return { address: "", validator_signing_info: undefined }; +} + +export const SigningInfo = { + encode(message: SigningInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.validator_signing_info !== undefined) { + ValidatorSigningInfo.encode(message.validator_signing_info, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SigningInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSigningInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.validator_signing_info = ValidatorSigningInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SigningInfo { + return { + address: isSet(object.address) ? String(object.address) : "", + validator_signing_info: isSet(object.validator_signing_info) + ? ValidatorSigningInfo.fromJSON(object.validator_signing_info) + : undefined, + }; + }, + + toJSON(message: SigningInfo): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.validator_signing_info !== undefined && (obj.validator_signing_info = message.validator_signing_info + ? ValidatorSigningInfo.toJSON(message.validator_signing_info) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): SigningInfo { + const message = createBaseSigningInfo(); + message.address = object.address ?? ""; + message.validator_signing_info = + (object.validator_signing_info !== undefined && object.validator_signing_info !== null) + ? ValidatorSigningInfo.fromPartial(object.validator_signing_info) + : undefined; + return message; + }, +}; + +function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { + return { address: "", missed_blocks: [] }; +} + +export const ValidatorMissedBlocks = { + encode(message: ValidatorMissedBlocks, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.missed_blocks) { + MissedBlock.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorMissedBlocks { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorMissedBlocks(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.missed_blocks.push(MissedBlock.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorMissedBlocks { + return { + address: isSet(object.address) ? String(object.address) : "", + missed_blocks: Array.isArray(object?.missed_blocks) + ? object.missed_blocks.map((e: any) => MissedBlock.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorMissedBlocks): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.missed_blocks) { + obj.missed_blocks = message.missed_blocks.map((e) => e ? MissedBlock.toJSON(e) : undefined); + } else { + obj.missed_blocks = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ValidatorMissedBlocks { + const message = createBaseValidatorMissedBlocks(); + message.address = object.address ?? ""; + message.missed_blocks = object.missed_blocks?.map((e) => MissedBlock.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMissedBlock(): MissedBlock { + return { index: "0", missed: false }; +} + +export const MissedBlock = { + encode(message: MissedBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).int64(message.index); + } + if (message.missed === true) { + writer.uint32(16).bool(message.missed); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MissedBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMissedBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.int64() as Long); + break; + case 2: + message.missed = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MissedBlock { + return { + index: isSet(object.index) ? String(object.index) : "0", + missed: isSet(object.missed) ? Boolean(object.missed) : false, + }; + }, + + toJSON(message: MissedBlock): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.missed !== undefined && (obj.missed = message.missed); + return obj; + }, + + fromPartial, I>>(object: I): MissedBlock { + const message = createBaseMissedBlock(); + message.index = object.index ?? "0"; + message.missed = object.missed ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/slashing/v1beta1/query.ts b/common/types/src/lcd/cosmos/slashing/v1beta1/query.ts new file mode 100644 index 00000000..5150df45 --- /dev/null +++ b/common/types/src/lcd/cosmos/slashing/v1beta1/query.ts @@ -0,0 +1,414 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Params, ValidatorSigningInfo } from "./slashing"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** QueryParamsRequest is the request type for the Query/Params RPC method */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is the response type for the Query/Params RPC method */ +export interface QueryParamsResponse { + params?: Params; +} + +/** + * QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoRequest { + /** cons_address is the address to query signing info of */ + cons_address: string; +} + +/** + * QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC + * method + */ +export interface QuerySigningInfoResponse { + /** val_signing_info is the signing info of requested val cons address */ + val_signing_info?: ValidatorSigningInfo; +} + +/** + * QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosRequest { + pagination?: PageRequest; +} + +/** + * QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC + * method + */ +export interface QuerySigningInfosResponse { + /** info is the signing info of all validators */ + info: ValidatorSigningInfo[]; + pagination?: PageResponse; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { + return { cons_address: "" }; +} + +export const QuerySigningInfoRequest = { + encode(message: QuerySigningInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.cons_address !== "") { + writer.uint32(10).string(message.cons_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.cons_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoRequest { + return { cons_address: isSet(object.cons_address) ? String(object.cons_address) : "" }; + }, + + toJSON(message: QuerySigningInfoRequest): unknown { + const obj: any = {}; + message.cons_address !== undefined && (obj.cons_address = message.cons_address); + return obj; + }, + + fromPartial, I>>(object: I): QuerySigningInfoRequest { + const message = createBaseQuerySigningInfoRequest(); + message.cons_address = object.cons_address ?? ""; + return message; + }, +}; + +function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { + return { val_signing_info: undefined }; +} + +export const QuerySigningInfoResponse = { + encode(message: QuerySigningInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.val_signing_info !== undefined) { + ValidatorSigningInfo.encode(message.val_signing_info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.val_signing_info = ValidatorSigningInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoResponse { + return { + val_signing_info: isSet(object.val_signing_info) + ? ValidatorSigningInfo.fromJSON(object.val_signing_info) + : undefined, + }; + }, + + toJSON(message: QuerySigningInfoResponse): unknown { + const obj: any = {}; + message.val_signing_info !== undefined && (obj.val_signing_info = message.val_signing_info + ? ValidatorSigningInfo.toJSON(message.val_signing_info) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QuerySigningInfoResponse { + const message = createBaseQuerySigningInfoResponse(); + message.val_signing_info = (object.val_signing_info !== undefined && object.val_signing_info !== null) + ? ValidatorSigningInfo.fromPartial(object.val_signing_info) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { + return { pagination: undefined }; +} + +export const QuerySigningInfosRequest = { + encode(message: QuerySigningInfosRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfosRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfosRequest(); + 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; + }, + + fromJSON(object: any): QuerySigningInfosRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QuerySigningInfosRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QuerySigningInfosRequest { + const message = createBaseQuerySigningInfosRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQuerySigningInfosResponse(): QuerySigningInfosResponse { + return { info: [], pagination: undefined }; +} + +export const QuerySigningInfosResponse = { + encode(message: QuerySigningInfosResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.info) { + ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QuerySigningInfosResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfosResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info.push(ValidatorSigningInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosResponse { + return { + info: Array.isArray(object?.info) ? object.info.map((e: any) => ValidatorSigningInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySigningInfosResponse): unknown { + const obj: any = {}; + if (message.info) { + obj.info = message.info.map((e) => e ? ValidatorSigningInfo.toJSON(e) : undefined); + } else { + obj.info = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QuerySigningInfosResponse { + const message = createBaseQuerySigningInfosResponse(); + message.info = object.info?.map((e) => ValidatorSigningInfo.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** Query provides defines the gRPC querier service */ +export interface Query { + /** Params queries the parameters of slashing module */ + Params(request: QueryParamsRequest): Promise; + /** SigningInfo queries the signing info of given cons address */ + SigningInfo(request: QuerySigningInfoRequest): Promise; + /** SigningInfos queries signing info of all validators */ + SigningInfos(request: QuerySigningInfosRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.slashing.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.SigningInfo = this.SigningInfo.bind(this); + this.SigningInfos = this.SigningInfos.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + SigningInfo(request: QuerySigningInfoRequest): Promise { + const data = QuerySigningInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SigningInfo", data); + return promise.then((data) => QuerySigningInfoResponse.decode(new _m0.Reader(data))); + } + + SigningInfos(request: QuerySigningInfosRequest): Promise { + const data = QuerySigningInfosRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SigningInfos", data); + return promise.then((data) => QuerySigningInfosResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/slashing/v1beta1/slashing.ts b/common/types/src/lcd/cosmos/slashing/v1beta1/slashing.ts new file mode 100644 index 00000000..6f15c86e --- /dev/null +++ b/common/types/src/lcd/cosmos/slashing/v1beta1/slashing.ts @@ -0,0 +1,348 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** + * ValidatorSigningInfo defines a validator's signing info for monitoring their + * liveness activity. + */ +export interface ValidatorSigningInfo { + address: string; + /** Height at which validator was first a candidate OR was unjailed */ + start_height: string; + /** + * Index which is incremented each time the validator was a bonded + * in a block and may have signed a precommit or not. This in conjunction with the + * `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`. + */ + index_offset: string; + /** Timestamp until which the validator is jailed due to liveness downtime. */ + jailed_until?: Date; + /** + * Whether or not a validator has been tombstoned (killed out of validator set). It is set + * once the validator commits an equivocation or for any other configured misbehiavor. + */ + tombstoned: boolean; + /** + * A counter kept to avoid unnecessary array reads. + * Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. + */ + missed_blocks_counter: string; +} + +/** Params represents the parameters used for by the slashing module. */ +export interface Params { + signed_blocks_window: string; + min_signed_per_window: Uint8Array; + downtime_jail_duration?: Duration; + slash_fraction_double_sign: Uint8Array; + slash_fraction_downtime: Uint8Array; +} + +function createBaseValidatorSigningInfo(): ValidatorSigningInfo { + return { + address: "", + start_height: "0", + index_offset: "0", + jailed_until: undefined, + tombstoned: false, + missed_blocks_counter: "0", + }; +} + +export const ValidatorSigningInfo = { + encode(message: ValidatorSigningInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.start_height !== "0") { + writer.uint32(16).int64(message.start_height); + } + if (message.index_offset !== "0") { + writer.uint32(24).int64(message.index_offset); + } + if (message.jailed_until !== undefined) { + Timestamp.encode(toTimestamp(message.jailed_until), writer.uint32(34).fork()).ldelim(); + } + if (message.tombstoned === true) { + writer.uint32(40).bool(message.tombstoned); + } + if (message.missed_blocks_counter !== "0") { + writer.uint32(48).int64(message.missed_blocks_counter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSigningInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSigningInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.start_height = longToString(reader.int64() as Long); + break; + case 3: + message.index_offset = longToString(reader.int64() as Long); + break; + case 4: + message.jailed_until = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.tombstoned = reader.bool(); + break; + case 6: + message.missed_blocks_counter = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorSigningInfo { + return { + address: isSet(object.address) ? String(object.address) : "", + start_height: isSet(object.start_height) ? String(object.start_height) : "0", + index_offset: isSet(object.index_offset) ? String(object.index_offset) : "0", + jailed_until: isSet(object.jailed_until) ? fromJsonTimestamp(object.jailed_until) : undefined, + tombstoned: isSet(object.tombstoned) ? Boolean(object.tombstoned) : false, + missed_blocks_counter: isSet(object.missed_blocks_counter) ? String(object.missed_blocks_counter) : "0", + }; + }, + + toJSON(message: ValidatorSigningInfo): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.start_height !== undefined && (obj.start_height = message.start_height); + message.index_offset !== undefined && (obj.index_offset = message.index_offset); + message.jailed_until !== undefined && (obj.jailed_until = message.jailed_until.toISOString()); + message.tombstoned !== undefined && (obj.tombstoned = message.tombstoned); + message.missed_blocks_counter !== undefined && (obj.missed_blocks_counter = message.missed_blocks_counter); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorSigningInfo { + const message = createBaseValidatorSigningInfo(); + message.address = object.address ?? ""; + message.start_height = object.start_height ?? "0"; + message.index_offset = object.index_offset ?? "0"; + message.jailed_until = object.jailed_until ?? undefined; + message.tombstoned = object.tombstoned ?? false; + message.missed_blocks_counter = object.missed_blocks_counter ?? "0"; + return message; + }, +}; + +function createBaseParams(): Params { + return { + signed_blocks_window: "0", + min_signed_per_window: new Uint8Array(), + downtime_jail_duration: undefined, + slash_fraction_double_sign: new Uint8Array(), + slash_fraction_downtime: new Uint8Array(), + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.signed_blocks_window !== "0") { + writer.uint32(8).int64(message.signed_blocks_window); + } + if (message.min_signed_per_window.length !== 0) { + writer.uint32(18).bytes(message.min_signed_per_window); + } + if (message.downtime_jail_duration !== undefined) { + Duration.encode(message.downtime_jail_duration, writer.uint32(26).fork()).ldelim(); + } + if (message.slash_fraction_double_sign.length !== 0) { + writer.uint32(34).bytes(message.slash_fraction_double_sign); + } + if (message.slash_fraction_downtime.length !== 0) { + writer.uint32(42).bytes(message.slash_fraction_downtime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.signed_blocks_window = longToString(reader.int64() as Long); + break; + case 2: + message.min_signed_per_window = reader.bytes(); + break; + case 3: + message.downtime_jail_duration = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.slash_fraction_double_sign = reader.bytes(); + break; + case 5: + message.slash_fraction_downtime = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + signed_blocks_window: isSet(object.signed_blocks_window) ? String(object.signed_blocks_window) : "0", + min_signed_per_window: isSet(object.min_signed_per_window) + ? bytesFromBase64(object.min_signed_per_window) + : new Uint8Array(), + downtime_jail_duration: isSet(object.downtime_jail_duration) + ? Duration.fromJSON(object.downtime_jail_duration) + : undefined, + slash_fraction_double_sign: isSet(object.slash_fraction_double_sign) + ? bytesFromBase64(object.slash_fraction_double_sign) + : new Uint8Array(), + slash_fraction_downtime: isSet(object.slash_fraction_downtime) + ? bytesFromBase64(object.slash_fraction_downtime) + : new Uint8Array(), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.signed_blocks_window !== undefined && (obj.signed_blocks_window = message.signed_blocks_window); + message.min_signed_per_window !== undefined && + (obj.min_signed_per_window = base64FromBytes( + message.min_signed_per_window !== undefined ? message.min_signed_per_window : new Uint8Array(), + )); + message.downtime_jail_duration !== undefined && (obj.downtime_jail_duration = message.downtime_jail_duration + ? Duration.toJSON(message.downtime_jail_duration) + : undefined); + message.slash_fraction_double_sign !== undefined && + (obj.slash_fraction_double_sign = base64FromBytes( + message.slash_fraction_double_sign !== undefined ? message.slash_fraction_double_sign : new Uint8Array(), + )); + message.slash_fraction_downtime !== undefined && + (obj.slash_fraction_downtime = base64FromBytes( + message.slash_fraction_downtime !== undefined ? message.slash_fraction_downtime : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.signed_blocks_window = object.signed_blocks_window ?? "0"; + message.min_signed_per_window = object.min_signed_per_window ?? new Uint8Array(); + message.downtime_jail_duration = + (object.downtime_jail_duration !== undefined && object.downtime_jail_duration !== null) + ? Duration.fromPartial(object.downtime_jail_duration) + : undefined; + message.slash_fraction_double_sign = object.slash_fraction_double_sign ?? new Uint8Array(); + message.slash_fraction_downtime = object.slash_fraction_downtime ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/slashing/v1beta1/tx.ts b/common/types/src/lcd/cosmos/slashing/v1beta1/tx.ts new file mode 100644 index 00000000..54d56e48 --- /dev/null +++ b/common/types/src/lcd/cosmos/slashing/v1beta1/tx.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.slashing.v1beta1"; + +/** MsgUnjail defines the Msg/Unjail request type */ +export interface MsgUnjail { + validator_addr: string; +} + +/** MsgUnjailResponse defines the Msg/Unjail response type */ +export interface MsgUnjailResponse { +} + +function createBaseMsgUnjail(): MsgUnjail { + return { validator_addr: "" }; +} + +export const MsgUnjail = { + encode(message: MsgUnjail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUnjail { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjail(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUnjail { + return { validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "" }; + }, + + toJSON(message: MsgUnjail): unknown { + const obj: any = {}; + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + return obj; + }, + + fromPartial, I>>(object: I): MsgUnjail { + const message = createBaseMsgUnjail(); + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +function createBaseMsgUnjailResponse(): MsgUnjailResponse { + return {}; +} + +export const MsgUnjailResponse = { + encode(_: MsgUnjailResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUnjailResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjailResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUnjailResponse { + return {}; + }, + + toJSON(_: MsgUnjailResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUnjailResponse { + const message = createBaseMsgUnjailResponse(); + return message; + }, +}; + +/** Msg defines the slashing Msg service. */ +export interface Msg { + /** + * Unjail defines a method for unjailing a jailed validator, thus returning + * them into the bonded validator set, so they can begin receiving provisions + * and rewards again. + */ + Unjail(request: MsgUnjail): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.slashing.v1beta1.Msg"; + this.rpc = rpc; + this.Unjail = this.Unjail.bind(this); + } + Unjail(request: MsgUnjail): Promise { + const data = MsgUnjail.encode(request).finish(); + const promise = this.rpc.request(this.service, "Unjail", data); + return promise.then((data) => MsgUnjailResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/staking/v1beta1/authz.ts b/common/types/src/lcd/cosmos/staking/v1beta1/authz.ts new file mode 100644 index 00000000..9c1ff92f --- /dev/null +++ b/common/types/src/lcd/cosmos/staking/v1beta1/authz.ts @@ -0,0 +1,267 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** + * AuthorizationType defines the type of staking module authorization type + * + * Since: cosmos-sdk 0.43 + */ +export enum AuthorizationType { + /** AUTHORIZATION_TYPE_UNSPECIFIED - AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type */ + AUTHORIZATION_TYPE_UNSPECIFIED = "AUTHORIZATION_TYPE_UNSPECIFIED", + /** AUTHORIZATION_TYPE_DELEGATE - AUTHORIZATION_TYPE_DELEGATE defines an authorization type for Msg/Delegate */ + AUTHORIZATION_TYPE_DELEGATE = "AUTHORIZATION_TYPE_DELEGATE", + /** AUTHORIZATION_TYPE_UNDELEGATE - AUTHORIZATION_TYPE_UNDELEGATE defines an authorization type for Msg/Undelegate */ + AUTHORIZATION_TYPE_UNDELEGATE = "AUTHORIZATION_TYPE_UNDELEGATE", + /** AUTHORIZATION_TYPE_REDELEGATE - AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate */ + AUTHORIZATION_TYPE_REDELEGATE = "AUTHORIZATION_TYPE_REDELEGATE", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function authorizationTypeFromJSON(object: any): AuthorizationType { + switch (object) { + case 0: + case "AUTHORIZATION_TYPE_UNSPECIFIED": + return AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED; + case 1: + case "AUTHORIZATION_TYPE_DELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_DELEGATE; + case 2: + case "AUTHORIZATION_TYPE_UNDELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE; + case 3: + case "AUTHORIZATION_TYPE_REDELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE; + case -1: + case "UNRECOGNIZED": + default: + return AuthorizationType.UNRECOGNIZED; + } +} + +export function authorizationTypeToJSON(object: AuthorizationType): string { + switch (object) { + case AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED: + return "AUTHORIZATION_TYPE_UNSPECIFIED"; + case AuthorizationType.AUTHORIZATION_TYPE_DELEGATE: + return "AUTHORIZATION_TYPE_DELEGATE"; + case AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE: + return "AUTHORIZATION_TYPE_UNDELEGATE"; + case AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE: + return "AUTHORIZATION_TYPE_REDELEGATE"; + case AuthorizationType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function authorizationTypeToNumber(object: AuthorizationType): number { + switch (object) { + case AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED: + return 0; + case AuthorizationType.AUTHORIZATION_TYPE_DELEGATE: + return 1; + case AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE: + return 2; + case AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE: + return 3; + case AuthorizationType.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * StakeAuthorization defines authorization for delegate/undelegate/redelegate. + * + * Since: cosmos-sdk 0.43 + */ +export interface StakeAuthorization { + /** + * max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is + * empty, there is no spend limit and any amount of coins can be delegated. + */ + max_tokens?: Coin; + /** + * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + * account. + */ + allow_list?: + | StakeAuthorization_Validators + | undefined; + /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ + deny_list?: + | StakeAuthorization_Validators + | undefined; + /** authorization_type defines one of AuthorizationType. */ + authorization_type: AuthorizationType; +} + +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_Validators { + address: string[]; +} + +function createBaseStakeAuthorization(): StakeAuthorization { + return { + max_tokens: undefined, + allow_list: undefined, + deny_list: undefined, + authorization_type: AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED, + }; +} + +export const StakeAuthorization = { + encode(message: StakeAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.max_tokens !== undefined) { + Coin.encode(message.max_tokens, writer.uint32(10).fork()).ldelim(); + } + if (message.allow_list !== undefined) { + StakeAuthorization_Validators.encode(message.allow_list, writer.uint32(18).fork()).ldelim(); + } + if (message.deny_list !== undefined) { + StakeAuthorization_Validators.encode(message.deny_list, writer.uint32(26).fork()).ldelim(); + } + if (message.authorization_type !== AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED) { + writer.uint32(32).int32(authorizationTypeToNumber(message.authorization_type)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakeAuthorization { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.max_tokens = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.allow_list = StakeAuthorization_Validators.decode(reader, reader.uint32()); + break; + case 3: + message.deny_list = StakeAuthorization_Validators.decode(reader, reader.uint32()); + break; + case 4: + message.authorization_type = authorizationTypeFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StakeAuthorization { + return { + max_tokens: isSet(object.max_tokens) ? Coin.fromJSON(object.max_tokens) : undefined, + allow_list: isSet(object.allow_list) ? StakeAuthorization_Validators.fromJSON(object.allow_list) : undefined, + deny_list: isSet(object.deny_list) ? StakeAuthorization_Validators.fromJSON(object.deny_list) : undefined, + authorization_type: isSet(object.authorization_type) + ? authorizationTypeFromJSON(object.authorization_type) + : AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED, + }; + }, + + toJSON(message: StakeAuthorization): unknown { + const obj: any = {}; + message.max_tokens !== undefined && + (obj.max_tokens = message.max_tokens ? Coin.toJSON(message.max_tokens) : undefined); + message.allow_list !== undefined && + (obj.allow_list = message.allow_list ? StakeAuthorization_Validators.toJSON(message.allow_list) : undefined); + message.deny_list !== undefined && + (obj.deny_list = message.deny_list ? StakeAuthorization_Validators.toJSON(message.deny_list) : undefined); + message.authorization_type !== undefined && + (obj.authorization_type = authorizationTypeToJSON(message.authorization_type)); + return obj; + }, + + fromPartial, I>>(object: I): StakeAuthorization { + const message = createBaseStakeAuthorization(); + message.max_tokens = (object.max_tokens !== undefined && object.max_tokens !== null) + ? Coin.fromPartial(object.max_tokens) + : undefined; + message.allow_list = (object.allow_list !== undefined && object.allow_list !== null) + ? StakeAuthorization_Validators.fromPartial(object.allow_list) + : undefined; + message.deny_list = (object.deny_list !== undefined && object.deny_list !== null) + ? StakeAuthorization_Validators.fromPartial(object.deny_list) + : undefined; + message.authorization_type = object.authorization_type ?? AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED; + return message; + }, +}; + +function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { + return { address: [] }; +} + +export const StakeAuthorization_Validators = { + encode(message: StakeAuthorization_Validators, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.address) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakeAuthorization_Validators { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeAuthorization_Validators(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StakeAuthorization_Validators { + return { address: Array.isArray(object?.address) ? object.address.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: StakeAuthorization_Validators): unknown { + const obj: any = {}; + if (message.address) { + obj.address = message.address.map((e) => e); + } else { + obj.address = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): StakeAuthorization_Validators { + const message = createBaseStakeAuthorization_Validators(); + message.address = object.address?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/staking/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/staking/v1beta1/genesis.ts new file mode 100644 index 00000000..e4bad586 --- /dev/null +++ b/common/types/src/lcd/cosmos/staking/v1beta1/genesis.ts @@ -0,0 +1,321 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Delegation, Params, Redelegation, UnbondingDelegation, Validator } from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** GenesisState defines the staking module's genesis state. */ +export interface GenesisState { + /** params defines all the paramaters of related to deposit. */ + params?: Params; + /** + * last_total_power tracks the total amounts of bonded tokens recorded during + * the previous end block. + */ + last_total_power: Uint8Array; + /** + * last_validator_powers is a special index that provides a historical list + * of the last-block's bonded validators. + */ + last_validator_powers: LastValidatorPower[]; + /** delegations defines the validator set at genesis. */ + validators: Validator[]; + /** delegations defines the delegations active at genesis. */ + delegations: Delegation[]; + /** unbonding_delegations defines the unbonding delegations active at genesis. */ + unbonding_delegations: UnbondingDelegation[]; + /** redelegations defines the redelegations active at genesis. */ + redelegations: Redelegation[]; + exported: boolean; +} + +/** LastValidatorPower required for validator set update logic. */ +export interface LastValidatorPower { + /** address is the address of the validator. */ + address: string; + /** power defines the power of the validator. */ + power: string; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + last_total_power: new Uint8Array(), + last_validator_powers: [], + validators: [], + delegations: [], + unbonding_delegations: [], + redelegations: [], + exported: false, + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.last_total_power.length !== 0) { + writer.uint32(18).bytes(message.last_total_power); + } + for (const v of message.last_validator_powers) { + LastValidatorPower.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.delegations) { + Delegation.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.unbonding_delegations) { + UnbondingDelegation.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.redelegations) { + Redelegation.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.exported === true) { + writer.uint32(64).bool(message.exported); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.last_total_power = reader.bytes(); + break; + case 3: + message.last_validator_powers.push(LastValidatorPower.decode(reader, reader.uint32())); + break; + case 4: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 5: + message.delegations.push(Delegation.decode(reader, reader.uint32())); + break; + case 6: + message.unbonding_delegations.push(UnbondingDelegation.decode(reader, reader.uint32())); + break; + case 7: + message.redelegations.push(Redelegation.decode(reader, reader.uint32())); + break; + case 8: + message.exported = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + last_total_power: isSet(object.last_total_power) ? bytesFromBase64(object.last_total_power) : new Uint8Array(), + last_validator_powers: Array.isArray(object?.last_validator_powers) + ? object.last_validator_powers.map((e: any) => LastValidatorPower.fromJSON(e)) + : [], + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + delegations: Array.isArray(object?.delegations) ? object.delegations.map((e: any) => Delegation.fromJSON(e)) : [], + unbonding_delegations: Array.isArray(object?.unbonding_delegations) + ? object.unbonding_delegations.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + redelegations: Array.isArray(object?.redelegations) + ? object.redelegations.map((e: any) => Redelegation.fromJSON(e)) + : [], + exported: isSet(object.exported) ? Boolean(object.exported) : false, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + message.last_total_power !== undefined && + (obj.last_total_power = base64FromBytes( + message.last_total_power !== undefined ? message.last_total_power : new Uint8Array(), + )); + if (message.last_validator_powers) { + obj.last_validator_powers = message.last_validator_powers.map((e) => + e ? LastValidatorPower.toJSON(e) : undefined + ); + } else { + obj.last_validator_powers = []; + } + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + if (message.delegations) { + obj.delegations = message.delegations.map((e) => e ? Delegation.toJSON(e) : undefined); + } else { + obj.delegations = []; + } + if (message.unbonding_delegations) { + obj.unbonding_delegations = message.unbonding_delegations.map((e) => + e ? UnbondingDelegation.toJSON(e) : undefined + ); + } else { + obj.unbonding_delegations = []; + } + if (message.redelegations) { + obj.redelegations = message.redelegations.map((e) => e ? Redelegation.toJSON(e) : undefined); + } else { + obj.redelegations = []; + } + message.exported !== undefined && (obj.exported = message.exported); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.last_total_power = object.last_total_power ?? new Uint8Array(); + message.last_validator_powers = object.last_validator_powers?.map((e) => LastValidatorPower.fromPartial(e)) || []; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.delegations = object.delegations?.map((e) => Delegation.fromPartial(e)) || []; + message.unbonding_delegations = object.unbonding_delegations?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.redelegations = object.redelegations?.map((e) => Redelegation.fromPartial(e)) || []; + message.exported = object.exported ?? false; + return message; + }, +}; + +function createBaseLastValidatorPower(): LastValidatorPower { + return { address: "", power: "0" }; +} + +export const LastValidatorPower = { + encode(message: LastValidatorPower, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.power !== "0") { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LastValidatorPower { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLastValidatorPower(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.power = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LastValidatorPower { + return { + address: isSet(object.address) ? String(object.address) : "", + power: isSet(object.power) ? String(object.power) : "0", + }; + }, + + toJSON(message: LastValidatorPower): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.power !== undefined && (obj.power = message.power); + return obj; + }, + + fromPartial, I>>(object: I): LastValidatorPower { + const message = createBaseLastValidatorPower(); + message.address = object.address ?? ""; + message.power = object.power ?? "0"; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/staking/v1beta1/query.ts b/common/types/src/lcd/cosmos/staking/v1beta1/query.ts new file mode 100644 index 00000000..d0d16cfe --- /dev/null +++ b/common/types/src/lcd/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,2090 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { + DelegationResponse, + HistoricalInfo, + Params, + Pool, + RedelegationResponse, + UnbondingDelegation, + Validator, +} from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** 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; +} + +/** 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; +} + +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequest { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponse { + /** validator defines the the validator info. */ + validator?: Validator; +} + +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponse { + delegation_responses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponse { + unbonding_responses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponse { + /** delegation_responses defines the delegation info of a delegation. */ + delegation_response?: DelegationResponse; +} + +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponse { + /** unbond defines the unbonding information of a delegation. */ + unbond?: UnbondingDelegation; +} + +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponse { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegation_responses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponse { + unbonding_responses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequest { + /** 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?: PageRequest; +} + +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponse { + redelegation_responses: RedelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the the validators' info of a delegator. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponse { + /** validator defines the the validator info. */ + validator?: Validator; +} + +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequest { + /** height defines at which height to query the historical info. */ + height: string; +} + +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponse { + /** hist defines the historical info at the given height. */ + hist?: HistoricalInfo; +} + +/** QueryPoolRequest is request type for the Query/Pool RPC method. */ +export interface QueryPoolRequest { +} + +/** QueryPoolResponse is response type for the Query/Pool RPC method. */ +export interface QueryPoolResponse { + /** pool defines the pool info. */ + pool?: Pool; +} + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { + return { status: "", pagination: undefined }; +} + +export const QueryValidatorsRequest = { + encode(message: QueryValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryValidatorsRequest { + return { + status: isSet(object.status) ? String(object.status) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsRequest): unknown { + const obj: any = {}; + message.status !== undefined && (obj.status = message.status); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryValidatorsRequest { + const message = createBaseQueryValidatorsRequest(); + message.status = object.status ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorsResponse(): QueryValidatorsResponse { + return { validators: [], pagination: undefined }; +} + +export const QueryValidatorsResponse = { + encode(message: QueryValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryValidatorsResponse { + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseQueryValidatorRequest(): QueryValidatorRequest { + return { validator_addr: "" }; +} + +export const QueryValidatorRequest = { + encode(message: QueryValidatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorRequest { + return { validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "" }; + }, + + toJSON(message: QueryValidatorRequest): unknown { + const obj: any = {}; + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + return obj; + }, + + fromPartial, I>>(object: I): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +function createBaseQueryValidatorResponse(): QueryValidatorResponse { + return { validator: undefined }; +} + +export const QueryValidatorResponse = { + encode(message: QueryValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryValidatorResponse): unknown { + const obj: any = {}; + message.validator !== undefined && + (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryValidatorResponse { + const message = createBaseQueryValidatorResponse(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegationsRequest { + return { validator_addr: "", pagination: undefined }; +} + +export const QueryValidatorDelegationsRequest = { + encode(message: QueryValidatorDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_addr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsRequest { + return { + validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsRequest): unknown { + const obj: any = {}; + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validator_addr = object.validator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { + return { delegation_responses: [], pagination: undefined }; +} + +export const QueryValidatorDelegationsResponse = { + encode(message: QueryValidatorDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.delegation_responses) { + 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: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegation_responses.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; + }, + + fromJSON(object: any): QueryValidatorDelegationsResponse { + return { + delegation_responses: Array.isArray(object?.delegation_responses) + ? object.delegation_responses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegation_responses) { + obj.delegation_responses = message.delegation_responses.map((e) => e ? DelegationResponse.toJSON(e) : undefined); + } else { + obj.delegation_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegation_responses = object.delegation_responses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { + return { validator_addr: "", pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsRequest = { + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_addr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { + return { + validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validator_addr = object.validator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { + return { unbonding_responses: [], pagination: undefined }; +} + +export const QueryValidatorUnbondingDelegationsResponse = { + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.unbonding_responses) { + 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: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.unbonding_responses.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; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { + return { + unbonding_responses: Array.isArray(object?.unbonding_responses) + ? object.unbonding_responses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbonding_responses) { + obj.unbonding_responses = message.unbonding_responses.map((e) => e ? UnbondingDelegation.toJSON(e) : undefined); + } else { + obj.unbonding_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbonding_responses = object.unbonding_responses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegationRequest(): QueryDelegationRequest { + return { delegator_addr: "", validator_addr: "" }; +} + +export const QueryDelegationRequest = { + encode(message: QueryDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.validator_addr !== "") { + writer.uint32(18).string(message.validator_addr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegationRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "", + }; + }, + + toJSON(message: QueryDelegationRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + return obj; + }, + + fromPartial, I>>(object: I): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegationResponse(): QueryDelegationResponse { + return { delegation_response: undefined }; +} + +export const QueryDelegationResponse = { + encode(message: QueryDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegation_response !== undefined) { + DelegationResponse.encode(message.delegation_response, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegation_response = DelegationResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegationResponse { + return { + delegation_response: isSet(object.delegation_response) + ? DelegationResponse.fromJSON(object.delegation_response) + : undefined, + }; + }, + + toJSON(message: QueryDelegationResponse): unknown { + const obj: any = {}; + message.delegation_response !== undefined && (obj.delegation_response = message.delegation_response + ? DelegationResponse.toJSON(message.delegation_response) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + message.delegation_response = (object.delegation_response !== undefined && object.delegation_response !== null) + ? DelegationResponse.fromPartial(object.delegation_response) + : undefined; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { + return { delegator_addr: "", validator_addr: "" }; +} + +export const QueryUnbondingDelegationRequest = { + encode(message: QueryUnbondingDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.validator_addr !== "") { + writer.uint32(18).string(message.validator_addr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "", + }; + }, + + toJSON(message: QueryUnbondingDelegationRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { + return { unbond: undefined }; +} + +export const QueryUnbondingDelegationResponse = { + encode(message: QueryUnbondingDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.unbond !== undefined) { + UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryUnbondingDelegationResponse { + return { unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined }; + }, + + toJSON(message: QueryUnbondingDelegationResponse): unknown { + const obj: any = {}; + message.unbond !== undefined && + (obj.unbond = message.unbond ? UnbondingDelegation.toJSON(message.unbond) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryUnbondingDelegationResponse { + const message = createBaseQueryUnbondingDelegationResponse(); + message.unbond = (object.unbond !== undefined && object.unbond !== null) + ? UnbondingDelegation.fromPartial(object.unbond) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegationsRequest { + return { delegator_addr: "", pagination: undefined }; +} + +export const QueryDelegatorDelegationsRequest = { + encode(message: QueryDelegatorDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { + return { delegation_responses: [], pagination: undefined }; +} + +export const QueryDelegatorDelegationsResponse = { + encode(message: QueryDelegatorDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.delegation_responses) { + 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: _m0.Reader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegation_responses.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; + }, + + fromJSON(object: any): QueryDelegatorDelegationsResponse { + return { + delegation_responses: Array.isArray(object?.delegation_responses) + ? object.delegation_responses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegation_responses) { + obj.delegation_responses = message.delegation_responses.map((e) => e ? DelegationResponse.toJSON(e) : undefined); + } else { + obj.delegation_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegation_responses = object.delegation_responses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { + return { delegator_addr: "", pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsRequest = { + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { + return { unbonding_responses: [], pagination: undefined }; +} + +export const QueryDelegatorUnbondingDelegationsResponse = { + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.unbonding_responses) { + 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: _m0.Reader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.unbonding_responses.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; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { + return { + unbonding_responses: Array.isArray(object?.unbonding_responses) + ? object.unbonding_responses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbonding_responses) { + obj.unbonding_responses = message.unbonding_responses.map((e) => e ? UnbondingDelegation.toJSON(e) : undefined); + } else { + obj.unbonding_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbonding_responses = object.unbonding_responses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { delegator_addr: "", src_validator_addr: "", dst_validator_addr: "", pagination: undefined }; +} + +export const QueryRedelegationsRequest = { + encode(message: QueryRedelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.src_validator_addr !== "") { + writer.uint32(18).string(message.src_validator_addr); + } + if (message.dst_validator_addr !== "") { + writer.uint32(26).string(message.dst_validator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.src_validator_addr = reader.string(); + break; + case 3: + message.dst_validator_addr = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + src_validator_addr: isSet(object.src_validator_addr) ? String(object.src_validator_addr) : "", + dst_validator_addr: isSet(object.dst_validator_addr) ? String(object.dst_validator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.src_validator_addr !== undefined && (obj.src_validator_addr = message.src_validator_addr); + message.dst_validator_addr !== undefined && (obj.dst_validator_addr = message.dst_validator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.src_validator_addr = object.src_validator_addr ?? ""; + message.dst_validator_addr = object.dst_validator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { redelegation_responses: [], pagination: undefined }; +} + +export const QueryRedelegationsResponse = { + encode(message: QueryRedelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.redelegation_responses) { + 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: _m0.Reader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.redelegation_responses.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; + }, + + fromJSON(object: any): QueryRedelegationsResponse { + return { + redelegation_responses: Array.isArray(object?.redelegation_responses) + ? object.redelegation_responses.map((e: any) => RedelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsResponse): unknown { + const obj: any = {}; + if (message.redelegation_responses) { + obj.redelegation_responses = message.redelegation_responses.map((e) => + e ? RedelegationResponse.toJSON(e) : undefined + ); + } else { + obj.redelegation_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegation_responses = object.redelegation_responses?.map((e) => RedelegationResponse.fromPartial(e)) || + []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegator_addr: "", pagination: undefined }; +} + +export const QueryDelegatorValidatorsRequest = { + encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [], pagination: undefined }; +} + +export const QueryDelegatorValidatorsResponse = { + encode(message: QueryDelegatorValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): 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; + }, +}; + +function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequest { + return { delegator_addr: "", validator_addr: "" }; +} + +export const QueryDelegatorValidatorRequest = { + encode(message: QueryDelegatorValidatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.validator_addr !== "") { + writer.uint32(18).string(message.validator_addr); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_addr = reader.string(); + break; + case 2: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? String(object.delegator_addr) : "", + validator_addr: isSet(object.validator_addr) ? String(object.validator_addr) : "", + }; + }, + + toJSON(message: QueryDelegatorValidatorRequest): unknown { + const obj: any = {}; + message.delegator_addr !== undefined && (obj.delegator_addr = message.delegator_addr); + message.validator_addr !== undefined && (obj.validator_addr = message.validator_addr); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { + return { validator: undefined }; +} + +export const QueryDelegatorValidatorResponse = { + encode(message: QueryDelegatorValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryDelegatorValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryDelegatorValidatorResponse): unknown { + const obj: any = {}; + message.validator !== undefined && + (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorValidatorResponse { + const message = createBaseQueryDelegatorValidatorResponse(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + return message; + }, +}; + +function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { + return { height: "0" }; +} + +export const QueryHistoricalInfoRequest = { + encode(message: QueryHistoricalInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoRequest { + return { height: isSet(object.height) ? String(object.height) : "0" }; + }, + + toJSON(message: QueryHistoricalInfoRequest): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>(object: I): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { + return { hist: undefined }; +} + +export const QueryHistoricalInfoResponse = { + encode(message: QueryHistoricalInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hist !== undefined) { + HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryHistoricalInfoResponse { + return { hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined }; + }, + + toJSON(message: QueryHistoricalInfoResponse): unknown { + const obj: any = {}; + message.hist !== undefined && (obj.hist = message.hist ? HistoricalInfo.toJSON(message.hist) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryHistoricalInfoResponse { + const message = createBaseQueryHistoricalInfoResponse(); + message.hist = (object.hist !== undefined && object.hist !== null) + ? HistoricalInfo.fromPartial(object.hist) + : undefined; + return message; + }, +}; + +function createBaseQueryPoolRequest(): QueryPoolRequest { + return {}; +} + +export const QueryPoolRequest = { + encode(_: QueryPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryPoolRequest { + return {}; + }, + + toJSON(_: QueryPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, +}; + +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { pool: undefined }; +} + +export const QueryPoolResponse = { + encode(message: QueryPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool !== undefined) { + Pool.encode(message.pool, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryPoolResponse { + return { pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined }; + }, + + toJSON(message: QueryPoolResponse): unknown { + const obj: any = {}; + message.pool !== undefined && (obj.pool = message.pool ? Pool.toJSON(message.pool) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryPoolResponse { + const message = createBaseQueryPoolResponse(); + message.pool = (object.pool !== undefined && object.pool !== null) ? Pool.fromPartial(object.pool) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Validators queries all validators that match the given status. */ + Validators(request: QueryValidatorsRequest): Promise; + /** Validator queries validator info for given validator address. */ + Validator(request: QueryValidatorRequest): Promise; + /** ValidatorDelegations queries delegate info for given validator. */ + ValidatorDelegations(request: QueryValidatorDelegationsRequest): Promise; + /** ValidatorUnbondingDelegations queries unbonding delegations of a validator. */ + ValidatorUnbondingDelegations( + request: QueryValidatorUnbondingDelegationsRequest, + ): Promise; + /** Delegation queries delegate info for given validator delegator pair. */ + Delegation(request: QueryDelegationRequest): Promise; + /** + * UnbondingDelegation queries unbonding info for given validator delegator + * pair. + */ + UnbondingDelegation(request: QueryUnbondingDelegationRequest): Promise; + /** DelegatorDelegations queries all delegations of a given delegator address. */ + DelegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise; + /** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + */ + DelegatorUnbondingDelegations( + request: QueryDelegatorUnbondingDelegationsRequest, + ): Promise; + /** Redelegations queries redelegations of given address. */ + Redelegations(request: QueryRedelegationsRequest): Promise; + /** + * DelegatorValidators queries all validators info for given delegator + * address. + */ + DelegatorValidators(request: QueryDelegatorValidatorsRequest): Promise; + /** + * DelegatorValidator queries validator info for given delegator validator + * pair. + */ + DelegatorValidator(request: QueryDelegatorValidatorRequest): Promise; + /** HistoricalInfo queries the historical info for given height. */ + HistoricalInfo(request: QueryHistoricalInfoRequest): Promise; + /** Pool queries the pool info. */ + Pool(request: QueryPoolRequest): Promise; + /** Parameters queries the staking parameters. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.staking.v1beta1.Query"; + this.rpc = rpc; + this.Validators = this.Validators.bind(this); + this.Validator = this.Validator.bind(this); + this.ValidatorDelegations = this.ValidatorDelegations.bind(this); + this.ValidatorUnbondingDelegations = this.ValidatorUnbondingDelegations.bind(this); + this.Delegation = this.Delegation.bind(this); + this.UnbondingDelegation = this.UnbondingDelegation.bind(this); + this.DelegatorDelegations = this.DelegatorDelegations.bind(this); + this.DelegatorUnbondingDelegations = this.DelegatorUnbondingDelegations.bind(this); + this.Redelegations = this.Redelegations.bind(this); + this.DelegatorValidators = this.DelegatorValidators.bind(this); + this.DelegatorValidator = this.DelegatorValidator.bind(this); + this.HistoricalInfo = this.HistoricalInfo.bind(this); + this.Pool = this.Pool.bind(this); + this.Params = this.Params.bind(this); + } + Validators(request: QueryValidatorsRequest): Promise { + const data = QueryValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Validators", data); + return promise.then((data) => QueryValidatorsResponse.decode(new _m0.Reader(data))); + } + + Validator(request: QueryValidatorRequest): Promise { + const data = QueryValidatorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Validator", data); + return promise.then((data) => QueryValidatorResponse.decode(new _m0.Reader(data))); + } + + ValidatorDelegations(request: QueryValidatorDelegationsRequest): Promise { + const data = QueryValidatorDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorDelegations", data); + return promise.then((data) => QueryValidatorDelegationsResponse.decode(new _m0.Reader(data))); + } + + ValidatorUnbondingDelegations( + request: QueryValidatorUnbondingDelegationsRequest, + ): Promise { + const data = QueryValidatorUnbondingDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ValidatorUnbondingDelegations", data); + return promise.then((data) => QueryValidatorUnbondingDelegationsResponse.decode(new _m0.Reader(data))); + } + + Delegation(request: QueryDelegationRequest): Promise { + const data = QueryDelegationRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Delegation", data); + return promise.then((data) => QueryDelegationResponse.decode(new _m0.Reader(data))); + } + + UnbondingDelegation(request: QueryUnbondingDelegationRequest): Promise { + const data = QueryUnbondingDelegationRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnbondingDelegation", data); + return promise.then((data) => QueryUnbondingDelegationResponse.decode(new _m0.Reader(data))); + } + + DelegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise { + const data = QueryDelegatorDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorDelegations", data); + return promise.then((data) => QueryDelegatorDelegationsResponse.decode(new _m0.Reader(data))); + } + + DelegatorUnbondingDelegations( + request: QueryDelegatorUnbondingDelegationsRequest, + ): Promise { + const data = QueryDelegatorUnbondingDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorUnbondingDelegations", data); + return promise.then((data) => QueryDelegatorUnbondingDelegationsResponse.decode(new _m0.Reader(data))); + } + + Redelegations(request: QueryRedelegationsRequest): Promise { + const data = QueryRedelegationsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Redelegations", data); + return promise.then((data) => QueryRedelegationsResponse.decode(new _m0.Reader(data))); + } + + DelegatorValidators(request: QueryDelegatorValidatorsRequest): Promise { + const data = QueryDelegatorValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorValidators", data); + return promise.then((data) => QueryDelegatorValidatorsResponse.decode(new _m0.Reader(data))); + } + + DelegatorValidator(request: QueryDelegatorValidatorRequest): Promise { + const data = QueryDelegatorValidatorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorValidator", data); + return promise.then((data) => QueryDelegatorValidatorResponse.decode(new _m0.Reader(data))); + } + + HistoricalInfo(request: QueryHistoricalInfoRequest): Promise { + const data = QueryHistoricalInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "HistoricalInfo", data); + return promise.then((data) => QueryHistoricalInfoResponse.decode(new _m0.Reader(data))); + } + + Pool(request: QueryPoolRequest): Promise { + const data = QueryPoolRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pool", data); + return promise.then((data) => QueryPoolResponse.decode(new _m0.Reader(data))); + } + + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/staking/v1beta1/staking.ts b/common/types/src/lcd/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 00000000..d5851fce --- /dev/null +++ b/common/types/src/lcd/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,1803 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Duration } from "../../../google/protobuf/duration"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Header } from "../../../tendermint/types/types"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** BondStatus is the status of a validator. */ +export enum BondStatus { + /** BOND_STATUS_UNSPECIFIED - UNSPECIFIED defines an invalid validator status. */ + BOND_STATUS_UNSPECIFIED = "BOND_STATUS_UNSPECIFIED", + /** BOND_STATUS_UNBONDED - UNBONDED defines a validator that is not bonded. */ + BOND_STATUS_UNBONDED = "BOND_STATUS_UNBONDED", + /** BOND_STATUS_UNBONDING - UNBONDING defines a validator that is unbonding. */ + BOND_STATUS_UNBONDING = "BOND_STATUS_UNBONDING", + /** BOND_STATUS_BONDED - BONDED defines a validator that is bonded. */ + BOND_STATUS_BONDED = "BOND_STATUS_BONDED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function bondStatusToNumber(object: BondStatus): number { + switch (object) { + case BondStatus.BOND_STATUS_UNSPECIFIED: + return 0; + case BondStatus.BOND_STATUS_UNBONDED: + return 1; + case BondStatus.BOND_STATUS_UNBONDING: + return 2; + case BondStatus.BOND_STATUS_BONDED: + return 3; + case BondStatus.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * 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[]; +} + +/** + * 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. */ + max_rate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + max_change_rate: string; +} + +/** 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. */ + commission_rates?: CommissionRates; + /** update_time is the last time the commission rate was changed. */ + update_time?: Date; +} + +/** 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. */ + security_contact: string; + /** details define other optional details. */ + details: string; +} + +/** + * 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. */ + operator_address: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensus_pubkey?: Any; + /** 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?: Description; + /** 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?: Date; + /** commission defines the commission parameters. */ + commission?: Commission; + /** min_self_delegation is the validator's self declared minimum self delegation. */ + min_self_delegation: string; +} + +/** ValAddresses defines a repeated set of validator addresses. */ +export interface ValAddresses { + addresses: string[]; +} + +/** + * 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 { + delegator_address: string; + validator_address: string; +} + +/** DVPairs defines an array of DVPair objects. */ +export interface DVPairs { + pairs: DVPair[]; +} + +/** + * 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 { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; +} + +/** DVVTriplets defines an array of DVVTriplet objects. */ +export interface DVVTriplets { + triplets: DVVTriplet[]; +} + +/** + * 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 bech32-encoded address of the delegator. */ + delegator_address: string; + /** validator_address is the bech32-encoded address of the validator. */ + validator_address: string; + /** shares define the delegation shares received. */ + shares: string; +} + +/** + * 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 bech32-encoded address of the delegator. */ + delegator_address: string; + /** validator_address is the bech32-encoded address of the validator. */ + validator_address: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntry[]; +} + +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntry { + /** creation_height is the height which the unbonding took place. */ + creation_height: string; + /** completion_time is the unix time for unbonding completion. */ + completion_time?: Date; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initial_balance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; +} + +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntry { + /** creation_height defines the height which the redelegation took place. */ + creation_height: string; + /** completion_time defines the unix time for redelegation completion. */ + completion_time?: Date; + /** 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; +} + +/** + * 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. */ + 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: RedelegationEntry[]; +} + +/** Params defines the parameters for the staking module. */ +export interface Params { + /** unbonding_time is the time duration of unbonding. */ + unbonding_time?: Duration; + /** 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; +} + +/** + * 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; +} + +/** + * 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 { + redelegation_entry?: RedelegationEntry; + balance: string; +} + +/** + * 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[]; +} + +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface Pool { + not_bonded_tokens: string; + bonded_tokens: string; +} + +function createBaseHistoricalInfo(): HistoricalInfo { + return { header: undefined, valset: [] }; +} + +export const HistoricalInfo = { + encode(message: HistoricalInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): HistoricalInfo { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + valset: Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [], + }; + }, + + toJSON(message: HistoricalInfo): unknown { + const obj: any = {}; + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + if (message.valset) { + obj.valset = message.valset.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.valset = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseCommissionRates(): CommissionRates { + return { rate: "", max_rate: "", max_change_rate: "" }; +} + +export const CommissionRates = { + encode(message: CommissionRates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.max_rate !== "") { + writer.uint32(18).string(message.max_rate); + } + if (message.max_change_rate !== "") { + writer.uint32(26).string(message.max_change_rate); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.max_rate = reader.string(); + break; + case 3: + message.max_change_rate = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommissionRates { + return { + rate: isSet(object.rate) ? String(object.rate) : "", + max_rate: isSet(object.max_rate) ? String(object.max_rate) : "", + max_change_rate: isSet(object.max_change_rate) ? String(object.max_change_rate) : "", + }; + }, + + toJSON(message: CommissionRates): unknown { + const obj: any = {}; + message.rate !== undefined && (obj.rate = message.rate); + message.max_rate !== undefined && (obj.max_rate = message.max_rate); + message.max_change_rate !== undefined && (obj.max_change_rate = message.max_change_rate); + return obj; + }, + + fromPartial, I>>(object: I): CommissionRates { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.max_rate = object.max_rate ?? ""; + message.max_change_rate = object.max_change_rate ?? ""; + return message; + }, +}; + +function createBaseCommission(): Commission { + return { commission_rates: undefined, update_time: undefined }; +} + +export const Commission = { + encode(message: Commission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.commission_rates !== undefined) { + CommissionRates.encode(message.commission_rates, writer.uint32(10).fork()).ldelim(); + } + if (message.update_time !== undefined) { + Timestamp.encode(toTimestamp(message.update_time), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Commission { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.commission_rates = CommissionRates.decode(reader, reader.uint32()); + break; + case 2: + message.update_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Commission { + return { + commission_rates: isSet(object.commission_rates) ? CommissionRates.fromJSON(object.commission_rates) : undefined, + update_time: isSet(object.update_time) ? fromJsonTimestamp(object.update_time) : undefined, + }; + }, + + toJSON(message: Commission): unknown { + const obj: any = {}; + message.commission_rates !== undefined && + (obj.commission_rates = message.commission_rates ? CommissionRates.toJSON(message.commission_rates) : undefined); + message.update_time !== undefined && (obj.update_time = message.update_time.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): Commission { + const message = createBaseCommission(); + message.commission_rates = (object.commission_rates !== undefined && object.commission_rates !== null) + ? CommissionRates.fromPartial(object.commission_rates) + : undefined; + message.update_time = object.update_time ?? undefined; + return message; + }, +}; + +function createBaseDescription(): Description { + return { moniker: "", identity: "", website: "", security_contact: "", details: "" }; +} + +export const Description = { + encode(message: Description, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.security_contact !== "") { + writer.uint32(34).string(message.security_contact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Description { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.security_contact = reader.string(); + break; + case 5: + message.details = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Description { + return { + moniker: isSet(object.moniker) ? String(object.moniker) : "", + identity: isSet(object.identity) ? String(object.identity) : "", + website: isSet(object.website) ? String(object.website) : "", + security_contact: isSet(object.security_contact) ? String(object.security_contact) : "", + details: isSet(object.details) ? String(object.details) : "", + }; + }, + + toJSON(message: Description): unknown { + const obj: any = {}; + message.moniker !== undefined && (obj.moniker = message.moniker); + message.identity !== undefined && (obj.identity = message.identity); + message.website !== undefined && (obj.website = message.website); + message.security_contact !== undefined && (obj.security_contact = message.security_contact); + message.details !== undefined && (obj.details = message.details); + return obj; + }, + + fromPartial, I>>(object: I): Description { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.security_contact = object.security_contact ?? ""; + message.details = object.details ?? ""; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { + operator_address: "", + consensus_pubkey: undefined, + jailed: false, + status: BondStatus.BOND_STATUS_UNSPECIFIED, + tokens: "", + delegator_shares: "", + description: undefined, + unbonding_height: "0", + unbonding_time: undefined, + commission: undefined, + min_self_delegation: "", + }; +} + +export const Validator = { + encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.operator_address !== "") { + writer.uint32(10).string(message.operator_address); + } + if (message.consensus_pubkey !== undefined) { + Any.encode(message.consensus_pubkey, writer.uint32(18).fork()).ldelim(); + } + if (message.jailed === true) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== BondStatus.BOND_STATUS_UNSPECIFIED) { + writer.uint32(32).int32(bondStatusToNumber(message.status)); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegator_shares !== "") { + writer.uint32(50).string(message.delegator_shares); + } + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(58).fork()).ldelim(); + } + if (message.unbonding_height !== "0") { + writer.uint32(64).int64(message.unbonding_height); + } + if (message.unbonding_time !== undefined) { + Timestamp.encode(toTimestamp(message.unbonding_time), writer.uint32(74).fork()).ldelim(); + } + if (message.commission !== undefined) { + Commission.encode(message.commission, writer.uint32(82).fork()).ldelim(); + } + if (message.min_self_delegation !== "") { + writer.uint32(90).string(message.min_self_delegation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Validator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.operator_address = reader.string(); + break; + case 2: + message.consensus_pubkey = Any.decode(reader, reader.uint32()); + break; + case 3: + message.jailed = reader.bool(); + break; + case 4: + message.status = bondStatusFromJSON(reader.int32()); + break; + case 5: + message.tokens = reader.string(); + break; + case 6: + message.delegator_shares = reader.string(); + break; + case 7: + message.description = Description.decode(reader, reader.uint32()); + break; + case 8: + message.unbonding_height = longToString(reader.int64() as Long); + break; + case 9: + message.unbonding_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 10: + message.commission = Commission.decode(reader, reader.uint32()); + break; + case 11: + message.min_self_delegation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Validator { + return { + operator_address: isSet(object.operator_address) ? String(object.operator_address) : "", + consensus_pubkey: isSet(object.consensus_pubkey) ? Any.fromJSON(object.consensus_pubkey) : undefined, + jailed: isSet(object.jailed) ? Boolean(object.jailed) : false, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : BondStatus.BOND_STATUS_UNSPECIFIED, + tokens: isSet(object.tokens) ? String(object.tokens) : "", + delegator_shares: isSet(object.delegator_shares) ? String(object.delegator_shares) : "", + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + unbonding_height: isSet(object.unbonding_height) ? String(object.unbonding_height) : "0", + unbonding_time: isSet(object.unbonding_time) ? fromJsonTimestamp(object.unbonding_time) : undefined, + commission: isSet(object.commission) ? Commission.fromJSON(object.commission) : undefined, + min_self_delegation: isSet(object.min_self_delegation) ? String(object.min_self_delegation) : "", + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + message.operator_address !== undefined && (obj.operator_address = message.operator_address); + message.consensus_pubkey !== undefined && + (obj.consensus_pubkey = message.consensus_pubkey ? Any.toJSON(message.consensus_pubkey) : undefined); + message.jailed !== undefined && (obj.jailed = message.jailed); + message.status !== undefined && (obj.status = bondStatusToJSON(message.status)); + message.tokens !== undefined && (obj.tokens = message.tokens); + message.delegator_shares !== undefined && (obj.delegator_shares = message.delegator_shares); + message.description !== undefined && + (obj.description = message.description ? Description.toJSON(message.description) : undefined); + message.unbonding_height !== undefined && (obj.unbonding_height = message.unbonding_height); + message.unbonding_time !== undefined && (obj.unbonding_time = message.unbonding_time.toISOString()); + message.commission !== undefined && + (obj.commission = message.commission ? Commission.toJSON(message.commission) : undefined); + message.min_self_delegation !== undefined && (obj.min_self_delegation = message.min_self_delegation); + return obj; + }, + + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.operator_address = object.operator_address ?? ""; + message.consensus_pubkey = (object.consensus_pubkey !== undefined && object.consensus_pubkey !== null) + ? Any.fromPartial(object.consensus_pubkey) + : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? BondStatus.BOND_STATUS_UNSPECIFIED; + message.tokens = object.tokens ?? ""; + message.delegator_shares = object.delegator_shares ?? ""; + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.unbonding_height = object.unbonding_height ?? "0"; + message.unbonding_time = object.unbonding_time ?? undefined; + message.commission = (object.commission !== undefined && object.commission !== null) + ? Commission.fromPartial(object.commission) + : undefined; + message.min_self_delegation = object.min_self_delegation ?? ""; + return message; + }, +}; + +function createBaseValAddresses(): ValAddresses { + return { addresses: [] }; +} + +export const ValAddresses = { + encode(message: ValAddresses, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ValAddresses { + return { addresses: Array.isArray(object?.addresses) ? object.addresses.map((e: any) => String(e)) : [] }; + }, + + toJSON(message: ValAddresses): unknown { + const obj: any = {}; + if (message.addresses) { + obj.addresses = message.addresses.map((e) => e); + } else { + obj.addresses = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDVPair(): DVPair { + return { delegator_address: "", validator_address: "" }; +} + +export const DVPair = { + encode(message: DVPair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DVPair { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DVPair { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + }; + }, + + toJSON(message: DVPair): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + return obj; + }, + + fromPartial, I>>(object: I): DVPair { + const message = createBaseDVPair(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +function createBaseDVPairs(): DVPairs { + return { pairs: [] }; +} + +export const DVPairs = { + encode(message: DVPairs, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pairs) { + DVPair.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DVPairs { + return { pairs: Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] }; + }, + + toJSON(message: DVPairs): unknown { + const obj: any = {}; + if (message.pairs) { + obj.pairs = message.pairs.map((e) => e ? DVPair.toJSON(e) : undefined); + } else { + obj.pairs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map((e) => DVPair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDVVTriplet(): DVVTriplet { + return { delegator_address: "", validator_src_address: "", validator_dst_address: "" }; +} + +export const DVVTriplet = { + encode(message: DVVTriplet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_src_address !== "") { + writer.uint32(18).string(message.validator_src_address); + } + if (message.validator_dst_address !== "") { + writer.uint32(26).string(message.validator_dst_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_src_address = reader.string(); + break; + case 3: + message.validator_dst_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DVVTriplet { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_src_address: isSet(object.validator_src_address) ? String(object.validator_src_address) : "", + validator_dst_address: isSet(object.validator_dst_address) ? String(object.validator_dst_address) : "", + }; + }, + + toJSON(message: DVVTriplet): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_src_address !== undefined && (obj.validator_src_address = message.validator_src_address); + message.validator_dst_address !== undefined && (obj.validator_dst_address = message.validator_dst_address); + return obj; + }, + + fromPartial, I>>(object: I): DVVTriplet { + const message = createBaseDVVTriplet(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_src_address = object.validator_src_address ?? ""; + message.validator_dst_address = object.validator_dst_address ?? ""; + return message; + }, +}; + +function createBaseDVVTriplets(): DVVTriplets { + return { triplets: [] }; +} + +export const DVVTriplets = { + encode(message: DVVTriplets, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.triplets) { + DVVTriplet.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DVVTriplets { + return { triplets: Array.isArray(object?.triplets) ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) : [] }; + }, + + toJSON(message: DVVTriplets): unknown { + const obj: any = {}; + if (message.triplets) { + obj.triplets = message.triplets.map((e) => e ? DVVTriplet.toJSON(e) : undefined); + } else { + obj.triplets = []; + } + return obj; + }, + + fromPartial, I>>(object: I): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map((e) => DVVTriplet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDelegation(): Delegation { + return { delegator_address: "", validator_address: "", shares: "" }; +} + +export const Delegation = { + encode(message: Delegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Delegation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.shares = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Delegation { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + shares: isSet(object.shares) ? String(object.shares) : "", + }; + }, + + toJSON(message: Delegation): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.shares !== undefined && (obj.shares = message.shares); + return obj; + }, + + fromPartial, I>>(object: I): Delegation { + const message = createBaseDelegation(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.shares = object.shares ?? ""; + return message; + }, +}; + +function createBaseUnbondingDelegation(): UnbondingDelegation { + return { delegator_address: "", validator_address: "", entries: [] }; +} + +export const UnbondingDelegation = { + encode(message: UnbondingDelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + for (const v of message.entries) { + UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingDelegation { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + entries: Array.isArray(object?.entries) + ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: UnbondingDelegation): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + if (message.entries) { + obj.entries = message.entries.map((e) => e ? UnbondingDelegationEntry.toJSON(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + + fromPartial, I>>(object: I): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.entries = object.entries?.map((e) => UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { + return { creation_height: "0", completion_time: undefined, initial_balance: "", balance: "" }; +} + +export const UnbondingDelegationEntry = { + encode(message: UnbondingDelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creation_height !== "0") { + writer.uint32(8).int64(message.creation_height); + } + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(18).fork()).ldelim(); + } + if (message.initial_balance !== "") { + writer.uint32(26).string(message.initial_balance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.creation_height = longToString(reader.int64() as Long); + break; + case 2: + message.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.initial_balance = reader.string(); + break; + case 4: + message.balance = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationEntry { + return { + creation_height: isSet(object.creation_height) ? String(object.creation_height) : "0", + completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined, + initial_balance: isSet(object.initial_balance) ? String(object.initial_balance) : "", + balance: isSet(object.balance) ? String(object.balance) : "", + }; + }, + + toJSON(message: UnbondingDelegationEntry): unknown { + const obj: any = {}; + message.creation_height !== undefined && (obj.creation_height = message.creation_height); + message.completion_time !== undefined && (obj.completion_time = message.completion_time.toISOString()); + message.initial_balance !== undefined && (obj.initial_balance = message.initial_balance); + message.balance !== undefined && (obj.balance = message.balance); + return obj; + }, + + fromPartial, I>>(object: I): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + message.creation_height = object.creation_height ?? "0"; + message.completion_time = object.completion_time ?? undefined; + message.initial_balance = object.initial_balance ?? ""; + message.balance = object.balance ?? ""; + return message; + }, +}; + +function createBaseRedelegationEntry(): RedelegationEntry { + return { creation_height: "0", completion_time: undefined, initial_balance: "", shares_dst: "" }; +} + +export const RedelegationEntry = { + encode(message: RedelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creation_height !== "0") { + writer.uint32(8).int64(message.creation_height); + } + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(18).fork()).ldelim(); + } + if (message.initial_balance !== "") { + writer.uint32(26).string(message.initial_balance); + } + if (message.shares_dst !== "") { + writer.uint32(34).string(message.shares_dst); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.creation_height = longToString(reader.int64() as Long); + break; + case 2: + message.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.initial_balance = reader.string(); + break; + case 4: + message.shares_dst = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RedelegationEntry { + return { + creation_height: isSet(object.creation_height) ? String(object.creation_height) : "0", + completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined, + initial_balance: isSet(object.initial_balance) ? String(object.initial_balance) : "", + shares_dst: isSet(object.shares_dst) ? String(object.shares_dst) : "", + }; + }, + + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + message.creation_height !== undefined && (obj.creation_height = message.creation_height); + message.completion_time !== undefined && (obj.completion_time = message.completion_time.toISOString()); + message.initial_balance !== undefined && (obj.initial_balance = message.initial_balance); + message.shares_dst !== undefined && (obj.shares_dst = message.shares_dst); + return obj; + }, + + fromPartial, I>>(object: I): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creation_height = object.creation_height ?? "0"; + message.completion_time = object.completion_time ?? undefined; + message.initial_balance = object.initial_balance ?? ""; + message.shares_dst = object.shares_dst ?? ""; + return message; + }, +}; + +function createBaseRedelegation(): Redelegation { + return { delegator_address: "", validator_src_address: "", validator_dst_address: "", entries: [] }; +} + +export const Redelegation = { + encode(message: Redelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_src_address !== "") { + writer.uint32(18).string(message.validator_src_address); + } + if (message.validator_dst_address !== "") { + writer.uint32(26).string(message.validator_dst_address); + } + for (const v of message.entries) { + RedelegationEntry.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_src_address = reader.string(); + break; + case 3: + message.validator_dst_address = reader.string(); + break; + case 4: + message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Redelegation { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_src_address: isSet(object.validator_src_address) ? String(object.validator_src_address) : "", + validator_dst_address: isSet(object.validator_dst_address) ? String(object.validator_dst_address) : "", + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) : [], + }; + }, + + toJSON(message: Redelegation): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_src_address !== undefined && (obj.validator_src_address = message.validator_src_address); + message.validator_dst_address !== undefined && (obj.validator_dst_address = message.validator_dst_address); + if (message.entries) { + obj.entries = message.entries.map((e) => e ? RedelegationEntry.toJSON(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Redelegation { + const message = createBaseRedelegation(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_src_address = object.validator_src_address ?? ""; + message.validator_dst_address = object.validator_dst_address ?? ""; + message.entries = object.entries?.map((e) => RedelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + unbonding_time: undefined, + max_validators: 0, + max_entries: 0, + historical_entries: 0, + bond_denom: "", + min_commission_rate: "", + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.unbonding_time !== undefined) { + Duration.encode(message.unbonding_time, writer.uint32(10).fork()).ldelim(); + } + if (message.max_validators !== 0) { + writer.uint32(16).uint32(message.max_validators); + } + if (message.max_entries !== 0) { + writer.uint32(24).uint32(message.max_entries); + } + if (message.historical_entries !== 0) { + writer.uint32(32).uint32(message.historical_entries); + } + if (message.bond_denom !== "") { + writer.uint32(42).string(message.bond_denom); + } + if (message.min_commission_rate !== "") { + writer.uint32(50).string(message.min_commission_rate); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.unbonding_time = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.max_validators = reader.uint32(); + break; + case 3: + message.max_entries = reader.uint32(); + break; + case 4: + message.historical_entries = reader.uint32(); + break; + case 5: + message.bond_denom = reader.string(); + break; + case 6: + message.min_commission_rate = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + unbonding_time: isSet(object.unbonding_time) ? Duration.fromJSON(object.unbonding_time) : undefined, + max_validators: isSet(object.max_validators) ? Number(object.max_validators) : 0, + max_entries: isSet(object.max_entries) ? Number(object.max_entries) : 0, + historical_entries: isSet(object.historical_entries) ? Number(object.historical_entries) : 0, + bond_denom: isSet(object.bond_denom) ? String(object.bond_denom) : "", + min_commission_rate: isSet(object.min_commission_rate) ? String(object.min_commission_rate) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.unbonding_time !== undefined && + (obj.unbonding_time = message.unbonding_time ? Duration.toJSON(message.unbonding_time) : undefined); + message.max_validators !== undefined && (obj.max_validators = Math.round(message.max_validators)); + message.max_entries !== undefined && (obj.max_entries = Math.round(message.max_entries)); + message.historical_entries !== undefined && (obj.historical_entries = Math.round(message.historical_entries)); + message.bond_denom !== undefined && (obj.bond_denom = message.bond_denom); + message.min_commission_rate !== undefined && (obj.min_commission_rate = message.min_commission_rate); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.unbonding_time = (object.unbonding_time !== undefined && object.unbonding_time !== null) + ? Duration.fromPartial(object.unbonding_time) + : undefined; + message.max_validators = object.max_validators ?? 0; + message.max_entries = object.max_entries ?? 0; + message.historical_entries = object.historical_entries ?? 0; + message.bond_denom = object.bond_denom ?? ""; + message.min_commission_rate = object.min_commission_rate ?? ""; + return message; + }, +}; + +function createBaseDelegationResponse(): DelegationResponse { + return { delegation: undefined, balance: undefined }; +} + +export const DelegationResponse = { + encode(message: DelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DelegationResponse { + return { + delegation: isSet(object.delegation) ? Delegation.fromJSON(object.delegation) : undefined, + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, + }; + }, + + toJSON(message: DelegationResponse): unknown { + const obj: any = {}; + message.delegation !== undefined && + (obj.delegation = message.delegation ? Delegation.toJSON(message.delegation) : undefined); + message.balance !== undefined && (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseRedelegationEntryResponse(): RedelegationEntryResponse { + return { redelegation_entry: undefined, balance: "" }; +} + +export const RedelegationEntryResponse = { + encode(message: RedelegationEntryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.redelegation_entry !== undefined) { + RedelegationEntry.encode(message.redelegation_entry, writer.uint32(10).fork()).ldelim(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.redelegation_entry = RedelegationEntry.decode(reader, reader.uint32()); + break; + case 4: + message.balance = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RedelegationEntryResponse { + return { + redelegation_entry: isSet(object.redelegation_entry) + ? RedelegationEntry.fromJSON(object.redelegation_entry) + : undefined, + balance: isSet(object.balance) ? String(object.balance) : "", + }; + }, + + toJSON(message: RedelegationEntryResponse): unknown { + const obj: any = {}; + message.redelegation_entry !== undefined && (obj.redelegation_entry = message.redelegation_entry + ? RedelegationEntry.toJSON(message.redelegation_entry) + : undefined); + message.balance !== undefined && (obj.balance = message.balance); + return obj; + }, + + fromPartial, I>>(object: I): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + message.redelegation_entry = (object.redelegation_entry !== undefined && object.redelegation_entry !== null) + ? RedelegationEntry.fromPartial(object.redelegation_entry) + : undefined; + message.balance = object.balance ?? ""; + return message; + }, +}; + +function createBaseRedelegationResponse(): RedelegationResponse { + return { redelegation: undefined, entries: [] }; +} + +export const RedelegationResponse = { + encode(message: RedelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): RedelegationResponse { + return { + redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined, + entries: Array.isArray(object?.entries) + ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RedelegationResponse): unknown { + const obj: any = {}; + message.redelegation !== undefined && + (obj.redelegation = message.redelegation ? Redelegation.toJSON(message.redelegation) : undefined); + if (message.entries) { + obj.entries = message.entries.map((e) => e ? RedelegationEntryResponse.toJSON(e) : undefined); + } else { + obj.entries = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBasePool(): Pool { + return { not_bonded_tokens: "", bonded_tokens: "" }; +} + +export const Pool = { + encode(message: Pool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.not_bonded_tokens !== "") { + writer.uint32(10).string(message.not_bonded_tokens); + } + if (message.bonded_tokens !== "") { + writer.uint32(18).string(message.bonded_tokens); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Pool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.not_bonded_tokens = reader.string(); + break; + case 2: + message.bonded_tokens = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Pool { + return { + not_bonded_tokens: isSet(object.not_bonded_tokens) ? String(object.not_bonded_tokens) : "", + bonded_tokens: isSet(object.bonded_tokens) ? String(object.bonded_tokens) : "", + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + message.not_bonded_tokens !== undefined && (obj.not_bonded_tokens = message.not_bonded_tokens); + message.bonded_tokens !== undefined && (obj.bonded_tokens = message.bonded_tokens); + return obj; + }, + + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.not_bonded_tokens = object.not_bonded_tokens ?? ""; + message.bonded_tokens = object.bonded_tokens ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/staking/v1beta1/tx.ts b/common/types/src/lcd/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 00000000..b38c9f5c --- /dev/null +++ b/common/types/src/lcd/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,818 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Coin } from "../../base/v1beta1/coin"; +import { CommissionRates, Description } from "./staking"; + +export const protobufPackage = "cosmos.staking.v1beta1"; + +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidator { + description?: Description; + commission?: CommissionRates; + min_self_delegation: string; + delegator_address: string; + validator_address: string; + pubkey?: Any; + value?: Coin; +} + +/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ +export interface MsgCreateValidatorResponse { +} + +/** MsgEditValidator defines a SDK message for editing an existing validator. */ +export interface MsgEditValidator { + description?: Description; + 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; +} + +/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ +export interface MsgEditValidatorResponse { +} + +/** + * MsgDelegate defines a SDK message for performing a delegation of coins + * from a delegator to a validator. + */ +export interface MsgDelegate { + delegator_address: string; + validator_address: string; + amount?: Coin; +} + +/** MsgDelegateResponse defines the Msg/Delegate response type. */ +export interface MsgDelegateResponse { +} + +/** + * MsgBeginRedelegate defines a SDK message for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ +export interface MsgBeginRedelegate { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; + amount?: Coin; +} + +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponse { + completion_time?: Date; +} + +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegate { + delegator_address: string; + validator_address: string; + amount?: Coin; +} + +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponse { + completion_time?: Date; +} + +function createBaseMsgCreateValidator(): MsgCreateValidator { + return { + description: undefined, + commission: undefined, + min_self_delegation: "", + delegator_address: "", + validator_address: "", + pubkey: undefined, + value: undefined, + }; +} + +export const MsgCreateValidator = { + encode(message: MsgCreateValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.min_self_delegation !== "") { + writer.uint32(26).string(message.min_self_delegation); + } + if (message.delegator_address !== "") { + writer.uint32(34).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(42).string(message.validator_address); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(50).fork()).ldelim(); + } + if (message.value !== undefined) { + Coin.encode(message.value, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.min_self_delegation = reader.string(); + break; + case 4: + message.delegator_address = reader.string(); + break; + case 5: + message.validator_address = reader.string(); + break; + case 6: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 7: + message.value = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + commission: isSet(object.commission) ? CommissionRates.fromJSON(object.commission) : undefined, + min_self_delegation: isSet(object.min_self_delegation) ? String(object.min_self_delegation) : "", + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + pubkey: isSet(object.pubkey) ? Any.fromJSON(object.pubkey) : undefined, + value: isSet(object.value) ? Coin.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: MsgCreateValidator): unknown { + const obj: any = {}; + message.description !== undefined && + (obj.description = message.description ? Description.toJSON(message.description) : undefined); + message.commission !== undefined && + (obj.commission = message.commission ? CommissionRates.toJSON(message.commission) : undefined); + message.min_self_delegation !== undefined && (obj.min_self_delegation = message.min_self_delegation); + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.value !== undefined && (obj.value = message.value ? Coin.toJSON(message.value) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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.min_self_delegation = object.min_self_delegation ?? ""; + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.pubkey = (object.pubkey !== undefined && object.pubkey !== null) + ? Any.fromPartial(object.pubkey) + : undefined; + message.value = (object.value !== undefined && object.value !== null) ? Coin.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse { + return {}; +} + +export const MsgCreateValidatorResponse = { + encode(_: MsgCreateValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgCreateValidatorResponse { + return {}; + }, + + toJSON(_: MsgCreateValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, +}; + +function createBaseMsgEditValidator(): MsgEditValidator { + return { description: undefined, validator_address: "", commission_rate: "", min_self_delegation: "" }; +} + +export const MsgEditValidator = { + encode(message: MsgEditValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).ldelim(); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.commission_rate !== "") { + writer.uint32(26).string(message.commission_rate); + } + if (message.min_self_delegation !== "") { + writer.uint32(34).string(message.min_self_delegation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.validator_address = reader.string(); + break; + case 3: + message.commission_rate = reader.string(); + break; + case 4: + message.min_self_delegation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgEditValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + commission_rate: isSet(object.commission_rate) ? String(object.commission_rate) : "", + min_self_delegation: isSet(object.min_self_delegation) ? String(object.min_self_delegation) : "", + }; + }, + + toJSON(message: MsgEditValidator): unknown { + const obj: any = {}; + message.description !== undefined && + (obj.description = message.description ? Description.toJSON(message.description) : undefined); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.commission_rate !== undefined && (obj.commission_rate = message.commission_rate); + message.min_self_delegation !== undefined && (obj.min_self_delegation = message.min_self_delegation); + return obj; + }, + + fromPartial, I>>(object: I): MsgEditValidator { + const message = createBaseMsgEditValidator(); + message.description = (object.description !== undefined && object.description !== null) + ? Description.fromPartial(object.description) + : undefined; + message.validator_address = object.validator_address ?? ""; + message.commission_rate = object.commission_rate ?? ""; + message.min_self_delegation = object.min_self_delegation ?? ""; + return message; + }, +}; + +function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { + return {}; +} + +export const MsgEditValidatorResponse = { + encode(_: MsgEditValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgEditValidatorResponse { + return {}; + }, + + toJSON(_: MsgEditValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, +}; + +function createBaseMsgDelegate(): MsgDelegate { + return { delegator_address: "", validator_address: "", amount: undefined }; +} + +export const MsgDelegate = { + encode(message: MsgDelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDelegate { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgDelegate { + const message = createBaseMsgDelegate(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} + +export const MsgDelegateResponse = { + encode(_: MsgDelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgDelegateResponse { + return {}; + }, + + toJSON(_: MsgDelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; + +function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { + return { delegator_address: "", validator_src_address: "", validator_dst_address: "", amount: undefined }; +} + +export const MsgBeginRedelegate = { + encode(message: MsgBeginRedelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_src_address !== "") { + writer.uint32(18).string(message.validator_src_address); + } + if (message.validator_dst_address !== "") { + writer.uint32(26).string(message.validator_dst_address); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_src_address = reader.string(); + break; + case 3: + message.validator_dst_address = reader.string(); + break; + case 4: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegate { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_src_address: isSet(object.validator_src_address) ? String(object.validator_src_address) : "", + validator_dst_address: isSet(object.validator_dst_address) ? String(object.validator_dst_address) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgBeginRedelegate): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_src_address !== undefined && (obj.validator_src_address = message.validator_src_address); + message.validator_dst_address !== undefined && (obj.validator_dst_address = message.validator_dst_address); + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_src_address = object.validator_src_address ?? ""; + message.validator_dst_address = object.validator_dst_address ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { + return { completion_time: undefined }; +} + +export const MsgBeginRedelegateResponse = { + encode(message: MsgBeginRedelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegateResponse { + return { completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined }; + }, + + toJSON(message: MsgBeginRedelegateResponse): unknown { + const obj: any = {}; + message.completion_time !== undefined && (obj.completion_time = message.completion_time.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + message.completion_time = object.completion_time ?? undefined; + return message; + }, +}; + +function createBaseMsgUndelegate(): MsgUndelegate { + return { delegator_address: "", validator_address: "", amount: undefined }; +} + +export const MsgUndelegate = { + encode(message: MsgUndelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUndelegate { + return { + delegator_address: isSet(object.delegator_address) ? String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? String(object.validator_address) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + message.delegator_address !== undefined && (obj.delegator_address = message.delegator_address); + message.validator_address !== undefined && (obj.validator_address = message.validator_address); + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.amount = (object.amount !== undefined && object.amount !== null) + ? Coin.fromPartial(object.amount) + : undefined; + return message; + }, +}; + +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return { completion_time: undefined }; +} + +export const MsgUndelegateResponse = { + encode(message: MsgUndelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUndelegateResponse { + return { completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined }; + }, + + toJSON(message: MsgUndelegateResponse): unknown { + const obj: any = {}; + message.completion_time !== undefined && (obj.completion_time = message.completion_time.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + message.completion_time = object.completion_time ?? undefined; + return message; + }, +}; + +/** Msg defines the staking Msg service. */ +export interface Msg { + /** CreateValidator defines a method for creating a new validator. */ + CreateValidator(request: MsgCreateValidator): Promise; + /** EditValidator defines a method for editing an existing validator. */ + EditValidator(request: MsgEditValidator): Promise; + /** + * Delegate defines a method for performing a delegation of coins + * from a delegator to a validator. + */ + Delegate(request: MsgDelegate): Promise; + /** + * BeginRedelegate defines a method for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ + BeginRedelegate(request: MsgBeginRedelegate): Promise; + /** + * Undelegate defines a method for performing an undelegation from a + * delegate and a validator. + */ + Undelegate(request: MsgUndelegate): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.staking.v1beta1.Msg"; + this.rpc = rpc; + this.CreateValidator = this.CreateValidator.bind(this); + this.EditValidator = this.EditValidator.bind(this); + this.Delegate = this.Delegate.bind(this); + this.BeginRedelegate = this.BeginRedelegate.bind(this); + this.Undelegate = this.Undelegate.bind(this); + } + CreateValidator(request: MsgCreateValidator): Promise { + const data = MsgCreateValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateValidator", data); + return promise.then((data) => MsgCreateValidatorResponse.decode(new _m0.Reader(data))); + } + + EditValidator(request: MsgEditValidator): Promise { + const data = MsgEditValidator.encode(request).finish(); + const promise = this.rpc.request(this.service, "EditValidator", data); + return promise.then((data) => MsgEditValidatorResponse.decode(new _m0.Reader(data))); + } + + Delegate(request: MsgDelegate): Promise { + const data = MsgDelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "Delegate", data); + return promise.then((data) => MsgDelegateResponse.decode(new _m0.Reader(data))); + } + + BeginRedelegate(request: MsgBeginRedelegate): Promise { + const data = MsgBeginRedelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "BeginRedelegate", data); + return promise.then((data) => MsgBeginRedelegateResponse.decode(new _m0.Reader(data))); + } + + Undelegate(request: MsgUndelegate): Promise { + const data = MsgUndelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "Undelegate", data); + return promise.then((data) => MsgUndelegateResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/tx/signing/v1beta1/signing.ts b/common/types/src/lcd/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 00000000..58a93851 --- /dev/null +++ b/common/types/src/lcd/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,550 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../../google/protobuf/any"; +import { CompactBitArray } from "../../../crypto/multisig/v1beta1/multisig"; + +export const protobufPackage = "cosmos.tx.signing.v1beta1"; + +/** + * 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 = "SIGN_MODE_UNSPECIFIED", + /** + * SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is + * verified with raw bytes from Tx. + */ + SIGN_MODE_DIRECT = "SIGN_MODE_DIRECT", + /** + * 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. It is currently not supported. + */ + SIGN_MODE_TEXTUAL = "SIGN_MODE_TEXTUAL", + /** + * 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`. It also allows + * for adding Tips in transactions. + * + * Since: cosmos-sdk 0.46 + */ + SIGN_MODE_DIRECT_AUX = "SIGN_MODE_DIRECT_AUX", + /** + * 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 = "SIGN_MODE_LEGACY_AMINO_JSON", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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 -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.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function signModeToNumber(object: SignMode): number { + switch (object) { + case SignMode.SIGN_MODE_UNSPECIFIED: + return 0; + case SignMode.SIGN_MODE_DIRECT: + return 1; + case SignMode.SIGN_MODE_TEXTUAL: + return 2; + case SignMode.SIGN_MODE_DIRECT_AUX: + return 3; + case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: + return 127; + case SignMode.UNRECOGNIZED: + default: + return -1; + } +} + +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} + +/** + * 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 */ + public_key?: 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: string; +} + +/** Data represents signature data */ +export interface SignatureDescriptor_Data { + /** single represents a single signer */ + single?: + | SignatureDescriptor_Data_Single + | undefined; + /** multi represents a multisig signer */ + multi?: SignatureDescriptor_Data_Multi | undefined; +} + +/** 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; +} + +/** 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[]; +} + +function createBaseSignatureDescriptors(): SignatureDescriptors { + return { signatures: [] }; +} + +export const SignatureDescriptors = { + encode(message: SignatureDescriptors, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.signatures) { + SignatureDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SignatureDescriptors { + return { + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptors): unknown { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => e ? SignatureDescriptor.toJSON(e) : undefined); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map((e) => SignatureDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSignatureDescriptor(): SignatureDescriptor { + return { public_key: undefined, data: undefined, sequence: "0" }; +} + +export const SignatureDescriptor = { + encode(message: SignatureDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.public_key !== undefined) { + Any.encode(message.public_key, writer.uint32(10).fork()).ldelim(); + } + if (message.data !== undefined) { + SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim(); + } + if (message.sequence !== "0") { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.public_key = Any.decode(reader, reader.uint32()); + break; + case 2: + message.data = SignatureDescriptor_Data.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor { + return { + public_key: isSet(object.public_key) ? Any.fromJSON(object.public_key) : undefined, + data: isSet(object.data) ? SignatureDescriptor_Data.fromJSON(object.data) : undefined, + sequence: isSet(object.sequence) ? String(object.sequence) : "0", + }; + }, + + toJSON(message: SignatureDescriptor): unknown { + const obj: any = {}; + message.public_key !== undefined && + (obj.public_key = message.public_key ? Any.toJSON(message.public_key) : undefined); + message.data !== undefined && (obj.data = message.data ? SignatureDescriptor_Data.toJSON(message.data) : undefined); + message.sequence !== undefined && (obj.sequence = message.sequence); + return obj; + }, + + fromPartial, I>>(object: I): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + message.public_key = (object.public_key !== undefined && object.public_key !== null) + ? Any.fromPartial(object.public_key) + : undefined; + message.data = (object.data !== undefined && object.data !== null) + ? SignatureDescriptor_Data.fromPartial(object.data) + : undefined; + message.sequence = object.sequence ?? "0"; + return message; + }, +}; + +function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { + return { single: undefined, multi: undefined }; +} + +export const SignatureDescriptor_Data = { + encode(message: SignatureDescriptor_Data, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SignatureDescriptor_Data { + return { + single: isSet(object.single) ? SignatureDescriptor_Data_Single.fromJSON(object.single) : undefined, + multi: isSet(object.multi) ? SignatureDescriptor_Data_Multi.fromJSON(object.multi) : undefined, + }; + }, + + toJSON(message: SignatureDescriptor_Data): unknown { + const obj: any = {}; + message.single !== undefined && + (obj.single = message.single ? SignatureDescriptor_Data_Single.toJSON(message.single) : undefined); + message.multi !== undefined && + (obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toJSON(message.multi) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseSignatureDescriptor_Data_Single(): SignatureDescriptor_Data_Single { + return { mode: SignMode.SIGN_MODE_UNSPECIFIED, signature: new Uint8Array() }; +} + +export const SignatureDescriptor_Data_Single = { + encode(message: SignatureDescriptor_Data_Single, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.mode !== SignMode.SIGN_MODE_UNSPECIFIED) { + writer.uint32(8).int32(signModeToNumber(message.mode)); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = signModeFromJSON(reader.int32()); + break; + case 2: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor_Data_Single { + return { + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : SignMode.SIGN_MODE_UNSPECIFIED, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + }; + }, + + toJSON(message: SignatureDescriptor_Data_Single): unknown { + const obj: any = {}; + message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + + fromPartial, I>>( + object: I, + ): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + message.mode = object.mode ?? SignMode.SIGN_MODE_UNSPECIFIED; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; + +function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { + return { bitarray: undefined, signatures: [] }; +} + +export const SignatureDescriptor_Data_Multi = { + encode(message: SignatureDescriptor_Data_Multi, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SignatureDescriptor_Data_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SignatureDescriptor_Data_Multi): unknown { + const obj: any = {}; + message.bitarray !== undefined && + (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => e ? SignatureDescriptor_Data.toJSON(e) : undefined); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): 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; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/tx/v1beta1/service.ts b/common/types/src/lcd/cosmos/tx/v1beta1/service.ts new file mode 100644 index 00000000..d6658719 --- /dev/null +++ b/common/types/src/lcd/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,1032 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Block } from "../../../tendermint/types/block"; +import { BlockID } from "../../../tendermint/types/types"; +import { GasInfo, Result, TxResponse } from "../../base/abci/v1beta1/abci"; +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; +import { Tx } from "./tx"; + +export const protobufPackage = "cosmos.tx.v1beta1"; + +/** 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 = "ORDER_BY_UNSPECIFIED", + /** ORDER_BY_ASC - ORDER_BY_ASC defines ascending order */ + ORDER_BY_ASC = "ORDER_BY_ASC", + /** ORDER_BY_DESC - ORDER_BY_DESC defines descending order */ + ORDER_BY_DESC = "ORDER_BY_DESC", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function orderByToNumber(object: OrderBy): number { + switch (object) { + case OrderBy.ORDER_BY_UNSPECIFIED: + return 0; + case OrderBy.ORDER_BY_ASC: + return 1; + case OrderBy.ORDER_BY_DESC: + return 2; + case OrderBy.UNRECOGNIZED: + default: + return -1; + } +} + +/** 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 = "BROADCAST_MODE_UNSPECIFIED", + /** + * BROADCAST_MODE_BLOCK - BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for + * the tx to be committed in a block. + */ + BROADCAST_MODE_BLOCK = "BROADCAST_MODE_BLOCK", + /** + * BROADCAST_MODE_SYNC - BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for + * a CheckTx execution response only. + */ + BROADCAST_MODE_SYNC = "BROADCAST_MODE_SYNC", + /** + * BROADCAST_MODE_ASYNC - BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns + * immediately. + */ + BROADCAST_MODE_ASYNC = "BROADCAST_MODE_ASYNC", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function broadcastModeToNumber(object: BroadcastMode): number { + switch (object) { + case BroadcastMode.BROADCAST_MODE_UNSPECIFIED: + return 0; + case BroadcastMode.BROADCAST_MODE_BLOCK: + return 1; + case BroadcastMode.BROADCAST_MODE_SYNC: + return 2; + case BroadcastMode.BROADCAST_MODE_ASYNC: + return 3; + case BroadcastMode.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * GetTxsEventRequest is the request type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventRequest { + /** events is the list of transaction event type. */ + events: string[]; + /** pagination defines a pagination for the request. */ + pagination?: PageRequest; + order_by: OrderBy; +} + +/** + * 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. */ + tx_responses: TxResponse[]; + /** pagination defines a pagination for the response. */ + pagination?: PageResponse; +} + +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequest { + /** tx_bytes is the raw transaction. */ + tx_bytes: Uint8Array; + mode: BroadcastMode; +} + +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponse { + /** tx_response is the queried TxResponses. */ + tx_response?: TxResponse; +} + +/** + * 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 + */ + tx_bytes: Uint8Array; +} + +/** + * SimulateResponse is the response type for the + * Service.SimulateRPC method. + */ +export interface SimulateResponse { + /** gas_info is the information about gas used in the simulation. */ + gas_info?: GasInfo; + /** result is the result of the simulation. */ + result?: Result; +} + +/** + * 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; +} + +/** 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. */ + tx_response?: TxResponse; +} + +/** + * 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: string; + /** pagination defines a pagination for the request. */ + pagination?: PageRequest; +} + +/** + * 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[]; + block_id?: BlockID; + block?: Block; + /** pagination defines a pagination for the response. */ + pagination?: PageResponse; +} + +function createBaseGetTxsEventRequest(): GetTxsEventRequest { + return { events: [], pagination: undefined, order_by: OrderBy.ORDER_BY_UNSPECIFIED }; +} + +export const GetTxsEventRequest = { + encode(message: GetTxsEventRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.order_by !== OrderBy.ORDER_BY_UNSPECIFIED) { + writer.uint32(24).int32(orderByToNumber(message.order_by)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.order_by = orderByFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetTxsEventRequest { + return { + events: Array.isArray(object?.events) ? object.events.map((e: any) => String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + order_by: isSet(object.order_by) ? orderByFromJSON(object.order_by) : OrderBy.ORDER_BY_UNSPECIFIED, + }; + }, + + toJSON(message: GetTxsEventRequest): unknown { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map((e) => e); + } else { + obj.events = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.order_by !== undefined && (obj.order_by = orderByToJSON(message.order_by)); + return obj; + }, + + fromPartial, I>>(object: I): 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.order_by = object.order_by ?? OrderBy.ORDER_BY_UNSPECIFIED; + return message; + }, +}; + +function createBaseGetTxsEventResponse(): GetTxsEventResponse { + return { txs: [], tx_responses: [], pagination: undefined }; +} + +export const GetTxsEventResponse = { + encode(message: GetTxsEventResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.tx_responses) { + TxResponse.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.tx_responses.push(TxResponse.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetTxsEventResponse { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + tx_responses: Array.isArray(object?.tx_responses) + ? object.tx_responses.map((e: any) => TxResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetTxsEventResponse): unknown { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => e ? Tx.toJSON(e) : undefined); + } else { + obj.txs = []; + } + if (message.tx_responses) { + obj.tx_responses = message.tx_responses.map((e) => e ? TxResponse.toJSON(e) : undefined); + } else { + obj.tx_responses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.tx_responses = object.tx_responses?.map((e) => TxResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseBroadcastTxRequest(): BroadcastTxRequest { + return { tx_bytes: new Uint8Array(), mode: BroadcastMode.BROADCAST_MODE_UNSPECIFIED }; +} + +export const BroadcastTxRequest = { + encode(message: BroadcastTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx_bytes.length !== 0) { + writer.uint32(10).bytes(message.tx_bytes); + } + if (message.mode !== BroadcastMode.BROADCAST_MODE_UNSPECIFIED) { + writer.uint32(16).int32(broadcastModeToNumber(message.mode)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.tx_bytes = reader.bytes(); + break; + case 2: + message.mode = broadcastModeFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BroadcastTxRequest { + return { + tx_bytes: isSet(object.tx_bytes) ? bytesFromBase64(object.tx_bytes) : new Uint8Array(), + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : BroadcastMode.BROADCAST_MODE_UNSPECIFIED, + }; + }, + + toJSON(message: BroadcastTxRequest): unknown { + const obj: any = {}; + message.tx_bytes !== undefined && + (obj.tx_bytes = base64FromBytes(message.tx_bytes !== undefined ? message.tx_bytes : new Uint8Array())); + message.mode !== undefined && (obj.mode = broadcastModeToJSON(message.mode)); + return obj; + }, + + fromPartial, I>>(object: I): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + message.tx_bytes = object.tx_bytes ?? new Uint8Array(); + message.mode = object.mode ?? BroadcastMode.BROADCAST_MODE_UNSPECIFIED; + return message; + }, +}; + +function createBaseBroadcastTxResponse(): BroadcastTxResponse { + return { tx_response: undefined }; +} + +export const BroadcastTxResponse = { + encode(message: BroadcastTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx_response !== undefined) { + TxResponse.encode(message.tx_response, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.tx_response = TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BroadcastTxResponse { + return { tx_response: isSet(object.tx_response) ? TxResponse.fromJSON(object.tx_response) : undefined }; + }, + + toJSON(message: BroadcastTxResponse): unknown { + const obj: any = {}; + message.tx_response !== undefined && + (obj.tx_response = message.tx_response ? TxResponse.toJSON(message.tx_response) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + message.tx_response = (object.tx_response !== undefined && object.tx_response !== null) + ? TxResponse.fromPartial(object.tx_response) + : undefined; + return message; + }, +}; + +function createBaseSimulateRequest(): SimulateRequest { + return { tx: undefined, tx_bytes: new Uint8Array() }; +} + +export const SimulateRequest = { + encode(message: SimulateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + if (message.tx_bytes.length !== 0) { + writer.uint32(18).bytes(message.tx_bytes); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.tx_bytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SimulateRequest { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + tx_bytes: isSet(object.tx_bytes) ? bytesFromBase64(object.tx_bytes) : new Uint8Array(), + }; + }, + + toJSON(message: SimulateRequest): unknown { + const obj: any = {}; + message.tx !== undefined && (obj.tx = message.tx ? Tx.toJSON(message.tx) : undefined); + message.tx_bytes !== undefined && + (obj.tx_bytes = base64FromBytes(message.tx_bytes !== undefined ? message.tx_bytes : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): SimulateRequest { + const message = createBaseSimulateRequest(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.tx_bytes = object.tx_bytes ?? new Uint8Array(); + return message; + }, +}; + +function createBaseSimulateResponse(): SimulateResponse { + return { gas_info: undefined, result: undefined }; +} + +export const SimulateResponse = { + encode(message: SimulateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.gas_info !== undefined) { + GasInfo.encode(message.gas_info, writer.uint32(10).fork()).ldelim(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.gas_info = GasInfo.decode(reader, reader.uint32()); + break; + case 2: + message.result = Result.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SimulateResponse { + return { + gas_info: isSet(object.gas_info) ? GasInfo.fromJSON(object.gas_info) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulateResponse): unknown { + const obj: any = {}; + message.gas_info !== undefined && (obj.gas_info = message.gas_info ? GasInfo.toJSON(message.gas_info) : undefined); + message.result !== undefined && (obj.result = message.result ? Result.toJSON(message.result) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): SimulateResponse { + const message = createBaseSimulateResponse(); + message.gas_info = (object.gas_info !== undefined && object.gas_info !== null) + ? GasInfo.fromPartial(object.gas_info) + : undefined; + message.result = (object.result !== undefined && object.result !== null) + ? Result.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseGetTxRequest(): GetTxRequest { + return { hash: "" }; +} + +export const GetTxRequest = { + encode(message: GetTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): GetTxRequest { + return { hash: isSet(object.hash) ? String(object.hash) : "" }; + }, + + toJSON(message: GetTxRequest): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = message.hash); + return obj; + }, + + fromPartial, I>>(object: I): GetTxRequest { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, +}; + +function createBaseGetTxResponse(): GetTxResponse { + return { tx: undefined, tx_response: undefined }; +} + +export const GetTxResponse = { + encode(message: GetTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + if (message.tx_response !== undefined) { + TxResponse.encode(message.tx_response, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.tx_response = TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetTxResponse { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + tx_response: isSet(object.tx_response) ? TxResponse.fromJSON(object.tx_response) : undefined, + }; + }, + + toJSON(message: GetTxResponse): unknown { + const obj: any = {}; + message.tx !== undefined && (obj.tx = message.tx ? Tx.toJSON(message.tx) : undefined); + message.tx_response !== undefined && + (obj.tx_response = message.tx_response ? TxResponse.toJSON(message.tx_response) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetTxResponse { + const message = createBaseGetTxResponse(); + message.tx = (object.tx !== undefined && object.tx !== null) ? Tx.fromPartial(object.tx) : undefined; + message.tx_response = (object.tx_response !== undefined && object.tx_response !== null) + ? TxResponse.fromPartial(object.tx_response) + : undefined; + return message; + }, +}; + +function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { + return { height: "0", pagination: undefined }; +} + +export const GetBlockWithTxsRequest = { + encode(message: GetBlockWithTxsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsRequest { + return { + height: isSet(object.height) ? String(object.height) : "0", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsRequest): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetBlockWithTxsRequest { + const message = createBaseGetBlockWithTxsRequest(); + message.height = object.height ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { + return { txs: [], block_id: undefined, block: undefined, pagination: undefined }; +} + +export const GetBlockWithTxsResponse = { + encode(message: GetBlockWithTxsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, 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: _m0.Reader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.block_id = 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; + }, + + fromJSON(object: any): GetBlockWithTxsResponse { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsResponse): unknown { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => e ? Tx.toJSON(e) : undefined); + } else { + obj.txs = []; + } + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.block !== undefined && (obj.block = message.block ? Block.toJSON(message.block) : undefined); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : 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; + }, +}; + +/** Service defines a gRPC service for interacting with transactions. */ +export interface Service { + /** Simulate simulates executing a transaction for estimating gas usage. */ + Simulate(request: SimulateRequest): Promise; + /** GetTx fetches a tx by hash. */ + GetTx(request: GetTxRequest): Promise; + /** BroadcastTx broadcast transaction. */ + BroadcastTx(request: BroadcastTxRequest): Promise; + /** GetTxsEvent fetches txs by event. */ + GetTxsEvent(request: GetTxsEventRequest): Promise; + /** + * GetBlockWithTxs fetches a block with decoded txs. + * + * Since: cosmos-sdk 0.45.2 + */ + GetBlockWithTxs(request: GetBlockWithTxsRequest): Promise; +} + +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.tx.v1beta1.Service"; + this.rpc = rpc; + this.Simulate = this.Simulate.bind(this); + this.GetTx = this.GetTx.bind(this); + this.BroadcastTx = this.BroadcastTx.bind(this); + this.GetTxsEvent = this.GetTxsEvent.bind(this); + this.GetBlockWithTxs = this.GetBlockWithTxs.bind(this); + } + Simulate(request: SimulateRequest): Promise { + const data = SimulateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Simulate", data); + return promise.then((data) => SimulateResponse.decode(new _m0.Reader(data))); + } + + GetTx(request: GetTxRequest): Promise { + const data = GetTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetTx", data); + return promise.then((data) => GetTxResponse.decode(new _m0.Reader(data))); + } + + BroadcastTx(request: BroadcastTxRequest): Promise { + const data = BroadcastTxRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "BroadcastTx", data); + return promise.then((data) => BroadcastTxResponse.decode(new _m0.Reader(data))); + } + + GetTxsEvent(request: GetTxsEventRequest): Promise { + const data = GetTxsEventRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetTxsEvent", data); + return promise.then((data) => GetTxsEventResponse.decode(new _m0.Reader(data))); + } + + GetBlockWithTxs(request: GetBlockWithTxsRequest): Promise { + const data = GetBlockWithTxsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetBlockWithTxs", data); + return promise.then((data) => GetBlockWithTxsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/tx/v1beta1/tx.ts b/common/types/src/lcd/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 00000000..43a6358a --- /dev/null +++ b/common/types/src/lcd/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,1338 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Coin } from "../../base/v1beta1/coin"; +import { CompactBitArray } from "../../crypto/multisig/v1beta1/multisig"; +import { SignMode, signModeFromJSON, signModeToJSON, signModeToNumber } from "../signing/v1beta1/signing"; + +export const protobufPackage = "cosmos.tx.v1beta1"; + +/** 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 + */ + auth_info?: 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[]; +} + +/** + * 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. + */ + body_bytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + auth_info_bytes: 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[]; +} + +/** 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. + */ + body_bytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + auth_info_bytes: 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 + */ + chain_id: string; + /** account_number is the account number of the account in state */ + account_number: string; +} + +/** + * 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. + */ + body_bytes: Uint8Array; + /** public_key is the public key of the signing account. */ + public_key?: 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. + */ + 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; + /** + * Tip is the optional tip used for meta-transactions. It should be left + * empty if the signer is not the tipper for this transaction. + */ + tip?: Tip; +} + +/** 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 + */ + 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: 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 + */ + non_critical_extension_options: Any[]; +} + +/** + * 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. + */ + signer_infos: 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 meta-transactions. + * + * Since: cosmos-sdk 0.46 + */ + tip?: Tip; +} + +/** + * 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. + */ + public_key?: Any; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + mode_info?: 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: string; +} + +/** ModeInfo describes the signing mode of a single or nested multisig signer. */ +export interface ModeInfo { + /** single represents a single signer */ + single?: + | ModeInfo_Single + | undefined; + /** multi represents a nested multisig signer */ + multi?: ModeInfo_Multi | undefined; +} + +/** + * 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; +} + +/** 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 + */ + mode_infos: ModeInfo[]; +} + +/** + * 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 + */ + 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; +} + +/** + * Tip is the tip used for meta-transactions. + * + * Since: cosmos-sdk 0.46 + */ +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; +} + +/** + * 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_MOD_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?: SignDocDirectAux; + /** mode is the signing mode of the single signer */ + mode: SignMode; + /** sig is the signature of the sign doc. */ + sig: Uint8Array; +} + +function createBaseTx(): Tx { + return { body: undefined, auth_info: undefined, signatures: [] }; +} + +export const Tx = { + encode(message: Tx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.body !== undefined) { + TxBody.encode(message.body, writer.uint32(10).fork()).ldelim(); + } + if (message.auth_info !== undefined) { + AuthInfo.encode(message.auth_info, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Tx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.auth_info = AuthInfo.decode(reader, reader.uint32()); + break; + case 3: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Tx { + return { + body: isSet(object.body) ? TxBody.fromJSON(object.body) : undefined, + auth_info: isSet(object.auth_info) ? AuthInfo.fromJSON(object.auth_info) : undefined, + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Tx): unknown { + const obj: any = {}; + message.body !== undefined && (obj.body = message.body ? TxBody.toJSON(message.body) : undefined); + message.auth_info !== undefined && + (obj.auth_info = message.auth_info ? AuthInfo.toJSON(message.auth_info) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Tx { + const message = createBaseTx(); + message.body = (object.body !== undefined && object.body !== null) ? TxBody.fromPartial(object.body) : undefined; + message.auth_info = (object.auth_info !== undefined && object.auth_info !== null) + ? AuthInfo.fromPartial(object.auth_info) + : undefined; + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTxRaw(): TxRaw { + return { body_bytes: new Uint8Array(), auth_info_bytes: new Uint8Array(), signatures: [] }; +} + +export const TxRaw = { + encode(message: TxRaw, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.body_bytes.length !== 0) { + writer.uint32(10).bytes(message.body_bytes); + } + if (message.auth_info_bytes.length !== 0) { + writer.uint32(18).bytes(message.auth_info_bytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.body_bytes = reader.bytes(); + break; + case 2: + message.auth_info_bytes = reader.bytes(); + break; + case 3: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TxRaw { + return { + body_bytes: isSet(object.body_bytes) ? bytesFromBase64(object.body_bytes) : new Uint8Array(), + auth_info_bytes: isSet(object.auth_info_bytes) ? bytesFromBase64(object.auth_info_bytes) : new Uint8Array(), + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: TxRaw): unknown { + const obj: any = {}; + message.body_bytes !== undefined && + (obj.body_bytes = base64FromBytes(message.body_bytes !== undefined ? message.body_bytes : new Uint8Array())); + message.auth_info_bytes !== undefined && + (obj.auth_info_bytes = base64FromBytes( + message.auth_info_bytes !== undefined ? message.auth_info_bytes : new Uint8Array(), + )); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): TxRaw { + const message = createBaseTxRaw(); + message.body_bytes = object.body_bytes ?? new Uint8Array(); + message.auth_info_bytes = object.auth_info_bytes ?? new Uint8Array(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSignDoc(): SignDoc { + return { body_bytes: new Uint8Array(), auth_info_bytes: new Uint8Array(), chain_id: "", account_number: "0" }; +} + +export const SignDoc = { + encode(message: SignDoc, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.body_bytes.length !== 0) { + writer.uint32(10).bytes(message.body_bytes); + } + if (message.auth_info_bytes.length !== 0) { + writer.uint32(18).bytes(message.auth_info_bytes); + } + if (message.chain_id !== "") { + writer.uint32(26).string(message.chain_id); + } + if (message.account_number !== "0") { + writer.uint32(32).uint64(message.account_number); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.body_bytes = reader.bytes(); + break; + case 2: + message.auth_info_bytes = reader.bytes(); + break; + case 3: + message.chain_id = reader.string(); + break; + case 4: + message.account_number = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SignDoc { + return { + body_bytes: isSet(object.body_bytes) ? bytesFromBase64(object.body_bytes) : new Uint8Array(), + auth_info_bytes: isSet(object.auth_info_bytes) ? bytesFromBase64(object.auth_info_bytes) : new Uint8Array(), + chain_id: isSet(object.chain_id) ? String(object.chain_id) : "", + account_number: isSet(object.account_number) ? String(object.account_number) : "0", + }; + }, + + toJSON(message: SignDoc): unknown { + const obj: any = {}; + message.body_bytes !== undefined && + (obj.body_bytes = base64FromBytes(message.body_bytes !== undefined ? message.body_bytes : new Uint8Array())); + message.auth_info_bytes !== undefined && + (obj.auth_info_bytes = base64FromBytes( + message.auth_info_bytes !== undefined ? message.auth_info_bytes : new Uint8Array(), + )); + message.chain_id !== undefined && (obj.chain_id = message.chain_id); + message.account_number !== undefined && (obj.account_number = message.account_number); + return obj; + }, + + fromPartial, I>>(object: I): SignDoc { + const message = createBaseSignDoc(); + message.body_bytes = object.body_bytes ?? new Uint8Array(); + message.auth_info_bytes = object.auth_info_bytes ?? new Uint8Array(); + message.chain_id = object.chain_id ?? ""; + message.account_number = object.account_number ?? "0"; + return message; + }, +}; + +function createBaseSignDocDirectAux(): SignDocDirectAux { + return { + body_bytes: new Uint8Array(), + public_key: undefined, + chain_id: "", + account_number: "0", + sequence: "0", + tip: undefined, + }; +} + +export const SignDocDirectAux = { + encode(message: SignDocDirectAux, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.body_bytes.length !== 0) { + writer.uint32(10).bytes(message.body_bytes); + } + if (message.public_key !== undefined) { + Any.encode(message.public_key, writer.uint32(18).fork()).ldelim(); + } + if (message.chain_id !== "") { + writer.uint32(26).string(message.chain_id); + } + if (message.account_number !== "0") { + writer.uint32(32).uint64(message.account_number); + } + if (message.sequence !== "0") { + writer.uint32(40).uint64(message.sequence); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignDocDirectAux { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.body_bytes = reader.bytes(); + break; + case 2: + message.public_key = Any.decode(reader, reader.uint32()); + break; + case 3: + message.chain_id = reader.string(); + break; + case 4: + message.account_number = longToString(reader.uint64() as Long); + break; + case 5: + message.sequence = longToString(reader.uint64() as Long); + break; + case 6: + message.tip = Tip.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SignDocDirectAux { + return { + body_bytes: isSet(object.body_bytes) ? bytesFromBase64(object.body_bytes) : new Uint8Array(), + public_key: isSet(object.public_key) ? Any.fromJSON(object.public_key) : undefined, + chain_id: isSet(object.chain_id) ? String(object.chain_id) : "", + account_number: isSet(object.account_number) ? String(object.account_number) : "0", + sequence: isSet(object.sequence) ? String(object.sequence) : "0", + tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined, + }; + }, + + toJSON(message: SignDocDirectAux): unknown { + const obj: any = {}; + message.body_bytes !== undefined && + (obj.body_bytes = base64FromBytes(message.body_bytes !== undefined ? message.body_bytes : new Uint8Array())); + message.public_key !== undefined && + (obj.public_key = message.public_key ? Any.toJSON(message.public_key) : undefined); + message.chain_id !== undefined && (obj.chain_id = message.chain_id); + message.account_number !== undefined && (obj.account_number = message.account_number); + message.sequence !== undefined && (obj.sequence = message.sequence); + message.tip !== undefined && (obj.tip = message.tip ? Tip.toJSON(message.tip) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + message.body_bytes = object.body_bytes ?? new Uint8Array(); + message.public_key = (object.public_key !== undefined && object.public_key !== null) + ? Any.fromPartial(object.public_key) + : undefined; + message.chain_id = object.chain_id ?? ""; + message.account_number = object.account_number ?? "0"; + message.sequence = object.sequence ?? "0"; + message.tip = (object.tip !== undefined && object.tip !== null) ? Tip.fromPartial(object.tip) : undefined; + return message; + }, +}; + +function createBaseTxBody(): TxBody { + return { messages: [], memo: "", timeout_height: "0", extension_options: [], non_critical_extension_options: [] }; +} + +export const TxBody = { + encode(message: TxBody, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.timeout_height !== "0") { + writer.uint32(24).uint64(message.timeout_height); + } + for (const v of message.extension_options) { + Any.encode(v!, writer.uint32(8186).fork()).ldelim(); + } + for (const v of message.non_critical_extension_options) { + Any.encode(v!, writer.uint32(16378).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxBody { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.timeout_height = longToString(reader.uint64() as Long); + break; + case 1023: + message.extension_options.push(Any.decode(reader, reader.uint32())); + break; + case 2047: + message.non_critical_extension_options.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TxBody { + return { + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + memo: isSet(object.memo) ? String(object.memo) : "", + timeout_height: isSet(object.timeout_height) ? String(object.timeout_height) : "0", + extension_options: Array.isArray(object?.extension_options) + ? object.extension_options.map((e: any) => Any.fromJSON(e)) + : [], + non_critical_extension_options: Array.isArray(object?.non_critical_extension_options) + ? object.non_critical_extension_options.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxBody): unknown { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.messages = []; + } + message.memo !== undefined && (obj.memo = message.memo); + message.timeout_height !== undefined && (obj.timeout_height = message.timeout_height); + if (message.extension_options) { + obj.extension_options = message.extension_options.map((e) => e ? Any.toJSON(e) : undefined); + } else { + obj.extension_options = []; + } + if (message.non_critical_extension_options) { + obj.non_critical_extension_options = message.non_critical_extension_options.map((e) => + e ? Any.toJSON(e) : undefined + ); + } else { + obj.non_critical_extension_options = []; + } + return obj; + }, + + fromPartial, I>>(object: I): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeout_height = object.timeout_height ?? "0"; + message.extension_options = object.extension_options?.map((e) => Any.fromPartial(e)) || []; + message.non_critical_extension_options = object.non_critical_extension_options?.map((e) => Any.fromPartial(e)) || + []; + return message; + }, +}; + +function createBaseAuthInfo(): AuthInfo { + return { signer_infos: [], fee: undefined, tip: undefined }; +} + +export const AuthInfo = { + encode(message: AuthInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.signer_infos) { + 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: _m0.Reader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.signer_infos.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; + }, + + fromJSON(object: any): AuthInfo { + return { + signer_infos: Array.isArray(object?.signer_infos) + ? object.signer_infos.map((e: any) => SignerInfo.fromJSON(e)) + : [], + fee: isSet(object.fee) ? Fee.fromJSON(object.fee) : undefined, + tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined, + }; + }, + + toJSON(message: AuthInfo): unknown { + const obj: any = {}; + if (message.signer_infos) { + obj.signer_infos = message.signer_infos.map((e) => e ? SignerInfo.toJSON(e) : undefined); + } else { + obj.signer_infos = []; + } + message.fee !== undefined && (obj.fee = message.fee ? Fee.toJSON(message.fee) : undefined); + message.tip !== undefined && (obj.tip = message.tip ? Tip.toJSON(message.tip) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): AuthInfo { + const message = createBaseAuthInfo(); + message.signer_infos = object.signer_infos?.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; + }, +}; + +function createBaseSignerInfo(): SignerInfo { + return { public_key: undefined, mode_info: undefined, sequence: "0" }; +} + +export const SignerInfo = { + encode(message: SignerInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.public_key !== undefined) { + Any.encode(message.public_key, writer.uint32(10).fork()).ldelim(); + } + if (message.mode_info !== undefined) { + ModeInfo.encode(message.mode_info, writer.uint32(18).fork()).ldelim(); + } + if (message.sequence !== "0") { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.public_key = Any.decode(reader, reader.uint32()); + break; + case 2: + message.mode_info = ModeInfo.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SignerInfo { + return { + public_key: isSet(object.public_key) ? Any.fromJSON(object.public_key) : undefined, + mode_info: isSet(object.mode_info) ? ModeInfo.fromJSON(object.mode_info) : undefined, + sequence: isSet(object.sequence) ? String(object.sequence) : "0", + }; + }, + + toJSON(message: SignerInfo): unknown { + const obj: any = {}; + message.public_key !== undefined && + (obj.public_key = message.public_key ? Any.toJSON(message.public_key) : undefined); + message.mode_info !== undefined && + (obj.mode_info = message.mode_info ? ModeInfo.toJSON(message.mode_info) : undefined); + message.sequence !== undefined && (obj.sequence = message.sequence); + return obj; + }, + + fromPartial, I>>(object: I): SignerInfo { + const message = createBaseSignerInfo(); + message.public_key = (object.public_key !== undefined && object.public_key !== null) + ? Any.fromPartial(object.public_key) + : undefined; + message.mode_info = (object.mode_info !== undefined && object.mode_info !== null) + ? ModeInfo.fromPartial(object.mode_info) + : undefined; + message.sequence = object.sequence ?? "0"; + return message; + }, +}; + +function createBaseModeInfo(): ModeInfo { + return { single: undefined, multi: undefined }; +} + +export const ModeInfo = { + encode(message: ModeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ModeInfo { + return { + single: isSet(object.single) ? ModeInfo_Single.fromJSON(object.single) : undefined, + multi: isSet(object.multi) ? ModeInfo_Multi.fromJSON(object.multi) : undefined, + }; + }, + + toJSON(message: ModeInfo): unknown { + const obj: any = {}; + message.single !== undefined && (obj.single = message.single ? ModeInfo_Single.toJSON(message.single) : undefined); + message.multi !== undefined && (obj.multi = message.multi ? ModeInfo_Multi.toJSON(message.multi) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseModeInfo_Single(): ModeInfo_Single { + return { mode: SignMode.SIGN_MODE_UNSPECIFIED }; +} + +export const ModeInfo_Single = { + encode(message: ModeInfo_Single, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.mode !== SignMode.SIGN_MODE_UNSPECIFIED) { + writer.uint32(8).int32(signModeToNumber(message.mode)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo_Single { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = signModeFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModeInfo_Single { + return { mode: isSet(object.mode) ? signModeFromJSON(object.mode) : SignMode.SIGN_MODE_UNSPECIFIED }; + }, + + toJSON(message: ModeInfo_Single): unknown { + const obj: any = {}; + message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); + return obj; + }, + + fromPartial, I>>(object: I): ModeInfo_Single { + const message = createBaseModeInfo_Single(); + message.mode = object.mode ?? SignMode.SIGN_MODE_UNSPECIFIED; + return message; + }, +}; + +function createBaseModeInfo_Multi(): ModeInfo_Multi { + return { bitarray: undefined, mode_infos: [] }; +} + +export const ModeInfo_Multi = { + encode(message: ModeInfo_Multi, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.mode_infos) { + ModeInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo_Multi { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.mode_infos.push(ModeInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModeInfo_Multi { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + mode_infos: Array.isArray(object?.mode_infos) ? object.mode_infos.map((e: any) => ModeInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: ModeInfo_Multi): unknown { + const obj: any = {}; + message.bitarray !== undefined && + (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); + if (message.mode_infos) { + obj.mode_infos = message.mode_infos.map((e) => e ? ModeInfo.toJSON(e) : undefined); + } else { + obj.mode_infos = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + message.bitarray = (object.bitarray !== undefined && object.bitarray !== null) + ? CompactBitArray.fromPartial(object.bitarray) + : undefined; + message.mode_infos = object.mode_infos?.map((e) => ModeInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFee(): Fee { + return { amount: [], gas_limit: "0", payer: "", granter: "" }; +} + +export const Fee = { + encode(message: Fee, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.gas_limit !== "0") { + writer.uint32(16).uint64(message.gas_limit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Fee { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.gas_limit = longToString(reader.uint64() as Long); + break; + case 3: + message.payer = reader.string(); + break; + case 4: + message.granter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Fee { + return { + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + gas_limit: isSet(object.gas_limit) ? String(object.gas_limit) : "0", + payer: isSet(object.payer) ? String(object.payer) : "", + granter: isSet(object.granter) ? String(object.granter) : "", + }; + }, + + toJSON(message: Fee): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + message.gas_limit !== undefined && (obj.gas_limit = message.gas_limit); + message.payer !== undefined && (obj.payer = message.payer); + message.granter !== undefined && (obj.granter = message.granter); + return obj; + }, + + fromPartial, I>>(object: I): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.gas_limit = object.gas_limit ?? "0"; + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, +}; + +function createBaseTip(): Tip { + return { amount: [], tipper: "" }; +} + +export const Tip = { + encode(message: Tip, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Tip { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Tip { + return { + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + tipper: isSet(object.tipper) ? String(object.tipper) : "", + }; + }, + + toJSON(message: Tip): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + message.tipper !== undefined && (obj.tipper = message.tipper); + return obj; + }, + + fromPartial, I>>(object: I): Tip { + const message = createBaseTip(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.tipper = object.tipper ?? ""; + return message; + }, +}; + +function createBaseAuxSignerData(): AuxSignerData { + return { address: "", sign_doc: undefined, mode: SignMode.SIGN_MODE_UNSPECIFIED, sig: new Uint8Array() }; +} + +export const AuxSignerData = { + encode(message: AuxSignerData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.sign_doc !== undefined) { + SignDocDirectAux.encode(message.sign_doc, writer.uint32(18).fork()).ldelim(); + } + if (message.mode !== SignMode.SIGN_MODE_UNSPECIFIED) { + writer.uint32(24).int32(signModeToNumber(message.mode)); + } + if (message.sig.length !== 0) { + writer.uint32(34).bytes(message.sig); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AuxSignerData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.sign_doc = SignDocDirectAux.decode(reader, reader.uint32()); + break; + case 3: + message.mode = signModeFromJSON(reader.int32()); + break; + case 4: + message.sig = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AuxSignerData { + return { + address: isSet(object.address) ? String(object.address) : "", + sign_doc: isSet(object.sign_doc) ? SignDocDirectAux.fromJSON(object.sign_doc) : undefined, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : SignMode.SIGN_MODE_UNSPECIFIED, + sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array(), + }; + }, + + toJSON(message: AuxSignerData): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.sign_doc !== undefined && + (obj.sign_doc = message.sign_doc ? SignDocDirectAux.toJSON(message.sign_doc) : undefined); + message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); + message.sig !== undefined && + (obj.sig = base64FromBytes(message.sig !== undefined ? message.sig : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): AuxSignerData { + const message = createBaseAuxSignerData(); + message.address = object.address ?? ""; + message.sign_doc = (object.sign_doc !== undefined && object.sign_doc !== null) + ? SignDocDirectAux.fromPartial(object.sign_doc) + : undefined; + message.mode = object.mode ?? SignMode.SIGN_MODE_UNSPECIFIED; + message.sig = object.sig ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/upgrade/v1beta1/query.ts b/common/types/src/lcd/cosmos/upgrade/v1beta1/query.ts new file mode 100644 index 00000000..108af104 --- /dev/null +++ b/common/types/src/lcd/cosmos/upgrade/v1beta1/query.ts @@ -0,0 +1,723 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { ModuleVersion, Plan } from "./upgrade"; + +export const protobufPackage = "cosmos.upgrade.v1beta1"; + +/** + * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanRequest { +} + +/** + * QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanResponse { + /** plan is the current upgrade plan. */ + plan?: Plan; +} + +/** + * QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanRequest { + /** name is the name of the applied plan to query for. */ + name: string; +} + +/** + * QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanResponse { + /** height is the block height at which the plan was applied. */ + height: string; +} + +/** + * QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState + * RPC method. + * + * @deprecated + */ +export interface QueryUpgradedConsensusStateRequest { + /** + * last height of the current chain must be sent in request + * as this is the height under which next consensus state is stored + */ + last_height: string; +} + +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + * + * @deprecated + */ +export interface QueryUpgradedConsensusStateResponse { + /** Since: cosmos-sdk 0.43 */ + upgraded_consensus_state: Uint8Array; +} + +/** + * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsRequest { + /** + * module_name is a field to query a specific module + * consensus version from state. Leaving this empty will + * fetch the full list of module versions from state + */ + module_name: string; +} + +/** + * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsResponse { + /** module_versions is a list of module names with their consensus versions. */ + module_versions: ModuleVersion[]; +} + +/** + * QueryAuthorityRequest is the request type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityRequest { +} + +/** + * QueryAuthorityResponse is the response type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityResponse { + address: string; +} + +function createBaseQueryCurrentPlanRequest(): QueryCurrentPlanRequest { + return {}; +} + +export const QueryCurrentPlanRequest = { + encode(_: QueryCurrentPlanRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentPlanRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryCurrentPlanRequest { + return {}; + }, + + toJSON(_: QueryCurrentPlanRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryCurrentPlanRequest { + const message = createBaseQueryCurrentPlanRequest(); + return message; + }, +}; + +function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { + return { plan: undefined }; +} + +export const QueryCurrentPlanResponse = { + encode(message: QueryCurrentPlanResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentPlanResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.plan = Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCurrentPlanResponse { + return { plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined }; + }, + + toJSON(message: QueryCurrentPlanResponse): unknown { + const obj: any = {}; + message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryCurrentPlanResponse { + const message = createBaseQueryCurrentPlanResponse(); + message.plan = (object.plan !== undefined && object.plan !== null) ? Plan.fromPartial(object.plan) : undefined; + return message; + }, +}; + +function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { + return { name: "" }; +} + +export const QueryAppliedPlanRequest = { + encode(message: QueryAppliedPlanRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAppliedPlanRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAppliedPlanRequest(); + 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; + }, + + fromJSON(object: any): QueryAppliedPlanRequest { + return { name: isSet(object.name) ? String(object.name) : "" }; + }, + + toJSON(message: QueryAppliedPlanRequest): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + return obj; + }, + + fromPartial, I>>(object: I): QueryAppliedPlanRequest { + const message = createBaseQueryAppliedPlanRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { + return { height: "0" }; +} + +export const QueryAppliedPlanResponse = { + encode(message: QueryAppliedPlanResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAppliedPlanResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAppliedPlanResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanResponse { + return { height: isSet(object.height) ? String(object.height) : "0" }; + }, + + toJSON(message: QueryAppliedPlanResponse): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>(object: I): QueryAppliedPlanResponse { + const message = createBaseQueryAppliedPlanResponse(); + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { + return { last_height: "0" }; +} + +export const QueryUpgradedConsensusStateRequest = { + encode(message: QueryUpgradedConsensusStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.last_height !== "0") { + writer.uint32(8).int64(message.last_height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.last_height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateRequest { + return { last_height: isSet(object.last_height) ? String(object.last_height) : "0" }; + }, + + toJSON(message: QueryUpgradedConsensusStateRequest): unknown { + const obj: any = {}; + message.last_height !== undefined && (obj.last_height = message.last_height); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + message.last_height = object.last_height ?? "0"; + return message; + }, +}; + +function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { + return { upgraded_consensus_state: new Uint8Array() }; +} + +export const QueryUpgradedConsensusStateResponse = { + encode(message: QueryUpgradedConsensusStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.upgraded_consensus_state.length !== 0) { + writer.uint32(18).bytes(message.upgraded_consensus_state); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.upgraded_consensus_state = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateResponse { + return { + upgraded_consensus_state: isSet(object.upgraded_consensus_state) + ? bytesFromBase64(object.upgraded_consensus_state) + : new Uint8Array(), + }; + }, + + toJSON(message: QueryUpgradedConsensusStateResponse): unknown { + const obj: any = {}; + message.upgraded_consensus_state !== undefined && + (obj.upgraded_consensus_state = base64FromBytes( + message.upgraded_consensus_state !== undefined ? message.upgraded_consensus_state : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgraded_consensus_state = object.upgraded_consensus_state ?? new Uint8Array(); + return message; + }, +}; + +function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { + return { module_name: "" }; +} + +export const QueryModuleVersionsRequest = { + encode(message: QueryModuleVersionsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.module_name !== "") { + writer.uint32(10).string(message.module_name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleVersionsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleVersionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.module_name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsRequest { + return { module_name: isSet(object.module_name) ? String(object.module_name) : "" }; + }, + + toJSON(message: QueryModuleVersionsRequest): unknown { + const obj: any = {}; + message.module_name !== undefined && (obj.module_name = message.module_name); + return obj; + }, + + fromPartial, I>>(object: I): QueryModuleVersionsRequest { + const message = createBaseQueryModuleVersionsRequest(); + message.module_name = object.module_name ?? ""; + return message; + }, +}; + +function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { + return { module_versions: [] }; +} + +export const QueryModuleVersionsResponse = { + encode(message: QueryModuleVersionsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.module_versions) { + ModuleVersion.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleVersionsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleVersionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.module_versions.push(ModuleVersion.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsResponse { + return { + module_versions: Array.isArray(object?.module_versions) + ? object.module_versions.map((e: any) => ModuleVersion.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryModuleVersionsResponse): unknown { + const obj: any = {}; + if (message.module_versions) { + obj.module_versions = message.module_versions.map((e) => e ? ModuleVersion.toJSON(e) : undefined); + } else { + obj.module_versions = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryModuleVersionsResponse { + const message = createBaseQueryModuleVersionsResponse(); + message.module_versions = object.module_versions?.map((e) => ModuleVersion.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { + return {}; +} + +export const QueryAuthorityRequest = { + encode(_: QueryAuthorityRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAuthorityRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryAuthorityRequest { + return {}; + }, + + toJSON(_: QueryAuthorityRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryAuthorityRequest { + const message = createBaseQueryAuthorityRequest(); + return message; + }, +}; + +function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { + return { address: "" }; +} + +export const QueryAuthorityResponse = { + encode(message: QueryAuthorityResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAuthorityResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorityResponse(); + 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; + }, + + fromJSON(object: any): QueryAuthorityResponse { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryAuthorityResponse): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): QueryAuthorityResponse { + const message = createBaseQueryAuthorityResponse(); + message.address = object.address ?? ""; + return message; + }, +}; + +/** Query defines the gRPC upgrade querier service. */ +export interface Query { + /** CurrentPlan queries the current upgrade plan. */ + CurrentPlan(request: QueryCurrentPlanRequest): Promise; + /** AppliedPlan queries a previously applied upgrade plan by its name. */ + AppliedPlan(request: QueryAppliedPlanRequest): Promise; + /** + * UpgradedConsensusState queries the consensus state that will serve + * as a trusted kernel for the next version of this chain. It will only be + * stored at the last height of this chain. + * UpgradedConsensusState RPC not supported with legacy querier + * This rpc is deprecated now that IBC has its own replacement + * (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) + * + * @deprecated + */ + UpgradedConsensusState(request: QueryUpgradedConsensusStateRequest): Promise; + /** + * ModuleVersions queries the list of module versions from state. + * + * Since: cosmos-sdk 0.43 + */ + ModuleVersions(request: QueryModuleVersionsRequest): Promise; + /** Returns the account with authority to conduct upgrades */ + Authority(request: QueryAuthorityRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.upgrade.v1beta1.Query"; + this.rpc = rpc; + this.CurrentPlan = this.CurrentPlan.bind(this); + this.AppliedPlan = this.AppliedPlan.bind(this); + this.UpgradedConsensusState = this.UpgradedConsensusState.bind(this); + this.ModuleVersions = this.ModuleVersions.bind(this); + this.Authority = this.Authority.bind(this); + } + CurrentPlan(request: QueryCurrentPlanRequest): Promise { + const data = QueryCurrentPlanRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CurrentPlan", data); + return promise.then((data) => QueryCurrentPlanResponse.decode(new _m0.Reader(data))); + } + + AppliedPlan(request: QueryAppliedPlanRequest): Promise { + const data = QueryAppliedPlanRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AppliedPlan", data); + return promise.then((data) => QueryAppliedPlanResponse.decode(new _m0.Reader(data))); + } + + UpgradedConsensusState(request: QueryUpgradedConsensusStateRequest): Promise { + const data = QueryUpgradedConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpgradedConsensusState", data); + return promise.then((data) => QueryUpgradedConsensusStateResponse.decode(new _m0.Reader(data))); + } + + ModuleVersions(request: QueryModuleVersionsRequest): Promise { + const data = QueryModuleVersionsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ModuleVersions", data); + return promise.then((data) => QueryModuleVersionsResponse.decode(new _m0.Reader(data))); + } + + Authority(request: QueryAuthorityRequest): Promise { + const data = QueryAuthorityRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Authority", data); + return promise.then((data) => QueryAuthorityResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/upgrade/v1beta1/tx.ts b/common/types/src/lcd/cosmos/upgrade/v1beta1/tx.ts new file mode 100644 index 00000000..0504de6b --- /dev/null +++ b/common/types/src/lcd/cosmos/upgrade/v1beta1/tx.ts @@ -0,0 +1,284 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Plan } from "./upgrade"; + +export const protobufPackage = "cosmos.upgrade.v1beta1"; + +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgrade { + /** authority is the address of the governance account. */ + authority: string; + /** plan is the upgrade plan. */ + plan?: Plan; +} + +/** + * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeResponse { +} + +/** + * MsgCancelUpgrade is the Msg/CancelUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgrade { + /** authority is the address of the governance account. */ + authority: string; +} + +/** + * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeResponse { +} + +function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { + return { authority: "", plan: undefined }; +} + +export const MsgSoftwareUpgrade = { + encode(message: MsgSoftwareUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSoftwareUpgrade { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSoftwareUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.plan = Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSoftwareUpgrade { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: MsgSoftwareUpgrade): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): MsgSoftwareUpgrade { + const message = createBaseMsgSoftwareUpgrade(); + message.authority = object.authority ?? ""; + message.plan = (object.plan !== undefined && object.plan !== null) ? Plan.fromPartial(object.plan) : undefined; + return message; + }, +}; + +function createBaseMsgSoftwareUpgradeResponse(): MsgSoftwareUpgradeResponse { + return {}; +} + +export const MsgSoftwareUpgradeResponse = { + encode(_: MsgSoftwareUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSoftwareUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgSoftwareUpgradeResponse { + return {}; + }, + + toJSON(_: MsgSoftwareUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSoftwareUpgradeResponse { + const message = createBaseMsgSoftwareUpgradeResponse(); + return message; + }, +}; + +function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { + return { authority: "" }; +} + +export const MsgCancelUpgrade = { + encode(message: MsgCancelUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelUpgrade { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCancelUpgrade { + return { authority: isSet(object.authority) ? String(object.authority) : "" }; + }, + + toJSON(message: MsgCancelUpgrade): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + return obj; + }, + + fromPartial, I>>(object: I): MsgCancelUpgrade { + const message = createBaseMsgCancelUpgrade(); + message.authority = object.authority ?? ""; + return message; + }, +}; + +function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { + return {}; +} + +export const MsgCancelUpgradeResponse = { + encode(_: MsgCancelUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelUpgradeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCancelUpgradeResponse { + return {}; + }, + + toJSON(_: MsgCancelUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCancelUpgradeResponse { + const message = createBaseMsgCancelUpgradeResponse(); + return message; + }, +}; + +/** Msg defines the upgrade Msg service. */ +export interface Msg { + /** + * SoftwareUpgrade is a governance operation for initiating a software upgrade. + * + * Since: cosmos-sdk 0.46 + */ + SoftwareUpgrade(request: MsgSoftwareUpgrade): Promise; + /** + * CancelUpgrade is a governance operation for cancelling a previously + * approvid software upgrade. + * + * Since: cosmos-sdk 0.46 + */ + CancelUpgrade(request: MsgCancelUpgrade): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.upgrade.v1beta1.Msg"; + this.rpc = rpc; + this.SoftwareUpgrade = this.SoftwareUpgrade.bind(this); + this.CancelUpgrade = this.CancelUpgrade.bind(this); + } + SoftwareUpgrade(request: MsgSoftwareUpgrade): Promise { + const data = MsgSoftwareUpgrade.encode(request).finish(); + const promise = this.rpc.request(this.service, "SoftwareUpgrade", data); + return promise.then((data) => MsgSoftwareUpgradeResponse.decode(new _m0.Reader(data))); + } + + CancelUpgrade(request: MsgCancelUpgrade): Promise { + const data = MsgCancelUpgrade.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelUpgrade", data); + return promise.then((data) => MsgCancelUpgradeResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/upgrade/v1beta1/upgrade.ts b/common/types/src/lcd/cosmos/upgrade/v1beta1/upgrade.ts new file mode 100644 index 00000000..db2b9503 --- /dev/null +++ b/common/types/src/lcd/cosmos/upgrade/v1beta1/upgrade.ts @@ -0,0 +1,410 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; + +export const protobufPackage = "cosmos.upgrade.v1beta1"; + +/** 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. + * Only used if Time is not set. + */ + 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?: Any; +} + +/** + * 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: string; + description: string; + plan?: Plan; +} + +/** + * 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: string; + description: string; +} + +/** + * 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: string; +} + +function createBasePlan(): Plan { + return { name: "", time: undefined, height: "0", info: "", upgraded_client_state: undefined }; +} + +export const Plan = { + encode(message: Plan, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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 !== "0") { + writer.uint32(24).int64(message.height); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.upgraded_client_state !== undefined) { + Any.encode(message.upgraded_client_state, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Plan { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.upgraded_client_state = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Plan { + return { + name: isSet(object.name) ? String(object.name) : "", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + height: isSet(object.height) ? String(object.height) : "0", + info: isSet(object.info) ? String(object.info) : "", + upgraded_client_state: isSet(object.upgraded_client_state) + ? Any.fromJSON(object.upgraded_client_state) + : undefined, + }; + }, + + toJSON(message: Plan): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.height !== undefined && (obj.height = message.height); + message.info !== undefined && (obj.info = message.info); + message.upgraded_client_state !== undefined && + (obj.upgraded_client_state = message.upgraded_client_state + ? Any.toJSON(message.upgraded_client_state) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Plan { + const message = createBasePlan(); + message.name = object.name ?? ""; + message.time = object.time ?? undefined; + message.height = object.height ?? "0"; + message.info = object.info ?? ""; + message.upgraded_client_state = + (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) + ? Any.fromPartial(object.upgraded_client_state) + : undefined; + return message; + }, +}; + +function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { + return { title: "", description: "", plan: undefined }; +} + +export const SoftwareUpgradeProposal = { + encode(message: SoftwareUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SoftwareUpgradeProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SoftwareUpgradeProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: SoftwareUpgradeProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposal { + return { title: "", description: "" }; +} + +export const CancelSoftwareUpgradeProposal = { + encode(message: CancelSoftwareUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): CancelSoftwareUpgradeProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + + toJSON(message: CancelSoftwareUpgradeProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + + fromPartial, I>>( + object: I, + ): CancelSoftwareUpgradeProposal { + const message = createBaseCancelSoftwareUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseModuleVersion(): ModuleVersion { + return { name: "", version: "0" }; +} + +export const ModuleVersion = { + encode(message: ModuleVersion, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.version !== "0") { + writer.uint32(16).uint64(message.version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ModuleVersion { + return { + name: isSet(object.name) ? String(object.name) : "", + version: isSet(object.version) ? String(object.version) : "0", + }; + }, + + toJSON(message: ModuleVersion): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.version !== undefined && (obj.version = message.version); + return obj; + }, + + fromPartial, I>>(object: I): ModuleVersion { + const message = createBaseModuleVersion(); + message.name = object.name ?? ""; + message.version = object.version ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/vesting/v1beta1/tx.ts b/common/types/src/lcd/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 00000000..c3fad147 --- /dev/null +++ b/common/types/src/lcd/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,506 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Coin } from "../../base/v1beta1/coin"; +import { Period } from "./vesting"; + +export const protobufPackage = "cosmos.vesting.v1beta1"; + +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreateVestingAccount { + from_address: string; + to_address: string; + amount: Coin[]; + end_time: string; + delayed: boolean; +} + +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponse { +} + +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + */ +export interface MsgCreatePermanentLockedAccount { + from_address: string; + to_address: string; + amount: Coin[]; +} + +/** MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. */ +export interface MsgCreatePermanentLockedAccountResponse { +} + +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreatePeriodicVestingAccount { + from_address: string; + to_address: string; + start_time: string; + vesting_periods: Period[]; +} + +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + */ +export interface MsgCreatePeriodicVestingAccountResponse { +} + +function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { + return { from_address: "", to_address: "", amount: [], end_time: "0", delayed: false }; +} + +export const MsgCreateVestingAccount = { + encode(message: MsgCreateVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.end_time !== "0") { + writer.uint32(32).int64(message.end_time); + } + if (message.delayed === true) { + writer.uint32(40).bool(message.delayed); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.from_address = reader.string(); + break; + case 2: + message.to_address = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.end_time = longToString(reader.int64() as Long); + break; + case 5: + message.delayed = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateVestingAccount { + return { + from_address: isSet(object.from_address) ? String(object.from_address) : "", + to_address: isSet(object.to_address) ? String(object.to_address) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + end_time: isSet(object.end_time) ? String(object.end_time) : "0", + delayed: isSet(object.delayed) ? Boolean(object.delayed) : false, + }; + }, + + toJSON(message: MsgCreateVestingAccount): unknown { + const obj: any = {}; + message.from_address !== undefined && (obj.from_address = message.from_address); + message.to_address !== undefined && (obj.to_address = message.to_address); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + message.end_time !== undefined && (obj.end_time = message.end_time); + message.delayed !== undefined && (obj.delayed = message.delayed); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.end_time = object.end_time ?? "0"; + message.delayed = object.delayed ?? false; + return message; + }, +}; + +function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { + return {}; +} + +export const MsgCreateVestingAccountResponse = { + encode(_: MsgCreateVestingAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgCreateVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreateVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { + return { from_address: "", to_address: "", amount: [] }; +} + +export const MsgCreatePermanentLockedAccount = { + encode(message: MsgCreatePermanentLockedAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.from_address = reader.string(); + break; + case 2: + message.to_address = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreatePermanentLockedAccount { + return { + from_address: isSet(object.from_address) ? String(object.from_address) : "", + to_address: isSet(object.to_address) ? String(object.to_address) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgCreatePermanentLockedAccount): unknown { + const obj: any = {}; + message.from_address !== undefined && (obj.from_address = message.from_address); + message.to_address !== undefined && (obj.to_address = message.to_address); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { + return {}; +} + +export const MsgCreatePermanentLockedAccountResponse = { + encode(_: MsgCreatePermanentLockedAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgCreatePermanentLockedAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePermanentLockedAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { + return { from_address: "", to_address: "", start_time: "0", vesting_periods: [] }; +} + +export const MsgCreatePeriodicVestingAccount = { + encode(message: MsgCreatePeriodicVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + if (message.start_time !== "0") { + writer.uint32(24).int64(message.start_time); + } + for (const v of message.vesting_periods) { + Period.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.from_address = reader.string(); + break; + case 2: + message.to_address = reader.string(); + break; + case 3: + message.start_time = longToString(reader.int64() as Long); + break; + case 4: + message.vesting_periods.push(Period.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreatePeriodicVestingAccount { + return { + from_address: isSet(object.from_address) ? String(object.from_address) : "", + to_address: isSet(object.to_address) ? String(object.to_address) : "", + start_time: isSet(object.start_time) ? String(object.start_time) : "0", + vesting_periods: Array.isArray(object?.vesting_periods) + ? object.vesting_periods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreatePeriodicVestingAccount): unknown { + const obj: any = {}; + message.from_address !== undefined && (obj.from_address = message.from_address); + message.to_address !== undefined && (obj.to_address = message.to_address); + message.start_time !== undefined && (obj.start_time = message.start_time); + if (message.vesting_periods) { + obj.vesting_periods = message.vesting_periods.map((e) => e ? Period.toJSON(e) : undefined); + } else { + obj.vesting_periods = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.start_time = object.start_time ?? "0"; + message.vesting_periods = object.vesting_periods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { + return {}; +} + +export const MsgCreatePeriodicVestingAccountResponse = { + encode(_: MsgCreatePeriodicVestingAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgCreatePeriodicVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreatePeriodicVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgCreatePeriodicVestingAccountResponse { + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + return message; + }, +}; + +/** Msg defines the bank Msg service. */ +export interface Msg { + /** + * CreateVestingAccount defines a method that enables creating a vesting + * account. + */ + CreateVestingAccount(request: MsgCreateVestingAccount): Promise; + /** + * CreatePermanentLockedAccount defines a method that enables creating a permanent + * locked account. + */ + CreatePermanentLockedAccount( + request: MsgCreatePermanentLockedAccount, + ): Promise; + /** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + */ + CreatePeriodicVestingAccount( + request: MsgCreatePeriodicVestingAccount, + ): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "cosmos.vesting.v1beta1.Msg"; + this.rpc = rpc; + this.CreateVestingAccount = this.CreateVestingAccount.bind(this); + this.CreatePermanentLockedAccount = this.CreatePermanentLockedAccount.bind(this); + this.CreatePeriodicVestingAccount = this.CreatePeriodicVestingAccount.bind(this); + } + CreateVestingAccount(request: MsgCreateVestingAccount): Promise { + const data = MsgCreateVestingAccount.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateVestingAccount", data); + return promise.then((data) => MsgCreateVestingAccountResponse.decode(new _m0.Reader(data))); + } + + CreatePermanentLockedAccount( + request: MsgCreatePermanentLockedAccount, + ): Promise { + const data = MsgCreatePermanentLockedAccount.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreatePermanentLockedAccount", data); + return promise.then((data) => MsgCreatePermanentLockedAccountResponse.decode(new _m0.Reader(data))); + } + + CreatePeriodicVestingAccount( + request: MsgCreatePeriodicVestingAccount, + ): Promise { + const data = MsgCreatePeriodicVestingAccount.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreatePeriodicVestingAccount", data); + return promise.then((data) => MsgCreatePeriodicVestingAccountResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos/vesting/v1beta1/vesting.ts b/common/types/src/lcd/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 00000000..bf2ce510 --- /dev/null +++ b/common/types/src/lcd/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,509 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { BaseAccount } from "../../auth/v1beta1/auth"; +import { Coin } from "../../base/v1beta1/coin"; + +export const protobufPackage = "cosmos.vesting.v1beta1"; + +/** + * BaseVestingAccount implements the VestingAccount interface. It contains all + * the necessary fields needed for any vesting account implementation. + */ +export interface BaseVestingAccount { + base_account?: BaseAccount; + original_vesting: Coin[]; + delegated_free: Coin[]; + delegated_vesting: Coin[]; + end_time: string; +} + +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccount { + base_vesting_account?: BaseVestingAccount; + start_time: string; +} + +/** + * 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 { + base_vesting_account?: BaseVestingAccount; +} + +/** Period defines a length of time and amount of coins that will vest. */ +export interface Period { + length: string; + amount: Coin[]; +} + +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccount { + base_vesting_account?: BaseVestingAccount; + start_time: string; + vesting_periods: Period[]; +} + +/** + * 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 { + base_vesting_account?: BaseVestingAccount; +} + +function createBaseBaseVestingAccount(): BaseVestingAccount { + return { base_account: undefined, original_vesting: [], delegated_free: [], delegated_vesting: [], end_time: "0" }; +} + +export const BaseVestingAccount = { + encode(message: BaseVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_account !== undefined) { + BaseAccount.encode(message.base_account, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.original_vesting) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegated_free) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.delegated_vesting) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.end_time !== "0") { + writer.uint32(40).int64(message.end_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_account = BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.original_vesting.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.delegated_free.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.delegated_vesting.push(Coin.decode(reader, reader.uint32())); + break; + case 5: + message.end_time = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BaseVestingAccount { + return { + base_account: isSet(object.base_account) ? BaseAccount.fromJSON(object.base_account) : undefined, + original_vesting: Array.isArray(object?.original_vesting) + ? object.original_vesting.map((e: any) => Coin.fromJSON(e)) + : [], + delegated_free: Array.isArray(object?.delegated_free) + ? object.delegated_free.map((e: any) => Coin.fromJSON(e)) + : [], + delegated_vesting: Array.isArray(object?.delegated_vesting) + ? object.delegated_vesting.map((e: any) => Coin.fromJSON(e)) + : [], + end_time: isSet(object.end_time) ? String(object.end_time) : "0", + }; + }, + + toJSON(message: BaseVestingAccount): unknown { + const obj: any = {}; + message.base_account !== undefined && + (obj.base_account = message.base_account ? BaseAccount.toJSON(message.base_account) : undefined); + if (message.original_vesting) { + obj.original_vesting = message.original_vesting.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.original_vesting = []; + } + if (message.delegated_free) { + obj.delegated_free = message.delegated_free.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.delegated_free = []; + } + if (message.delegated_vesting) { + obj.delegated_vesting = message.delegated_vesting.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.delegated_vesting = []; + } + message.end_time !== undefined && (obj.end_time = message.end_time); + return obj; + }, + + fromPartial, I>>(object: I): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + message.base_account = (object.base_account !== undefined && object.base_account !== null) + ? BaseAccount.fromPartial(object.base_account) + : undefined; + message.original_vesting = object.original_vesting?.map((e) => Coin.fromPartial(e)) || []; + message.delegated_free = object.delegated_free?.map((e) => Coin.fromPartial(e)) || []; + message.delegated_vesting = object.delegated_vesting?.map((e) => Coin.fromPartial(e)) || []; + message.end_time = object.end_time ?? "0"; + return message; + }, +}; + +function createBaseContinuousVestingAccount(): ContinuousVestingAccount { + return { base_vesting_account: undefined, start_time: "0" }; +} + +export const ContinuousVestingAccount = { + encode(message: ContinuousVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).ldelim(); + } + if (message.start_time !== "0") { + writer.uint32(16).int64(message.start_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.start_time = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ContinuousVestingAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) + ? BaseVestingAccount.fromJSON(object.base_vesting_account) + : undefined, + start_time: isSet(object.start_time) ? String(object.start_time) : "0", + }; + }, + + toJSON(message: ContinuousVestingAccount): unknown { + const obj: any = {}; + message.base_vesting_account !== undefined && (obj.base_vesting_account = message.base_vesting_account + ? BaseVestingAccount.toJSON(message.base_vesting_account) + : undefined); + message.start_time !== undefined && (obj.start_time = message.start_time); + return obj; + }, + + fromPartial, I>>(object: I): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + message.base_vesting_account = (object.base_vesting_account !== undefined && object.base_vesting_account !== null) + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + message.start_time = object.start_time ?? "0"; + return message; + }, +}; + +function createBaseDelayedVestingAccount(): DelayedVestingAccount { + return { base_vesting_account: undefined }; +} + +export const DelayedVestingAccount = { + encode(message: DelayedVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelayedVestingAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) + ? BaseVestingAccount.fromJSON(object.base_vesting_account) + : undefined, + }; + }, + + toJSON(message: DelayedVestingAccount): unknown { + const obj: any = {}; + message.base_vesting_account !== undefined && (obj.base_vesting_account = message.base_vesting_account + ? BaseVestingAccount.toJSON(message.base_vesting_account) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + message.base_vesting_account = (object.base_vesting_account !== undefined && object.base_vesting_account !== null) + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + return message; + }, +}; + +function createBasePeriod(): Period { + return { length: "0", amount: [] }; +} + +export const Period = { + encode(message: Period, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.length !== "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: _m0.Reader | Uint8Array, length?: number): Period { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Period { + return { + length: isSet(object.length) ? String(object.length) : "0", + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Period): unknown { + const obj: any = {}; + message.length !== undefined && (obj.length = message.length); + if (message.amount) { + obj.amount = message.amount.map((e) => e ? Coin.toJSON(e) : undefined); + } else { + obj.amount = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Period { + const message = createBasePeriod(); + message.length = object.length ?? "0"; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePeriodicVestingAccount(): PeriodicVestingAccount { + return { base_vesting_account: undefined, start_time: "0", vesting_periods: [] }; +} + +export const PeriodicVestingAccount = { + encode(message: PeriodicVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).ldelim(); + } + if (message.start_time !== "0") { + writer.uint32(16).int64(message.start_time); + } + for (const v of message.vesting_periods) { + Period.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.start_time = longToString(reader.int64() as Long); + break; + case 3: + message.vesting_periods.push(Period.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PeriodicVestingAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) + ? BaseVestingAccount.fromJSON(object.base_vesting_account) + : undefined, + start_time: isSet(object.start_time) ? String(object.start_time) : "0", + vesting_periods: Array.isArray(object?.vesting_periods) + ? object.vesting_periods.map((e: any) => Period.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PeriodicVestingAccount): unknown { + const obj: any = {}; + message.base_vesting_account !== undefined && (obj.base_vesting_account = message.base_vesting_account + ? BaseVestingAccount.toJSON(message.base_vesting_account) + : undefined); + message.start_time !== undefined && (obj.start_time = message.start_time); + if (message.vesting_periods) { + obj.vesting_periods = message.vesting_periods.map((e) => e ? Period.toJSON(e) : undefined); + } else { + obj.vesting_periods = []; + } + return obj; + }, + + fromPartial, I>>(object: I): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + message.base_vesting_account = (object.base_vesting_account !== undefined && object.base_vesting_account !== null) + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + message.start_time = object.start_time ?? "0"; + message.vesting_periods = object.vesting_periods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePermanentLockedAccount(): PermanentLockedAccount { + return { base_vesting_account: undefined }; +} + +export const PermanentLockedAccount = { + encode(message: PermanentLockedAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PermanentLockedAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) + ? BaseVestingAccount.fromJSON(object.base_vesting_account) + : undefined, + }; + }, + + toJSON(message: PermanentLockedAccount): unknown { + const obj: any = {}; + message.base_vesting_account !== undefined && (obj.base_vesting_account = message.base_vesting_account + ? BaseVestingAccount.toJSON(message.base_vesting_account) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + message.base_vesting_account = (object.base_vesting_account !== undefined && object.base_vesting_account !== null) + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/cosmos_proto/cosmos.ts b/common/types/src/lcd/cosmos_proto/cosmos.ts new file mode 100644 index 00000000..8287baac --- /dev/null +++ b/common/types/src/lcd/cosmos_proto/cosmos.ts @@ -0,0 +1,261 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "cosmos_proto"; + +export enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = "SCALAR_TYPE_UNSPECIFIED", + SCALAR_TYPE_STRING = "SCALAR_TYPE_STRING", + SCALAR_TYPE_BYTES = "SCALAR_TYPE_BYTES", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function scalarTypeToNumber(object: ScalarType): number { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return 0; + case ScalarType.SCALAR_TYPE_STRING: + return 1; + case ScalarType.SCALAR_TYPE_BYTES: + return 2; + case ScalarType.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * 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; +} + +/** + * 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. + */ + field_type: ScalarType[]; +} + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { name: "", description: "" }; +} + +export const InterfaceDescriptor = { + encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseScalarDescriptor(): ScalarDescriptor { + return { name: "", description: "", field_type: [] }; +} + +export const ScalarDescriptor = { + encode(message: ScalarDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.field_type) { + writer.int32(scalarTypeToNumber(v)); + } + writer.ldelim(); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.field_type.push(scalarTypeFromJSON(reader.int32())); + } + } else { + message.field_type.push(scalarTypeFromJSON(reader.int32())); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ScalarDescriptor { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + field_type: Array.isArray(object?.field_type) ? object.field_type.map((e: any) => scalarTypeFromJSON(e)) : [], + }; + }, + + toJSON(message: ScalarDescriptor): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && (obj.description = message.description); + if (message.field_type) { + obj.field_type = message.field_type.map((e) => scalarTypeToJSON(e)); + } else { + obj.field_type = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ScalarDescriptor { + const message = createBaseScalarDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.field_type = object.field_type?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/gogoproto/gogo.ts b/common/types/src/lcd/gogoproto/gogo.ts new file mode 100644 index 00000000..ecf800e0 --- /dev/null +++ b/common/types/src/lcd/gogoproto/gogo.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export const protobufPackage = "gogoproto"; diff --git a/common/types/src/lcd/google/api/annotations.ts b/common/types/src/lcd/google/api/annotations.ts new file mode 100644 index 00000000..c2161053 --- /dev/null +++ b/common/types/src/lcd/google/api/annotations.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export const protobufPackage = "google.api"; diff --git a/common/types/src/lcd/google/api/http.ts b/common/types/src/lcd/google/api/http.ts new file mode 100644 index 00000000..39f35c73 --- /dev/null +++ b/common/types/src/lcd/google/api/http.ts @@ -0,0 +1,655 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.api"; + +/** + * 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. + */ + fully_decode_reserved_expansion: boolean; +} + +/** + * # 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 + | undefined; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: + | string + | undefined; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: + | string + | undefined; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: + | string + | undefined; + /** Maps to HTTP PATCH. Used for updating a resource. */ + patch?: + | string + | undefined; + /** + * 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 + | undefined; + /** + * 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: HttpRule[]; +} + +/** 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; +} + +function createBaseHttp(): Http { + return { rules: [], fully_decode_reserved_expansion: false }; +} + +export const Http = { + encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.fully_decode_reserved_expansion === true) { + writer.uint32(16).bool(message.fully_decode_reserved_expansion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Http { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.fully_decode_reserved_expansion = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Http { + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], + fully_decode_reserved_expansion: isSet(object.fully_decode_reserved_expansion) + ? Boolean(object.fully_decode_reserved_expansion) + : false, + }; + }, + + toJSON(message: Http): unknown { + const obj: any = {}; + if (message.rules) { + obj.rules = message.rules.map((e) => e ? HttpRule.toJSON(e) : undefined); + } else { + obj.rules = []; + } + message.fully_decode_reserved_expansion !== undefined && + (obj.fully_decode_reserved_expansion = message.fully_decode_reserved_expansion); + return obj; + }, + + fromPartial, I>>(object: I): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; + message.fully_decode_reserved_expansion = object.fully_decode_reserved_expansion ?? false; + return message; + }, +}; + +function createBaseHttpRule(): HttpRule { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + response_body: "", + additional_bindings: [], + }; +} + +export const HttpRule = { + encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.response_body !== "") { + writer.uint32(98).string(message.response_body); + } + for (const v of message.additional_bindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.response_body = reader.string(); + break; + case 11: + message.additional_bindings.push(HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): HttpRule { + return { + selector: isSet(object.selector) ? String(object.selector) : "", + get: isSet(object.get) ? String(object.get) : undefined, + put: isSet(object.put) ? String(object.put) : undefined, + post: isSet(object.post) ? String(object.post) : undefined, + delete: isSet(object.delete) ? String(object.delete) : undefined, + patch: isSet(object.patch) ? String(object.patch) : undefined, + custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined, + body: isSet(object.body) ? String(object.body) : "", + response_body: isSet(object.response_body) ? String(object.response_body) : "", + additional_bindings: Array.isArray(object?.additional_bindings) + ? object.additional_bindings.map((e: any) => HttpRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HttpRule): unknown { + const obj: any = {}; + message.selector !== undefined && (obj.selector = message.selector); + message.get !== undefined && (obj.get = message.get); + message.put !== undefined && (obj.put = message.put); + message.post !== undefined && (obj.post = message.post); + message.delete !== undefined && (obj.delete = message.delete); + message.patch !== undefined && (obj.patch = message.patch); + message.custom !== undefined && + (obj.custom = message.custom ? CustomHttpPattern.toJSON(message.custom) : undefined); + message.body !== undefined && (obj.body = message.body); + message.response_body !== undefined && (obj.response_body = message.response_body); + if (message.additional_bindings) { + obj.additional_bindings = message.additional_bindings.map((e) => e ? HttpRule.toJSON(e) : undefined); + } else { + obj.additional_bindings = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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.response_body = object.response_body ?? ""; + message.additional_bindings = object.additional_bindings?.map((e) => HttpRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCustomHttpPattern(): CustomHttpPattern { + return { kind: "", path: "" }; +} + +export const CustomHttpPattern = { + encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): CustomHttpPattern { + return { kind: isSet(object.kind) ? String(object.kind) : "", path: isSet(object.path) ? String(object.path) : "" }; + }, + + toJSON(message: CustomHttpPattern): unknown { + const obj: any = {}; + message.kind !== undefined && (obj.kind = message.kind); + message.path !== undefined && (obj.path = message.path); + return obj; + }, + + fromPartial, I>>(object: I): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/google/protobuf/any.ts b/common/types/src/lcd/google/protobuf/any.ts new file mode 100644 index 00000000..38da266b --- /dev/null +++ b/common/types/src/lcd/google/protobuf/any.ts @@ -0,0 +1,237 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * `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); + * } + * + * 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 := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, 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. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + type_url: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} + +function createBaseAny(): Any { + return { type_url: "", value: new Uint8Array() }; +} + +export const Any = { + encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type_url !== "") { + writer.uint32(10).string(message.type_url); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Any { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.type_url = reader.string(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Any { + return { + type_url: isSet(object.type_url) ? String(object.type_url) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + }; + }, + + toJSON(message: Any): unknown { + const obj: any = {}; + message.type_url !== undefined && (obj.type_url = message.type_url); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): Any { + const message = createBaseAny(); + message.type_url = object.type_url ?? ""; + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/google/protobuf/descriptor.ts b/common/types/src/lcd/google/protobuf/descriptor.ts new file mode 100644 index 00000000..21db3717 --- /dev/null +++ b/common/types/src/lcd/google/protobuf/descriptor.ts @@ -0,0 +1,3844 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} + +/** 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. */ + 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: DescriptorProto[]; + enum_type: 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. + */ + source_code_info?: SourceCodeInfo; + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + */ + syntax: string; +} + +/** Describes a message type. */ +export interface DescriptorProto { + name: string; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nested_type: DescriptorProto[]; + enum_type: EnumDescriptorProto[]; + extension_range: DescriptorProto_ExtensionRange[]; + oneof_decl: OneofDescriptorProto[]; + options?: MessageOptions; + reserved_range: DescriptorProto_ReservedRange[]; + /** + * 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 DescriptorProto_ExtensionRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; + options?: ExtensionRangeOptions; +} + +/** + * 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 ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +/** 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). + */ + 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. + * TODO(kenton): Base-64 encode? + */ + 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?: FieldOptions; +} + +export enum FieldDescriptorProto_Type { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + TYPE_DOUBLE = "TYPE_DOUBLE", + TYPE_FLOAT = "TYPE_FLOAT", + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + TYPE_INT64 = "TYPE_INT64", + TYPE_UINT64 = "TYPE_UINT64", + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + TYPE_INT32 = "TYPE_INT32", + TYPE_FIXED64 = "TYPE_FIXED64", + TYPE_FIXED32 = "TYPE_FIXED32", + TYPE_BOOL = "TYPE_BOOL", + TYPE_STRING = "TYPE_STRING", + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. + */ + TYPE_GROUP = "TYPE_GROUP", + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = "TYPE_MESSAGE", + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = "TYPE_BYTES", + TYPE_UINT32 = "TYPE_UINT32", + TYPE_ENUM = "TYPE_ENUM", + TYPE_SFIXED32 = "TYPE_SFIXED32", + TYPE_SFIXED64 = "TYPE_SFIXED64", + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = "TYPE_SINT32", + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = "TYPE_SINT64", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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 function fieldDescriptorProto_TypeToNumber(object: FieldDescriptorProto_Type): number { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return 1; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return 2; + case FieldDescriptorProto_Type.TYPE_INT64: + return 3; + case FieldDescriptorProto_Type.TYPE_UINT64: + return 4; + case FieldDescriptorProto_Type.TYPE_INT32: + return 5; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return 6; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return 7; + case FieldDescriptorProto_Type.TYPE_BOOL: + return 8; + case FieldDescriptorProto_Type.TYPE_STRING: + return 9; + case FieldDescriptorProto_Type.TYPE_GROUP: + return 10; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return 11; + case FieldDescriptorProto_Type.TYPE_BYTES: + return 12; + case FieldDescriptorProto_Type.TYPE_UINT32: + return 13; + case FieldDescriptorProto_Type.TYPE_ENUM: + return 14; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return 15; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return 16; + case FieldDescriptorProto_Type.TYPE_SINT32: + return 17; + case FieldDescriptorProto_Type.TYPE_SINT64: + return 18; + case FieldDescriptorProto_Type.UNRECOGNIZED: + default: + return -1; + } +} + +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = "LABEL_OPTIONAL", + LABEL_REQUIRED = "LABEL_REQUIRED", + LABEL_REPEATED = "LABEL_REPEATED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + 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_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function fieldDescriptorProto_LabelToNumber(object: FieldDescriptorProto_Label): number { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return 1; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return 2; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return 3; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return -1; + } +} + +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name: string; + options?: OneofOptions; +} + +/** 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. + */ + reserved_range: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reserved_name: string[]; +} + +/** + * 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; +} + +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name: string; + number: number; + options?: EnumValueOptions; +} + +/** Describes a service. */ +export interface ServiceDescriptorProto { + name: string; + method: MethodDescriptorProto[]; + options?: ServiceOptions; +} + +/** 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. + */ + input_type: string; + output_type: string; + options?: MethodOptions; + /** Identifies if client streams multiple client messages */ + client_streaming: boolean; + /** Identifies if server streams multiple server messages */ + server_streaming: boolean; +} + +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. + */ + java_package: string; + /** + * If set, all the classes from the .proto file are wrapped in a single + * outer class with the given name. This applies to both Proto1 + * (equivalent to the old "--one_java_file" option) and Proto2 (where + * a .proto always translates to a single class, but you may want to + * explicitly choose the class name). + */ + java_outer_classname: string; + /** + * If set true, 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 outer class + * named by java_outer_classname. However, the outer 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; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + */ + 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; + php_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; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpreted_option: UninterpretedOption[]; +} + +/** Generated classes can be optimized for speed or code size. */ +export enum FileOptions_OptimizeMode { + /** SPEED - Generate complete code for parsing, serialization, */ + SPEED = "SPEED", + /** CODE_SIZE - etc. */ + CODE_SIZE = "CODE_SIZE", + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = "LITE_RUNTIME", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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 function fileOptions_OptimizeModeToNumber(object: FileOptions_OptimizeMode): number { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return 1; + case FileOptions_OptimizeMode.CODE_SIZE: + return 2; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return 3; + case FileOptions_OptimizeMode.UNRECOGNIZED: + default: + return -1; + } +} + +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. + */ + 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; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +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 not yet implemented in the open source + * release -- sorry, we'll try to include it 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. + */ + 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 implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + */ + 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; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = "STRING", + CORD = "CORD", + STRING_PIECE = "STRING_PIECE", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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 function fieldOptions_CTypeToNumber(object: FieldOptions_CType): number { + switch (object) { + case FieldOptions_CType.STRING: + return 0; + case FieldOptions_CType.CORD: + return 1; + case FieldOptions_CType.STRING_PIECE: + return 2; + case FieldOptions_CType.UNRECOGNIZED: + default: + return -1; + } +} + +export enum FieldOptions_JSType { + /** JS_NORMAL - Use the default type. */ + JS_NORMAL = "JS_NORMAL", + /** JS_STRING - Use JavaScript strings. */ + JS_STRING = "JS_STRING", + /** JS_NUMBER - Use JavaScript numbers. */ + JS_NUMBER = "JS_NUMBER", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function fieldOptions_JSTypeToNumber(object: FieldOptions_JSType): number { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return 0; + case FieldOptions_JSType.JS_STRING: + return 1; + case FieldOptions_JSType.JS_NUMBER: + return 2; + case FieldOptions_JSType.UNRECOGNIZED: + default: + return -1; + } +} + +export interface OneofOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface EnumOptions { + /** + * 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; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +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; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface ServiceOptions { + /** + * 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: UninterpretedOption[]; +} + +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; + idempotency_level: MethodOptions_IdempotencyLevel; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +/** + * 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 = "IDEMPOTENCY_UNKNOWN", + /** NO_SIDE_EFFECTS - implies idempotent */ + NO_SIDE_EFFECTS = "NO_SIDE_EFFECTS", + /** IDEMPOTENT - idempotent, but may have side effects */ + IDEMPOTENT = "IDEMPOTENT", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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 function methodOptions_IdempotencyLevelToNumber(object: MethodOptions_IdempotencyLevel): number { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return 0; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return 1; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return 2; + case MethodOptions_IdempotencyLevel.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * 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. + */ + identifier_value: string; + positive_int_value: string; + negative_int_value: string; + double_value: number; + string_value: Uint8Array; + aggregate_value: string; +} + +/** + * 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], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePart { + name_part: string; + is_extension: boolean; +} + +/** + * 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 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. 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 qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to qux 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[]; +} + +/** + * 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 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. */ + 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 offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end: number; +} + +function createBaseFileDescriptorSet(): FileDescriptorSet { + return { file: [] }; +} + +export const FileDescriptorSet = { + encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): FileDescriptorSet { + return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + }, + + toJSON(message: FileDescriptorSet): unknown { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map((e) => e ? FileDescriptorProto.toJSON(e) : undefined); + } else { + obj.file = []; + } + return obj; + }, + + fromPartial, I>>(object: I): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFileDescriptorProto(): FileDescriptorProto { + return { + name: "", + package: "", + dependency: [], + public_dependency: [], + weak_dependency: [], + message_type: [], + enum_type: [], + service: [], + extension: [], + options: undefined, + source_code_info: undefined, + syntax: "", + }; +} + +export const FileDescriptorProto = { + encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.public_dependency) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(90).fork(); + for (const v of message.weak_dependency) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.message_type) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.enum_type) { + 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.source_code_info !== undefined) { + SourceCodeInfo.encode(message.source_code_info, writer.uint32(74).fork()).ldelim(); + } + if (message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.public_dependency.push(reader.int32()); + } + } else { + message.public_dependency.push(reader.int32()); + } + break; + case 11: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weak_dependency.push(reader.int32()); + } + } else { + message.weak_dependency.push(reader.int32()); + } + break; + case 4: + message.message_type.push(DescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + message.enum_type.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.source_code_info = SourceCodeInfo.decode(reader, reader.uint32()); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FileDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + package: isSet(object.package) ? String(object.package) : "", + dependency: Array.isArray(object?.dependency) ? object.dependency.map((e: any) => String(e)) : [], + public_dependency: Array.isArray(object?.public_dependency) + ? object.public_dependency.map((e: any) => Number(e)) + : [], + weak_dependency: Array.isArray(object?.weak_dependency) ? object.weak_dependency.map((e: any) => Number(e)) : [], + message_type: Array.isArray(object?.message_type) + ? object.message_type.map((e: any) => DescriptorProto.fromJSON(e)) + : [], + enum_type: Array.isArray(object?.enum_type) + ? object.enum_type.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, + source_code_info: isSet(object.source_code_info) ? SourceCodeInfo.fromJSON(object.source_code_info) : undefined, + syntax: isSet(object.syntax) ? String(object.syntax) : "", + }; + }, + + toJSON(message: FileDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.package !== undefined && (obj.package = message.package); + if (message.dependency) { + obj.dependency = message.dependency.map((e) => e); + } else { + obj.dependency = []; + } + if (message.public_dependency) { + obj.public_dependency = message.public_dependency.map((e) => Math.round(e)); + } else { + obj.public_dependency = []; + } + if (message.weak_dependency) { + obj.weak_dependency = message.weak_dependency.map((e) => Math.round(e)); + } else { + obj.weak_dependency = []; + } + if (message.message_type) { + obj.message_type = message.message_type.map((e) => e ? DescriptorProto.toJSON(e) : undefined); + } else { + obj.message_type = []; + } + if (message.enum_type) { + obj.enum_type = message.enum_type.map((e) => e ? EnumDescriptorProto.toJSON(e) : undefined); + } else { + obj.enum_type = []; + } + if (message.service) { + obj.service = message.service.map((e) => e ? ServiceDescriptorProto.toJSON(e) : undefined); + } else { + obj.service = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => e ? FieldDescriptorProto.toJSON(e) : undefined); + } else { + obj.extension = []; + } + message.options !== undefined && (obj.options = message.options ? FileOptions.toJSON(message.options) : undefined); + message.source_code_info !== undefined && + (obj.source_code_info = message.source_code_info ? SourceCodeInfo.toJSON(message.source_code_info) : undefined); + message.syntax !== undefined && (obj.syntax = message.syntax); + return obj; + }, + + fromPartial, I>>(object: I): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map((e) => e) || []; + message.public_dependency = object.public_dependency?.map((e) => e) || []; + message.weak_dependency = object.weak_dependency?.map((e) => e) || []; + message.message_type = object.message_type?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enum_type = object.enum_type?.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.source_code_info = (object.source_code_info !== undefined && object.source_code_info !== null) + ? SourceCodeInfo.fromPartial(object.source_code_info) + : undefined; + message.syntax = object.syntax ?? ""; + return message; + }, +}; + +function createBaseDescriptorProto(): DescriptorProto { + return { + name: "", + field: [], + extension: [], + nested_type: [], + enum_type: [], + extension_range: [], + oneof_decl: [], + options: undefined, + reserved_range: [], + reserved_name: [], + }; +} + +export const DescriptorProto = { + encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.nested_type) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.enum_type) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.extension_range) { + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.oneof_decl) { + 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.reserved_range) { + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.reserved_name) { + writer.uint32(82).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.nested_type.push(DescriptorProto.decode(reader, reader.uint32())); + break; + case 4: + message.enum_type.push(EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + message.extension_range.push(DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); + break; + case 8: + message.oneof_decl.push(OneofDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.options = MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + message.reserved_range.push(DescriptorProto_ReservedRange.decode(reader, reader.uint32())); + break; + case 10: + message.reserved_name.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + field: Array.isArray(object?.field) ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + nested_type: Array.isArray(object?.nested_type) + ? object.nested_type.map((e: any) => DescriptorProto.fromJSON(e)) + : [], + enum_type: Array.isArray(object?.enum_type) + ? object.enum_type.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extension_range: Array.isArray(object?.extension_range) + ? object.extension_range.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) + : [], + oneof_decl: Array.isArray(object?.oneof_decl) + ? object.oneof_decl.map((e: any) => OneofDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, + reserved_range: Array.isArray(object?.reserved_range) + ? object.reserved_range.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) + : [], + reserved_name: Array.isArray(object?.reserved_name) + ? object.reserved_name.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: DescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.field) { + obj.field = message.field.map((e) => e ? FieldDescriptorProto.toJSON(e) : undefined); + } else { + obj.field = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => e ? FieldDescriptorProto.toJSON(e) : undefined); + } else { + obj.extension = []; + } + if (message.nested_type) { + obj.nested_type = message.nested_type.map((e) => e ? DescriptorProto.toJSON(e) : undefined); + } else { + obj.nested_type = []; + } + if (message.enum_type) { + obj.enum_type = message.enum_type.map((e) => e ? EnumDescriptorProto.toJSON(e) : undefined); + } else { + obj.enum_type = []; + } + if (message.extension_range) { + obj.extension_range = message.extension_range.map((e) => + e ? DescriptorProto_ExtensionRange.toJSON(e) : undefined + ); + } else { + obj.extension_range = []; + } + if (message.oneof_decl) { + obj.oneof_decl = message.oneof_decl.map((e) => e ? OneofDescriptorProto.toJSON(e) : undefined); + } else { + obj.oneof_decl = []; + } + message.options !== undefined && + (obj.options = message.options ? MessageOptions.toJSON(message.options) : undefined); + if (message.reserved_range) { + obj.reserved_range = message.reserved_range.map((e) => e ? DescriptorProto_ReservedRange.toJSON(e) : undefined); + } else { + obj.reserved_range = []; + } + if (message.reserved_name) { + obj.reserved_name = message.reserved_name.map((e) => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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.nested_type = object.nested_type?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enum_type = object.enum_type?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.extension_range = object.extension_range?.map((e) => DescriptorProto_ExtensionRange.fromPartial(e)) || []; + message.oneof_decl = object.oneof_decl?.map((e) => OneofDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? MessageOptions.fromPartial(object.options) + : undefined; + message.reserved_range = object.reserved_range?.map((e) => DescriptorProto_ReservedRange.fromPartial(e)) || []; + message.reserved_name = object.reserved_name?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { + return { start: 0, end: 0, options: undefined }; +} + +export const DescriptorProto_ExtensionRange = { + encode(message: DescriptorProto_ExtensionRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DescriptorProto_ExtensionRange { + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: DescriptorProto_ExtensionRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + message.options !== undefined && + (obj.options = message.options ? ExtensionRangeOptions.toJSON(message.options) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): 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; + }, +}; + +function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { + return { start: 0, end: 0 }; +} + +export const DescriptorProto_ReservedRange = { + encode(message: DescriptorProto_ReservedRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DescriptorProto_ReservedRange { + return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + }, + + toJSON(message: DescriptorProto_ReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + fromPartial, I>>( + object: I, + ): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +function createBaseExtensionRangeOptions(): ExtensionRangeOptions { + return { uninterpreted_option: [] }; +} + +export const ExtensionRangeOptions = { + encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions { + return { + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ExtensionRangeOptions): unknown { + const obj: any = {}; + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: FieldDescriptorProto_Label.LABEL_OPTIONAL, + type: FieldDescriptorProto_Type.TYPE_DOUBLE, + type_name: "", + extendee: "", + default_value: "", + oneof_index: 0, + json_name: "", + options: undefined, + }; +} + +export const FieldDescriptorProto = { + encode(message: FieldDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== FieldDescriptorProto_Label.LABEL_OPTIONAL) { + writer.uint32(32).int32(fieldDescriptorProto_LabelToNumber(message.label)); + } + if (message.type !== FieldDescriptorProto_Type.TYPE_DOUBLE) { + writer.uint32(40).int32(fieldDescriptorProto_TypeToNumber(message.type)); + } + if (message.type_name !== "") { + writer.uint32(50).string(message.type_name); + } + if (message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.default_value !== "") { + writer.uint32(58).string(message.default_value); + } + if (message.oneof_index !== 0) { + writer.uint32(72).int32(message.oneof_index); + } + if (message.json_name !== "") { + writer.uint32(82).string(message.json_name); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = fieldDescriptorProto_LabelFromJSON(reader.int32()); + break; + case 5: + message.type = fieldDescriptorProto_TypeFromJSON(reader.int32()); + break; + case 6: + message.type_name = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.default_value = reader.string(); + break; + case 9: + message.oneof_index = reader.int32(); + break; + case 10: + message.json_name = reader.string(); + break; + case 8: + message.options = FieldOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FieldDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + label: isSet(object.label) + ? fieldDescriptorProto_LabelFromJSON(object.label) + : FieldDescriptorProto_Label.LABEL_OPTIONAL, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : FieldDescriptorProto_Type.TYPE_DOUBLE, + type_name: isSet(object.type_name) ? String(object.type_name) : "", + extendee: isSet(object.extendee) ? String(object.extendee) : "", + default_value: isSet(object.default_value) ? String(object.default_value) : "", + oneof_index: isSet(object.oneof_index) ? Number(object.oneof_index) : 0, + json_name: isSet(object.json_name) ? String(object.json_name) : "", + options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: FieldDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.label !== undefined && (obj.label = fieldDescriptorProto_LabelToJSON(message.label)); + message.type !== undefined && (obj.type = fieldDescriptorProto_TypeToJSON(message.type)); + message.type_name !== undefined && (obj.type_name = message.type_name); + message.extendee !== undefined && (obj.extendee = message.extendee); + message.default_value !== undefined && (obj.default_value = message.default_value); + message.oneof_index !== undefined && (obj.oneof_index = Math.round(message.oneof_index)); + message.json_name !== undefined && (obj.json_name = message.json_name); + message.options !== undefined && (obj.options = message.options ? FieldOptions.toJSON(message.options) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? FieldDescriptorProto_Label.LABEL_OPTIONAL; + message.type = object.type ?? FieldDescriptorProto_Type.TYPE_DOUBLE; + message.type_name = object.type_name ?? ""; + message.extendee = object.extendee ?? ""; + message.default_value = object.default_value ?? ""; + message.oneof_index = object.oneof_index ?? 0; + message.json_name = object.json_name ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? FieldOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseOneofDescriptorProto(): OneofDescriptorProto { + return { name: "", options: undefined }; +} + +export const OneofDescriptorProto = { + encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): OneofDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: OneofDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? OneofOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseEnumDescriptorProto(): EnumDescriptorProto { + return { name: "", value: [], options: undefined, reserved_range: [], reserved_name: [] }; +} + +export const EnumDescriptorProto = { + encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.reserved_range) { + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.reserved_name) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.reserved_range.push(EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); + break; + case 5: + message.reserved_name.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + value: Array.isArray(object?.value) ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, + reserved_range: Array.isArray(object?.reserved_range) + ? object.reserved_range.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) + : [], + reserved_name: Array.isArray(object?.reserved_name) ? object.reserved_name.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: EnumDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.value) { + obj.value = message.value.map((e) => e ? EnumValueDescriptorProto.toJSON(e) : undefined); + } else { + obj.value = []; + } + message.options !== undefined && (obj.options = message.options ? EnumOptions.toJSON(message.options) : undefined); + if (message.reserved_range) { + obj.reserved_range = message.reserved_range.map((e) => + e ? EnumDescriptorProto_EnumReservedRange.toJSON(e) : undefined + ); + } else { + obj.reserved_range = []; + } + if (message.reserved_name) { + obj.reserved_name = message.reserved_name.map((e) => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + + fromPartial, I>>(object: I): 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.reserved_range = object.reserved_range?.map((e) => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || + []; + message.reserved_name = object.reserved_name?.map((e) => e) || []; + return message; + }, +}; + +function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { + return { start: 0, end: 0 }; +} + +export const EnumDescriptorProto_EnumReservedRange = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { + return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + }, + + toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + fromPartial, I>>( + object: I, + ): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { + return { name: "", number: 0, options: undefined }; +} + +export const EnumValueDescriptorProto = { + encode(message: EnumValueDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): EnumValueDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: EnumValueDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.options !== undefined && + (obj.options = message.options ? EnumValueOptions.toJSON(message.options) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseServiceDescriptorProto(): ServiceDescriptorProto { + return { name: "", method: [], options: undefined }; +} + +export const ServiceDescriptorProto = { + encode(message: ServiceDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ServiceDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + method: Array.isArray(object?.method) ? object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? ServiceOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: ServiceDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.method) { + obj.method = message.method.map((e) => e ? MethodDescriptorProto.toJSON(e) : undefined); + } else { + obj.method = []; + } + message.options !== undefined && + (obj.options = message.options ? ServiceOptions.toJSON(message.options) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseMethodDescriptorProto(): MethodDescriptorProto { + return { + name: "", + input_type: "", + output_type: "", + options: undefined, + client_streaming: false, + server_streaming: false, + }; +} + +export const MethodDescriptorProto = { + encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.input_type !== "") { + writer.uint32(18).string(message.input_type); + } + if (message.output_type !== "") { + writer.uint32(26).string(message.output_type); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + } + if (message.client_streaming === true) { + writer.uint32(40).bool(message.client_streaming); + } + if (message.server_streaming === true) { + writer.uint32(48).bool(message.server_streaming); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.input_type = reader.string(); + break; + case 3: + message.output_type = reader.string(); + break; + case 4: + message.options = MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.client_streaming = reader.bool(); + break; + case 6: + message.server_streaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MethodDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + input_type: isSet(object.input_type) ? String(object.input_type) : "", + output_type: isSet(object.output_type) ? String(object.output_type) : "", + options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, + client_streaming: isSet(object.client_streaming) ? Boolean(object.client_streaming) : false, + server_streaming: isSet(object.server_streaming) ? Boolean(object.server_streaming) : false, + }; + }, + + toJSON(message: MethodDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.input_type !== undefined && (obj.input_type = message.input_type); + message.output_type !== undefined && (obj.output_type = message.output_type); + message.options !== undefined && + (obj.options = message.options ? MethodOptions.toJSON(message.options) : undefined); + message.client_streaming !== undefined && (obj.client_streaming = message.client_streaming); + message.server_streaming !== undefined && (obj.server_streaming = message.server_streaming); + return obj; + }, + + fromPartial, I>>(object: I): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.input_type = object.input_type ?? ""; + message.output_type = object.output_type ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? MethodOptions.fromPartial(object.options) + : undefined; + message.client_streaming = object.client_streaming ?? false; + message.server_streaming = object.server_streaming ?? false; + return message; + }, +}; + +function createBaseFileOptions(): FileOptions { + return { + java_package: "", + java_outer_classname: "", + java_multiple_files: false, + java_generate_equals_and_hash: false, + java_string_check_utf8: false, + optimize_for: FileOptions_OptimizeMode.SPEED, + go_package: "", + cc_generic_services: false, + java_generic_services: false, + py_generic_services: false, + php_generic_services: false, + deprecated: false, + cc_enable_arenas: false, + objc_class_prefix: "", + csharp_namespace: "", + swift_prefix: "", + php_class_prefix: "", + php_namespace: "", + php_metadata_namespace: "", + ruby_package: "", + uninterpreted_option: [], + }; +} + +export const FileOptions = { + encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.java_package !== "") { + writer.uint32(10).string(message.java_package); + } + if (message.java_outer_classname !== "") { + writer.uint32(66).string(message.java_outer_classname); + } + if (message.java_multiple_files === true) { + writer.uint32(80).bool(message.java_multiple_files); + } + if (message.java_generate_equals_and_hash === true) { + writer.uint32(160).bool(message.java_generate_equals_and_hash); + } + if (message.java_string_check_utf8 === true) { + writer.uint32(216).bool(message.java_string_check_utf8); + } + if (message.optimize_for !== FileOptions_OptimizeMode.SPEED) { + writer.uint32(72).int32(fileOptions_OptimizeModeToNumber(message.optimize_for)); + } + if (message.go_package !== "") { + writer.uint32(90).string(message.go_package); + } + if (message.cc_generic_services === true) { + writer.uint32(128).bool(message.cc_generic_services); + } + if (message.java_generic_services === true) { + writer.uint32(136).bool(message.java_generic_services); + } + if (message.py_generic_services === true) { + writer.uint32(144).bool(message.py_generic_services); + } + if (message.php_generic_services === true) { + writer.uint32(336).bool(message.php_generic_services); + } + if (message.deprecated === true) { + writer.uint32(184).bool(message.deprecated); + } + if (message.cc_enable_arenas === true) { + writer.uint32(248).bool(message.cc_enable_arenas); + } + if (message.objc_class_prefix !== "") { + writer.uint32(290).string(message.objc_class_prefix); + } + if (message.csharp_namespace !== "") { + writer.uint32(298).string(message.csharp_namespace); + } + if (message.swift_prefix !== "") { + writer.uint32(314).string(message.swift_prefix); + } + if (message.php_class_prefix !== "") { + writer.uint32(322).string(message.php_class_prefix); + } + if (message.php_namespace !== "") { + writer.uint32(330).string(message.php_namespace); + } + if (message.php_metadata_namespace !== "") { + writer.uint32(354).string(message.php_metadata_namespace); + } + if (message.ruby_package !== "") { + writer.uint32(362).string(message.ruby_package); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.java_package = reader.string(); + break; + case 8: + message.java_outer_classname = reader.string(); + break; + case 10: + message.java_multiple_files = reader.bool(); + break; + case 20: + message.java_generate_equals_and_hash = reader.bool(); + break; + case 27: + message.java_string_check_utf8 = reader.bool(); + break; + case 9: + message.optimize_for = fileOptions_OptimizeModeFromJSON(reader.int32()); + break; + case 11: + message.go_package = reader.string(); + break; + case 16: + message.cc_generic_services = reader.bool(); + break; + case 17: + message.java_generic_services = reader.bool(); + break; + case 18: + message.py_generic_services = reader.bool(); + break; + case 42: + message.php_generic_services = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.cc_enable_arenas = reader.bool(); + break; + case 36: + message.objc_class_prefix = reader.string(); + break; + case 37: + message.csharp_namespace = reader.string(); + break; + case 39: + message.swift_prefix = reader.string(); + break; + case 40: + message.php_class_prefix = reader.string(); + break; + case 41: + message.php_namespace = reader.string(); + break; + case 44: + message.php_metadata_namespace = reader.string(); + break; + case 45: + message.ruby_package = reader.string(); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FileOptions { + return { + java_package: isSet(object.java_package) ? String(object.java_package) : "", + java_outer_classname: isSet(object.java_outer_classname) ? String(object.java_outer_classname) : "", + java_multiple_files: isSet(object.java_multiple_files) ? Boolean(object.java_multiple_files) : false, + java_generate_equals_and_hash: isSet(object.java_generate_equals_and_hash) + ? Boolean(object.java_generate_equals_and_hash) + : false, + java_string_check_utf8: isSet(object.java_string_check_utf8) ? Boolean(object.java_string_check_utf8) : false, + optimize_for: isSet(object.optimize_for) + ? fileOptions_OptimizeModeFromJSON(object.optimize_for) + : FileOptions_OptimizeMode.SPEED, + go_package: isSet(object.go_package) ? String(object.go_package) : "", + cc_generic_services: isSet(object.cc_generic_services) ? Boolean(object.cc_generic_services) : false, + java_generic_services: isSet(object.java_generic_services) ? Boolean(object.java_generic_services) : false, + py_generic_services: isSet(object.py_generic_services) ? Boolean(object.py_generic_services) : false, + php_generic_services: isSet(object.php_generic_services) ? Boolean(object.php_generic_services) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + cc_enable_arenas: isSet(object.cc_enable_arenas) ? Boolean(object.cc_enable_arenas) : false, + objc_class_prefix: isSet(object.objc_class_prefix) ? String(object.objc_class_prefix) : "", + csharp_namespace: isSet(object.csharp_namespace) ? String(object.csharp_namespace) : "", + swift_prefix: isSet(object.swift_prefix) ? String(object.swift_prefix) : "", + php_class_prefix: isSet(object.php_class_prefix) ? String(object.php_class_prefix) : "", + php_namespace: isSet(object.php_namespace) ? String(object.php_namespace) : "", + php_metadata_namespace: isSet(object.php_metadata_namespace) ? String(object.php_metadata_namespace) : "", + ruby_package: isSet(object.ruby_package) ? String(object.ruby_package) : "", + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileOptions): unknown { + const obj: any = {}; + message.java_package !== undefined && (obj.java_package = message.java_package); + message.java_outer_classname !== undefined && (obj.java_outer_classname = message.java_outer_classname); + message.java_multiple_files !== undefined && (obj.java_multiple_files = message.java_multiple_files); + message.java_generate_equals_and_hash !== undefined && + (obj.java_generate_equals_and_hash = message.java_generate_equals_and_hash); + message.java_string_check_utf8 !== undefined && (obj.java_string_check_utf8 = message.java_string_check_utf8); + message.optimize_for !== undefined && (obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimize_for)); + message.go_package !== undefined && (obj.go_package = message.go_package); + message.cc_generic_services !== undefined && (obj.cc_generic_services = message.cc_generic_services); + message.java_generic_services !== undefined && (obj.java_generic_services = message.java_generic_services); + message.py_generic_services !== undefined && (obj.py_generic_services = message.py_generic_services); + message.php_generic_services !== undefined && (obj.php_generic_services = message.php_generic_services); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.cc_enable_arenas !== undefined && (obj.cc_enable_arenas = message.cc_enable_arenas); + message.objc_class_prefix !== undefined && (obj.objc_class_prefix = message.objc_class_prefix); + message.csharp_namespace !== undefined && (obj.csharp_namespace = message.csharp_namespace); + message.swift_prefix !== undefined && (obj.swift_prefix = message.swift_prefix); + message.php_class_prefix !== undefined && (obj.php_class_prefix = message.php_class_prefix); + message.php_namespace !== undefined && (obj.php_namespace = message.php_namespace); + message.php_metadata_namespace !== undefined && (obj.php_metadata_namespace = message.php_metadata_namespace); + message.ruby_package !== undefined && (obj.ruby_package = message.ruby_package); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): FileOptions { + const message = createBaseFileOptions(); + message.java_package = object.java_package ?? ""; + message.java_outer_classname = object.java_outer_classname ?? ""; + message.java_multiple_files = object.java_multiple_files ?? false; + message.java_generate_equals_and_hash = object.java_generate_equals_and_hash ?? false; + message.java_string_check_utf8 = object.java_string_check_utf8 ?? false; + message.optimize_for = object.optimize_for ?? FileOptions_OptimizeMode.SPEED; + message.go_package = object.go_package ?? ""; + message.cc_generic_services = object.cc_generic_services ?? false; + message.java_generic_services = object.java_generic_services ?? false; + message.py_generic_services = object.py_generic_services ?? false; + message.php_generic_services = object.php_generic_services ?? false; + message.deprecated = object.deprecated ?? false; + message.cc_enable_arenas = object.cc_enable_arenas ?? false; + message.objc_class_prefix = object.objc_class_prefix ?? ""; + message.csharp_namespace = object.csharp_namespace ?? ""; + message.swift_prefix = object.swift_prefix ?? ""; + message.php_class_prefix = object.php_class_prefix ?? ""; + message.php_namespace = object.php_namespace ?? ""; + message.php_metadata_namespace = object.php_metadata_namespace ?? ""; + message.ruby_package = object.ruby_package ?? ""; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMessageOptions(): MessageOptions { + return { + message_set_wire_format: false, + no_standard_descriptor_accessor: false, + deprecated: false, + map_entry: false, + uninterpreted_option: [], + }; +} + +export const MessageOptions = { + encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.message_set_wire_format === true) { + writer.uint32(8).bool(message.message_set_wire_format); + } + if (message.no_standard_descriptor_accessor === true) { + writer.uint32(16).bool(message.no_standard_descriptor_accessor); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.map_entry === true) { + writer.uint32(56).bool(message.map_entry); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.message_set_wire_format = reader.bool(); + break; + case 2: + message.no_standard_descriptor_accessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.map_entry = reader.bool(); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MessageOptions { + return { + message_set_wire_format: isSet(object.message_set_wire_format) ? Boolean(object.message_set_wire_format) : false, + no_standard_descriptor_accessor: isSet(object.no_standard_descriptor_accessor) + ? Boolean(object.no_standard_descriptor_accessor) + : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + map_entry: isSet(object.map_entry) ? Boolean(object.map_entry) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MessageOptions): unknown { + const obj: any = {}; + message.message_set_wire_format !== undefined && (obj.message_set_wire_format = message.message_set_wire_format); + message.no_standard_descriptor_accessor !== undefined && + (obj.no_standard_descriptor_accessor = message.no_standard_descriptor_accessor); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.map_entry !== undefined && (obj.map_entry = message.map_entry); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MessageOptions { + const message = createBaseMessageOptions(); + message.message_set_wire_format = object.message_set_wire_format ?? false; + message.no_standard_descriptor_accessor = object.no_standard_descriptor_accessor ?? false; + message.deprecated = object.deprecated ?? false; + message.map_entry = object.map_entry ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFieldOptions(): FieldOptions { + return { + ctype: FieldOptions_CType.STRING, + packed: false, + jstype: FieldOptions_JSType.JS_NORMAL, + lazy: false, + deprecated: false, + weak: false, + uninterpreted_option: [], + }; +} + +export const FieldOptions = { + encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.ctype !== FieldOptions_CType.STRING) { + writer.uint32(8).int32(fieldOptions_CTypeToNumber(message.ctype)); + } + if (message.packed === true) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== FieldOptions_JSType.JS_NORMAL) { + writer.uint32(48).int32(fieldOptions_JSTypeToNumber(message.jstype)); + } + if (message.lazy === true) { + writer.uint32(40).bool(message.lazy); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak === true) { + writer.uint32(80).bool(message.weak); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = fieldOptions_CTypeFromJSON(reader.int32()); + break; + case 2: + message.packed = reader.bool(); + break; + case 6: + message.jstype = fieldOptions_JSTypeFromJSON(reader.int32()); + break; + case 5: + message.lazy = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FieldOptions { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : FieldOptions_CType.STRING, + packed: isSet(object.packed) ? Boolean(object.packed) : false, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : FieldOptions_JSType.JS_NORMAL, + lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? Boolean(object.weak) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FieldOptions): unknown { + const obj: any = {}; + message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); + message.packed !== undefined && (obj.packed = message.packed); + message.jstype !== undefined && (obj.jstype = fieldOptions_JSTypeToJSON(message.jstype)); + message.lazy !== undefined && (obj.lazy = message.lazy); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.weak !== undefined && (obj.weak = message.weak); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): FieldOptions { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? FieldOptions_CType.STRING; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? FieldOptions_JSType.JS_NORMAL; + message.lazy = object.lazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { uninterpreted_option: [] }; +} + +export const OneofOptions = { + encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { allow_alias: false, deprecated: false, uninterpreted_option: [] }; +} + +export const EnumOptions = { + encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.allow_alias === true) { + writer.uint32(16).bool(message.allow_alias); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.allow_alias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allow_alias: isSet(object.allow_alias) ? Boolean(object.allow_alias) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + message.allow_alias !== undefined && (obj.allow_alias = message.allow_alias); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): EnumOptions { + const message = createBaseEnumOptions(); + message.allow_alias = object.allow_alias ?? false; + message.deprecated = object.deprecated ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumValueOptions(): EnumValueOptions { + return { deprecated: false, uninterpreted_option: [] }; +} + +export const EnumValueOptions = { + encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(8).bool(message.deprecated); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumValueOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumValueOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): EnumValueOptions { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseServiceOptions(): ServiceOptions { + return { deprecated: false, uninterpreted_option: [] }; +} + +export const ServiceOptions = { + encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 33: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ServiceOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ServiceOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ServiceOptions { + const message = createBaseServiceOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMethodOptions(): MethodOptions { + return { + deprecated: false, + idempotency_level: MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN, + uninterpreted_option: [], + }; +} + +export const MethodOptions = { + encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotency_level !== MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN) { + writer.uint32(272).int32(methodOptions_IdempotencyLevelToNumber(message.idempotency_level)); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.idempotency_level = methodOptions_IdempotencyLevelFromJSON(reader.int32()); + break; + case 999: + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MethodOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + idempotency_level: isSet(object.idempotency_level) + ? methodOptions_IdempotencyLevelFromJSON(object.idempotency_level) + : MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MethodOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.idempotency_level !== undefined && + (obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotency_level)); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial, I>>(object: I): MethodOptions { + const message = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotency_level = object.idempotency_level ?? MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUninterpretedOption(): UninterpretedOption { + return { + name: [], + identifier_value: "", + positive_int_value: "0", + negative_int_value: "0", + double_value: 0, + string_value: new Uint8Array(), + aggregate_value: "", + }; +} + +export const UninterpretedOption = { + encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.name) { + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.identifier_value !== "") { + writer.uint32(26).string(message.identifier_value); + } + if (message.positive_int_value !== "0") { + writer.uint32(32).uint64(message.positive_int_value); + } + if (message.negative_int_value !== "0") { + writer.uint32(40).int64(message.negative_int_value); + } + if (message.double_value !== 0) { + writer.uint32(49).double(message.double_value); + } + if (message.string_value.length !== 0) { + writer.uint32(58).bytes(message.string_value); + } + if (message.aggregate_value !== "") { + writer.uint32(66).string(message.aggregate_value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.identifier_value = reader.string(); + break; + case 4: + message.positive_int_value = longToString(reader.uint64() as Long); + break; + case 5: + message.negative_int_value = longToString(reader.int64() as Long); + break; + case 6: + message.double_value = reader.double(); + break; + case 7: + message.string_value = reader.bytes(); + break; + case 8: + message.aggregate_value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UninterpretedOption { + return { + name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], + identifier_value: isSet(object.identifier_value) ? String(object.identifier_value) : "", + positive_int_value: isSet(object.positive_int_value) ? String(object.positive_int_value) : "0", + negative_int_value: isSet(object.negative_int_value) ? String(object.negative_int_value) : "0", + double_value: isSet(object.double_value) ? Number(object.double_value) : 0, + string_value: isSet(object.string_value) ? bytesFromBase64(object.string_value) : new Uint8Array(), + aggregate_value: isSet(object.aggregate_value) ? String(object.aggregate_value) : "", + }; + }, + + toJSON(message: UninterpretedOption): unknown { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map((e) => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); + } else { + obj.name = []; + } + message.identifier_value !== undefined && (obj.identifier_value = message.identifier_value); + message.positive_int_value !== undefined && (obj.positive_int_value = message.positive_int_value); + message.negative_int_value !== undefined && (obj.negative_int_value = message.negative_int_value); + message.double_value !== undefined && (obj.double_value = message.double_value); + message.string_value !== undefined && + (obj.string_value = base64FromBytes( + message.string_value !== undefined ? message.string_value : new Uint8Array(), + )); + message.aggregate_value !== undefined && (obj.aggregate_value = message.aggregate_value); + return obj; + }, + + fromPartial, I>>(object: I): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map((e) => UninterpretedOption_NamePart.fromPartial(e)) || []; + message.identifier_value = object.identifier_value ?? ""; + message.positive_int_value = object.positive_int_value ?? "0"; + message.negative_int_value = object.negative_int_value ?? "0"; + message.double_value = object.double_value ?? 0; + message.string_value = object.string_value ?? new Uint8Array(); + message.aggregate_value = object.aggregate_value ?? ""; + return message; + }, +}; + +function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { + return { name_part: "", is_extension: false }; +} + +export const UninterpretedOption_NamePart = { + encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name_part !== "") { + writer.uint32(10).string(message.name_part); + } + if (message.is_extension === true) { + writer.uint32(16).bool(message.is_extension); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.name_part = reader.string(); + break; + case 2: + message.is_extension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UninterpretedOption_NamePart { + return { + name_part: isSet(object.name_part) ? String(object.name_part) : "", + is_extension: isSet(object.is_extension) ? Boolean(object.is_extension) : false, + }; + }, + + toJSON(message: UninterpretedOption_NamePart): unknown { + const obj: any = {}; + message.name_part !== undefined && (obj.name_part = message.name_part); + message.is_extension !== undefined && (obj.is_extension = message.is_extension); + return obj; + }, + + fromPartial, I>>(object: I): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + message.name_part = object.name_part ?? ""; + message.is_extension = object.is_extension ?? false; + return message; + }, +}; + +function createBaseSourceCodeInfo(): SourceCodeInfo { + return { location: [] }; +} + +export const SourceCodeInfo = { + encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SourceCodeInfo { + return { + location: Array.isArray(object?.location) + ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfo): unknown { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map((e) => e ? SourceCodeInfo_Location.toJSON(e) : undefined); + } else { + obj.location = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map((e) => SourceCodeInfo_Location.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { + return { path: [], span: [], leading_comments: "", trailing_comments: "", leading_detached_comments: [] }; +} + +export const SourceCodeInfo_Location = { + encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.leading_comments !== "") { + writer.uint32(26).string(message.leading_comments); + } + if (message.trailing_comments !== "") { + writer.uint32(34).string(message.trailing_comments); + } + for (const v of message.leading_detached_comments) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.leading_comments = reader.string(); + break; + case 4: + message.trailing_comments = reader.string(); + break; + case 6: + message.leading_detached_comments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SourceCodeInfo_Location { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], + span: Array.isArray(object?.span) ? object.span.map((e: any) => Number(e)) : [], + leading_comments: isSet(object.leading_comments) ? String(object.leading_comments) : "", + trailing_comments: isSet(object.trailing_comments) ? String(object.trailing_comments) : "", + leading_detached_comments: Array.isArray(object?.leading_detached_comments) + ? object.leading_detached_comments.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfo_Location): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } else { + obj.path = []; + } + if (message.span) { + obj.span = message.span.map((e) => Math.round(e)); + } else { + obj.span = []; + } + message.leading_comments !== undefined && (obj.leading_comments = message.leading_comments); + message.trailing_comments !== undefined && (obj.trailing_comments = message.trailing_comments); + if (message.leading_detached_comments) { + obj.leading_detached_comments = message.leading_detached_comments.map((e) => e); + } else { + obj.leading_detached_comments = []; + } + return obj; + }, + + fromPartial, I>>(object: I): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map((e) => e) || []; + message.span = object.span?.map((e) => e) || []; + message.leading_comments = object.leading_comments ?? ""; + message.trailing_comments = object.trailing_comments ?? ""; + message.leading_detached_comments = object.leading_detached_comments?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { + return { annotation: [] }; +} + +export const GeneratedCodeInfo = { + encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): GeneratedCodeInfo { + return { + annotation: Array.isArray(object?.annotation) + ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneratedCodeInfo): unknown { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map((e) => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); + } else { + obj.annotation = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map((e) => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { + return { path: [], source_file: "", begin: 0, end: 0 }; +} + +export const GeneratedCodeInfo_Annotation = { + encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + if (message.source_file !== "") { + writer.uint32(18).string(message.source_file); + } + if (message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== 0) { + writer.uint32(32).int32(message.end); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.source_file = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GeneratedCodeInfo_Annotation { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], + source_file: isSet(object.source_file) ? String(object.source_file) : "", + begin: isSet(object.begin) ? Number(object.begin) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + }; + }, + + toJSON(message: GeneratedCodeInfo_Annotation): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } else { + obj.path = []; + } + message.source_file !== undefined && (obj.source_file = message.source_file); + message.begin !== undefined && (obj.begin = Math.round(message.begin)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + fromPartial, I>>(object: I): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map((e) => e) || []; + message.source_file = object.source_file ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/google/protobuf/duration.ts b/common/types/src/lcd/google/protobuf/duration.ts new file mode 100644 index 00000000..8ea1d106 --- /dev/null +++ b/common/types/src/lcd/google/protobuf/duration.ts @@ -0,0 +1,165 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * 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 (durations.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: string; + /** + * 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; +} + +function createBaseDuration(): Duration { + return { seconds: "0", nanos: 0 }; +} + +export const Duration = { + encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.seconds !== "0") { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Duration { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? String(object.seconds) : "0", + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = message.seconds); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + fromPartial, I>>(object: I): Duration { + const message = createBaseDuration(); + message.seconds = object.seconds ?? "0"; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/google/protobuf/empty.ts b/common/types/src/lcd/google/protobuf/empty.ts new file mode 100644 index 00000000..58ef8256 --- /dev/null +++ b/common/types/src/lcd/google/protobuf/empty.ts @@ -0,0 +1,68 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + * + * The JSON representation for `Empty` is empty JSON object `{}`. + */ +export interface Empty { +} + +function createBaseEmpty(): Empty { + return {}; +} + +export const Empty = { + encode(_: Empty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Empty { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmpty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): Empty { + return {}; + }, + + toJSON(_: Empty): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): Empty { + const message = createBaseEmpty(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; diff --git a/common/types/src/lcd/google/protobuf/timestamp.ts b/common/types/src/lcd/google/protobuf/timestamp.ts new file mode 100644 index 00000000..8e3ff86f --- /dev/null +++ b/common/types/src/lcd/google/protobuf/timestamp.ts @@ -0,0 +1,186 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * 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 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://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) 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: string; + /** + * 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; +} + +function createBaseTimestamp(): Timestamp { + return { seconds: "0", nanos: 0 }; +} + +export const Timestamp = { + encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.seconds !== "0") { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) ? String(object.seconds) : "0", + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = message.seconds); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + fromPartial, I>>(object: I): Timestamp { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? "0"; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/bundles.ts b/common/types/src/lcd/kyve/bundles/v1beta1/bundles.ts new file mode 100644 index 00000000..4e5dd1b2 --- /dev/null +++ b/common/types/src/lcd/kyve/bundles/v1beta1/bundles.ts @@ -0,0 +1,563 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** + * BundleStatus represents the status of an evaluated bundle + * proposal. + */ +export enum BundleStatus { + /** BUNDLE_STATUS_UNSPECIFIED - BUNDLE_STATUS_UNSPECIFIED ... */ + BUNDLE_STATUS_UNSPECIFIED = "BUNDLE_STATUS_UNSPECIFIED", + /** BUNDLE_STATUS_VALID - BUNDLE_STATUS_VALID ... */ + BUNDLE_STATUS_VALID = "BUNDLE_STATUS_VALID", + /** BUNDLE_STATUS_INVALID - BUNDLE_STATUS_INVALID ... */ + BUNDLE_STATUS_INVALID = "BUNDLE_STATUS_INVALID", + /** BUNDLE_STATUS_NO_FUNDS - BUNDLE_STATUS_NO_FUNDS ... */ + BUNDLE_STATUS_NO_FUNDS = "BUNDLE_STATUS_NO_FUNDS", + /** BUNDLE_STATUS_NO_QUORUM - BUNDLE_STATUS_NO_QUORUM ... */ + BUNDLE_STATUS_NO_QUORUM = "BUNDLE_STATUS_NO_QUORUM", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function bundleStatusFromJSON(object: any): BundleStatus { + switch (object) { + case 0: + case "BUNDLE_STATUS_UNSPECIFIED": + return BundleStatus.BUNDLE_STATUS_UNSPECIFIED; + case 1: + case "BUNDLE_STATUS_VALID": + return BundleStatus.BUNDLE_STATUS_VALID; + case 2: + case "BUNDLE_STATUS_INVALID": + return BundleStatus.BUNDLE_STATUS_INVALID; + case 3: + case "BUNDLE_STATUS_NO_FUNDS": + return BundleStatus.BUNDLE_STATUS_NO_FUNDS; + case 4: + case "BUNDLE_STATUS_NO_QUORUM": + return BundleStatus.BUNDLE_STATUS_NO_QUORUM; + case -1: + case "UNRECOGNIZED": + default: + return BundleStatus.UNRECOGNIZED; + } +} + +export function bundleStatusToJSON(object: BundleStatus): string { + switch (object) { + case BundleStatus.BUNDLE_STATUS_UNSPECIFIED: + return "BUNDLE_STATUS_UNSPECIFIED"; + case BundleStatus.BUNDLE_STATUS_VALID: + return "BUNDLE_STATUS_VALID"; + case BundleStatus.BUNDLE_STATUS_INVALID: + return "BUNDLE_STATUS_INVALID"; + case BundleStatus.BUNDLE_STATUS_NO_FUNDS: + return "BUNDLE_STATUS_NO_FUNDS"; + case BundleStatus.BUNDLE_STATUS_NO_QUORUM: + return "BUNDLE_STATUS_NO_QUORUM"; + case BundleStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function bundleStatusToNumber(object: BundleStatus): number { + switch (object) { + case BundleStatus.BUNDLE_STATUS_UNSPECIFIED: + return 0; + case BundleStatus.BUNDLE_STATUS_VALID: + return 1; + case BundleStatus.BUNDLE_STATUS_INVALID: + return 2; + case BundleStatus.BUNDLE_STATUS_NO_FUNDS: + return 3; + case BundleStatus.BUNDLE_STATUS_NO_QUORUM: + return 4; + case BundleStatus.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * BundleProposal represents the current bundle proposal + * of a storage pool + */ +export interface BundleProposal { + /** pool_id is the id of the pool for which this proposal is for */ + pool_id: string; + /** storage_id is the id with which the data can be retrieved from */ + storage_id: string; + /** uploader is the address of the staker who submitted the current proposal */ + uploader: string; + /** next_uploader is the address of the staker who should upload the next proposal */ + next_uploader: string; + /** data_size the size of the data in bytes */ + data_size: string; + /** bundle_size the size of the bundle (amount of data items) */ + bundle_size: string; + /** to_key the key of the last data item in the bundle proposal */ + to_key: string; + /** bundle_summary a string summary of the current proposal */ + bundle_summary: string; + /** data_hash a sha256 hash of the raw compressed data */ + data_hash: string; + /** updated_at the last time this proposal was edited */ + updated_at: string; + /** voters_valid list of all stakers who voted in favor for current proposal */ + voters_valid: string[]; + /** voters_invalid list of all stakers who voted against for current proposal */ + voters_invalid: string[]; + /** voters_abstain list of all stakers who voted abstain for current proposal */ + voters_abstain: string[]; + /** from_key the key of the first data item in the bundle proposal */ + from_key: string; + /** storage_provider_id the id of the storage provider where the bundle is stored */ + storage_provider_id: number; + /** compression_id the id of the compression type with which the data was compressed */ + compression_id: number; +} + +/** + * FinalizedBundle represents a bundle proposal where the majority + * agreed on its validity + */ +export interface FinalizedBundle { + /** pool_id is the id of the pool for which this proposal is for */ + pool_id: string; + /** id is a unique identifier for each finalized bundle in a pool */ + id: string; + /** storage_id is the id with which the data can be retrieved from */ + storage_id: string; + /** uploader is the address of the staker who submitted this bundle */ + uploader: string; + /** from_index is the index from where the bundle starts (inclusive) */ + from_index: string; + /** to_index is the index to which the bundle goes (exclusive) */ + to_index: string; + /** to_key the key of the last data item in the bundle proposal */ + to_key: string; + /** bundle_summary a string summary of the current proposal */ + bundle_summary: string; + /** data_hash a sha256 hash of the raw compressed data */ + data_hash: string; + /** finalized_at is the block height at which this bundle got finalized */ + finalized_at: string; + /** from_key the key of the first data item in the bundle proposal */ + from_key: string; + /** storage_provider_id the id of the storage provider where the bundle is stored */ + storage_provider_id: number; + /** compression_id the id of the compression type with which the data was compressed */ + compression_id: number; +} + +function createBaseBundleProposal(): BundleProposal { + return { + pool_id: "0", + storage_id: "", + uploader: "", + next_uploader: "", + data_size: "0", + bundle_size: "0", + to_key: "", + bundle_summary: "", + data_hash: "", + updated_at: "0", + voters_valid: [], + voters_invalid: [], + voters_abstain: [], + from_key: "", + storage_provider_id: 0, + compression_id: 0, + }; +} + +export const BundleProposal = { + encode(message: BundleProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.storage_id !== "") { + writer.uint32(18).string(message.storage_id); + } + if (message.uploader !== "") { + writer.uint32(26).string(message.uploader); + } + if (message.next_uploader !== "") { + writer.uint32(34).string(message.next_uploader); + } + if (message.data_size !== "0") { + writer.uint32(40).uint64(message.data_size); + } + if (message.bundle_size !== "0") { + writer.uint32(48).uint64(message.bundle_size); + } + if (message.to_key !== "") { + writer.uint32(58).string(message.to_key); + } + if (message.bundle_summary !== "") { + writer.uint32(66).string(message.bundle_summary); + } + if (message.data_hash !== "") { + writer.uint32(74).string(message.data_hash); + } + if (message.updated_at !== "0") { + writer.uint32(80).uint64(message.updated_at); + } + for (const v of message.voters_valid) { + writer.uint32(90).string(v!); + } + for (const v of message.voters_invalid) { + writer.uint32(98).string(v!); + } + for (const v of message.voters_abstain) { + writer.uint32(106).string(v!); + } + if (message.from_key !== "") { + writer.uint32(114).string(message.from_key); + } + if (message.storage_provider_id !== 0) { + writer.uint32(120).uint32(message.storage_provider_id); + } + if (message.compression_id !== 0) { + writer.uint32(128).uint32(message.compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BundleProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBundleProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.storage_id = reader.string(); + break; + case 3: + message.uploader = reader.string(); + break; + case 4: + message.next_uploader = reader.string(); + break; + case 5: + message.data_size = longToString(reader.uint64() as Long); + break; + case 6: + message.bundle_size = longToString(reader.uint64() as Long); + break; + case 7: + message.to_key = reader.string(); + break; + case 8: + message.bundle_summary = reader.string(); + break; + case 9: + message.data_hash = reader.string(); + break; + case 10: + message.updated_at = longToString(reader.uint64() as Long); + break; + case 11: + message.voters_valid.push(reader.string()); + break; + case 12: + message.voters_invalid.push(reader.string()); + break; + case 13: + message.voters_abstain.push(reader.string()); + break; + case 14: + message.from_key = reader.string(); + break; + case 15: + message.storage_provider_id = reader.uint32(); + break; + case 16: + message.compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BundleProposal { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + uploader: isSet(object.uploader) ? String(object.uploader) : "", + next_uploader: isSet(object.next_uploader) ? String(object.next_uploader) : "", + data_size: isSet(object.data_size) ? String(object.data_size) : "0", + bundle_size: isSet(object.bundle_size) ? String(object.bundle_size) : "0", + to_key: isSet(object.to_key) ? String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? String(object.data_hash) : "", + updated_at: isSet(object.updated_at) ? String(object.updated_at) : "0", + voters_valid: Array.isArray(object?.voters_valid) ? object.voters_valid.map((e: any) => String(e)) : [], + voters_invalid: Array.isArray(object?.voters_invalid) ? object.voters_invalid.map((e: any) => String(e)) : [], + voters_abstain: Array.isArray(object?.voters_abstain) ? object.voters_abstain.map((e: any) => String(e)) : [], + from_key: isSet(object.from_key) ? String(object.from_key) : "", + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? Number(object.compression_id) : 0, + }; + }, + + toJSON(message: BundleProposal): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.uploader !== undefined && (obj.uploader = message.uploader); + message.next_uploader !== undefined && (obj.next_uploader = message.next_uploader); + message.data_size !== undefined && (obj.data_size = message.data_size); + message.bundle_size !== undefined && (obj.bundle_size = message.bundle_size); + message.to_key !== undefined && (obj.to_key = message.to_key); + message.bundle_summary !== undefined && (obj.bundle_summary = message.bundle_summary); + message.data_hash !== undefined && (obj.data_hash = message.data_hash); + message.updated_at !== undefined && (obj.updated_at = message.updated_at); + if (message.voters_valid) { + obj.voters_valid = message.voters_valid.map((e) => e); + } else { + obj.voters_valid = []; + } + if (message.voters_invalid) { + obj.voters_invalid = message.voters_invalid.map((e) => e); + } else { + obj.voters_invalid = []; + } + if (message.voters_abstain) { + obj.voters_abstain = message.voters_abstain.map((e) => e); + } else { + obj.voters_abstain = []; + } + message.from_key !== undefined && (obj.from_key = message.from_key); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + message.compression_id !== undefined && (obj.compression_id = Math.round(message.compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): BundleProposal { + const message = createBaseBundleProposal(); + message.pool_id = object.pool_id ?? "0"; + message.storage_id = object.storage_id ?? ""; + message.uploader = object.uploader ?? ""; + message.next_uploader = object.next_uploader ?? ""; + message.data_size = object.data_size ?? "0"; + message.bundle_size = object.bundle_size ?? "0"; + message.to_key = object.to_key ?? ""; + message.bundle_summary = object.bundle_summary ?? ""; + message.data_hash = object.data_hash ?? ""; + message.updated_at = object.updated_at ?? "0"; + message.voters_valid = object.voters_valid?.map((e) => e) || []; + message.voters_invalid = object.voters_invalid?.map((e) => e) || []; + message.voters_abstain = object.voters_abstain?.map((e) => e) || []; + message.from_key = object.from_key ?? ""; + message.storage_provider_id = object.storage_provider_id ?? 0; + message.compression_id = object.compression_id ?? 0; + return message; + }, +}; + +function createBaseFinalizedBundle(): FinalizedBundle { + return { + pool_id: "0", + id: "0", + storage_id: "", + uploader: "", + from_index: "0", + to_index: "0", + to_key: "", + bundle_summary: "", + data_hash: "", + finalized_at: "0", + from_key: "", + storage_provider_id: 0, + compression_id: 0, + }; +} + +export const FinalizedBundle = { + encode(message: FinalizedBundle, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.storage_id !== "") { + writer.uint32(26).string(message.storage_id); + } + if (message.uploader !== "") { + writer.uint32(34).string(message.uploader); + } + if (message.from_index !== "0") { + writer.uint32(40).uint64(message.from_index); + } + if (message.to_index !== "0") { + writer.uint32(48).uint64(message.to_index); + } + if (message.to_key !== "") { + writer.uint32(58).string(message.to_key); + } + if (message.bundle_summary !== "") { + writer.uint32(66).string(message.bundle_summary); + } + if (message.data_hash !== "") { + writer.uint32(74).string(message.data_hash); + } + if (message.finalized_at !== "0") { + writer.uint32(80).uint64(message.finalized_at); + } + if (message.from_key !== "") { + writer.uint32(90).string(message.from_key); + } + if (message.storage_provider_id !== 0) { + writer.uint32(96).uint32(message.storage_provider_id); + } + if (message.compression_id !== 0) { + writer.uint32(104).uint32(message.compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FinalizedBundle { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFinalizedBundle(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.storage_id = reader.string(); + break; + case 4: + message.uploader = reader.string(); + break; + case 5: + message.from_index = longToString(reader.uint64() as Long); + break; + case 6: + message.to_index = longToString(reader.uint64() as Long); + break; + case 7: + message.to_key = reader.string(); + break; + case 8: + message.bundle_summary = reader.string(); + break; + case 9: + message.data_hash = reader.string(); + break; + case 10: + message.finalized_at = longToString(reader.uint64() as Long); + break; + case 11: + message.from_key = reader.string(); + break; + case 12: + message.storage_provider_id = reader.uint32(); + break; + case 13: + message.compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FinalizedBundle { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + uploader: isSet(object.uploader) ? String(object.uploader) : "", + from_index: isSet(object.from_index) ? String(object.from_index) : "0", + to_index: isSet(object.to_index) ? String(object.to_index) : "0", + to_key: isSet(object.to_key) ? String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? String(object.data_hash) : "", + finalized_at: isSet(object.finalized_at) ? String(object.finalized_at) : "0", + from_key: isSet(object.from_key) ? String(object.from_key) : "", + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? Number(object.compression_id) : 0, + }; + }, + + toJSON(message: FinalizedBundle): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.uploader !== undefined && (obj.uploader = message.uploader); + message.from_index !== undefined && (obj.from_index = message.from_index); + message.to_index !== undefined && (obj.to_index = message.to_index); + message.to_key !== undefined && (obj.to_key = message.to_key); + message.bundle_summary !== undefined && (obj.bundle_summary = message.bundle_summary); + message.data_hash !== undefined && (obj.data_hash = message.data_hash); + message.finalized_at !== undefined && (obj.finalized_at = message.finalized_at); + message.from_key !== undefined && (obj.from_key = message.from_key); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + message.compression_id !== undefined && (obj.compression_id = Math.round(message.compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): FinalizedBundle { + const message = createBaseFinalizedBundle(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + message.storage_id = object.storage_id ?? ""; + message.uploader = object.uploader ?? ""; + message.from_index = object.from_index ?? "0"; + message.to_index = object.to_index ?? "0"; + message.to_key = object.to_key ?? ""; + message.bundle_summary = object.bundle_summary ?? ""; + message.data_hash = object.data_hash ?? ""; + message.finalized_at = object.finalized_at ?? "0"; + message.from_key = object.from_key ?? ""; + message.storage_provider_id = object.storage_provider_id ?? 0; + message.compression_id = object.compression_id ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/events.ts b/common/types/src/lcd/kyve/bundles/v1beta1/events.ts new file mode 100644 index 00000000..c7bb857a --- /dev/null +++ b/common/types/src/lcd/kyve/bundles/v1beta1/events.ts @@ -0,0 +1,889 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { BundleStatus, bundleStatusFromJSON, bundleStatusToJSON, bundleStatusToNumber } from "./bundles"; +import { VoteType, voteTypeFromJSON, voteTypeToJSON, voteTypeToNumber } from "./tx"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** + * EventBundleVote is an event emitted when a protocol node votes on a bundle. + * emitted_by: MsgVoteBundleProposal + */ +export interface EventBundleVote { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** staker is the account staker of the protocol node. */ + staker: string; + /** storage_id is the unique ID of the bundle. */ + storage_id: string; + /** vote is for what the validator voted with */ + vote: VoteType; +} + +/** + * EventBundleProposed is submitted by the MsgSubmitBundleProposal message + * emitted_by: MsgSubmitBundleProposal + */ +export interface EventBundleProposed { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** internal id for the KYVE-bundle */ + id: string; + /** + * storage_id is the ID to retrieve to data item from the configured storage provider + * e.g. the ARWEAVE-id + */ + storage_id: string; + /** Address of the uploader/proposer of the bundle */ + uploader: string; + /** data_size size in bytes of the data */ + data_size: string; + /** from_index starting index of the bundle (inclusive) */ + from_index: string; + /** bundle_size amount of data items in the bundle */ + bundle_size: string; + /** from_key the key of the first data item in the bundle */ + from_key: string; + /** to_key the key of the last data item in the bundle */ + to_key: string; + /** + * bundle_summary is a short string holding some useful information of + * the bundle which will get stored on-chain + */ + bundle_summary: string; + /** data_hash is a sha256 hash of the raw compressed data */ + data_hash: string; + /** proposed_at the unix time when the bundle was proposed */ + proposed_at: string; + /** + * storage_provider_id the unique id of the storage provider where + * the data of the bundle is tored + */ + storage_provider_id: number; + /** + * compression_id the unique id of the compression type the data + * of the bundle was compressed with + */ + compression_id: number; +} + +/** + * EventBundleFinalized is an event emitted when a bundle is finalised. + * emitted_by: MsgSubmitBundleProposal, EndBlock + */ +export interface EventBundleFinalized { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** internal id for the KYVE-bundle */ + id: string; + /** total voting power which voted for valid */ + valid: string; + /** total voting power which voted for invalid */ + invalid: string; + /** total voting power which voted for abstain */ + abstain: string; + /** total voting power of the pool */ + total: string; + /** status of the finalized bundle */ + status: BundleStatus; + /** rewards transferred to treasury (in ukyve) */ + reward_treasury: string; + /** rewardUploader rewards directly transferred to uploader (in ukyve) */ + reward_uploader: string; + /** rewardDelegation rewards distributed among all delegators (in ukyve) */ + reward_delegation: string; + /** rewardTotal the total bundle reward */ + reward_total: string; + /** finalized_at the block height where the bundle got finalized */ + finalized_at: string; + /** uploader the address of the uploader of this bundle */ + uploader: string; + /** next_uploader the address of the next uploader after this bundle */ + next_uploader: string; +} + +/** + * EventClaimedUploaderRole is an event emitted when an uploader claims the uploader role + * emitted_by: MsgClaimUploaderRole + */ +export interface EventClaimedUploaderRole { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** id internal id for the KYVE-bundle */ + id: string; + /** + * new_uploader the address of the participant who claimed + * the free uploader role + */ + new_uploader: string; +} + +/** + * EventSkippedUploaderRole is an event emitted when an uploader skips the upload + * emitted_by: MsgSkipUploaderRole + */ +export interface EventSkippedUploaderRole { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** id internal id for the KYVE-bundle */ + id: string; + /** previous_uploader is the address of the staker who skipped his uploader role */ + previous_uploader: string; + /** new_uploader is the address of the new uploader who got automatically selected */ + new_uploader: string; +} + +/** + * EventPointIncreased is an event emitted when a staker receives a point + * emitted_by: MsgSubmitBundleProposal, EndBlock + */ +export interface EventPointIncreased { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** staker is the address of the staker who received the point */ + staker: string; + /** current_points is the amount of points the staker has now */ + current_points: string; +} + +/** + * EventPointIncreased is an event emitted when a staker receives a point + * emitted_by: MsgSubmitBundleProposal, EndBlock + */ +export interface EventPointsReset { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** staker is the address of the staker who has zero points now */ + staker: string; +} + +function createBaseEventBundleVote(): EventBundleVote { + return { pool_id: "0", staker: "", storage_id: "", vote: VoteType.VOTE_TYPE_UNSPECIFIED }; +} + +export const EventBundleVote = { + encode(message: EventBundleVote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.storage_id !== "") { + writer.uint32(26).string(message.storage_id); + } + if (message.vote !== VoteType.VOTE_TYPE_UNSPECIFIED) { + writer.uint32(32).int32(voteTypeToNumber(message.vote)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBundleVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.storage_id = reader.string(); + break; + case 4: + message.vote = voteTypeFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventBundleVote { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + vote: isSet(object.vote) ? voteTypeFromJSON(object.vote) : VoteType.VOTE_TYPE_UNSPECIFIED, + }; + }, + + toJSON(message: EventBundleVote): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.vote !== undefined && (obj.vote = voteTypeToJSON(message.vote)); + return obj; + }, + + fromPartial, I>>(object: I): EventBundleVote { + const message = createBaseEventBundleVote(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.storage_id = object.storage_id ?? ""; + message.vote = object.vote ?? VoteType.VOTE_TYPE_UNSPECIFIED; + return message; + }, +}; + +function createBaseEventBundleProposed(): EventBundleProposed { + return { + pool_id: "0", + id: "0", + storage_id: "", + uploader: "", + data_size: "0", + from_index: "0", + bundle_size: "0", + from_key: "", + to_key: "", + bundle_summary: "", + data_hash: "", + proposed_at: "0", + storage_provider_id: 0, + compression_id: 0, + }; +} + +export const EventBundleProposed = { + encode(message: EventBundleProposed, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.storage_id !== "") { + writer.uint32(26).string(message.storage_id); + } + if (message.uploader !== "") { + writer.uint32(34).string(message.uploader); + } + if (message.data_size !== "0") { + writer.uint32(40).uint64(message.data_size); + } + if (message.from_index !== "0") { + writer.uint32(48).uint64(message.from_index); + } + if (message.bundle_size !== "0") { + writer.uint32(56).uint64(message.bundle_size); + } + if (message.from_key !== "") { + writer.uint32(66).string(message.from_key); + } + if (message.to_key !== "") { + writer.uint32(74).string(message.to_key); + } + if (message.bundle_summary !== "") { + writer.uint32(82).string(message.bundle_summary); + } + if (message.data_hash !== "") { + writer.uint32(90).string(message.data_hash); + } + if (message.proposed_at !== "0") { + writer.uint32(96).uint64(message.proposed_at); + } + if (message.storage_provider_id !== 0) { + writer.uint32(104).uint32(message.storage_provider_id); + } + if (message.compression_id !== 0) { + writer.uint32(112).uint32(message.compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleProposed { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBundleProposed(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.storage_id = reader.string(); + break; + case 4: + message.uploader = reader.string(); + break; + case 5: + message.data_size = longToString(reader.uint64() as Long); + break; + case 6: + message.from_index = longToString(reader.uint64() as Long); + break; + case 7: + message.bundle_size = longToString(reader.uint64() as Long); + break; + case 8: + message.from_key = reader.string(); + break; + case 9: + message.to_key = reader.string(); + break; + case 10: + message.bundle_summary = reader.string(); + break; + case 11: + message.data_hash = reader.string(); + break; + case 12: + message.proposed_at = longToString(reader.uint64() as Long); + break; + case 13: + message.storage_provider_id = reader.uint32(); + break; + case 14: + message.compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventBundleProposed { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + uploader: isSet(object.uploader) ? String(object.uploader) : "", + data_size: isSet(object.data_size) ? String(object.data_size) : "0", + from_index: isSet(object.from_index) ? String(object.from_index) : "0", + bundle_size: isSet(object.bundle_size) ? String(object.bundle_size) : "0", + from_key: isSet(object.from_key) ? String(object.from_key) : "", + to_key: isSet(object.to_key) ? String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? String(object.data_hash) : "", + proposed_at: isSet(object.proposed_at) ? String(object.proposed_at) : "0", + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? Number(object.compression_id) : 0, + }; + }, + + toJSON(message: EventBundleProposed): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.uploader !== undefined && (obj.uploader = message.uploader); + message.data_size !== undefined && (obj.data_size = message.data_size); + message.from_index !== undefined && (obj.from_index = message.from_index); + message.bundle_size !== undefined && (obj.bundle_size = message.bundle_size); + message.from_key !== undefined && (obj.from_key = message.from_key); + message.to_key !== undefined && (obj.to_key = message.to_key); + message.bundle_summary !== undefined && (obj.bundle_summary = message.bundle_summary); + message.data_hash !== undefined && (obj.data_hash = message.data_hash); + message.proposed_at !== undefined && (obj.proposed_at = message.proposed_at); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + message.compression_id !== undefined && (obj.compression_id = Math.round(message.compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): EventBundleProposed { + const message = createBaseEventBundleProposed(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + message.storage_id = object.storage_id ?? ""; + message.uploader = object.uploader ?? ""; + message.data_size = object.data_size ?? "0"; + message.from_index = object.from_index ?? "0"; + message.bundle_size = object.bundle_size ?? "0"; + message.from_key = object.from_key ?? ""; + message.to_key = object.to_key ?? ""; + message.bundle_summary = object.bundle_summary ?? ""; + message.data_hash = object.data_hash ?? ""; + message.proposed_at = object.proposed_at ?? "0"; + message.storage_provider_id = object.storage_provider_id ?? 0; + message.compression_id = object.compression_id ?? 0; + return message; + }, +}; + +function createBaseEventBundleFinalized(): EventBundleFinalized { + return { + pool_id: "0", + id: "0", + valid: "0", + invalid: "0", + abstain: "0", + total: "0", + status: BundleStatus.BUNDLE_STATUS_UNSPECIFIED, + reward_treasury: "0", + reward_uploader: "0", + reward_delegation: "0", + reward_total: "0", + finalized_at: "0", + uploader: "", + next_uploader: "", + }; +} + +export const EventBundleFinalized = { + encode(message: EventBundleFinalized, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.valid !== "0") { + writer.uint32(24).uint64(message.valid); + } + if (message.invalid !== "0") { + writer.uint32(32).uint64(message.invalid); + } + if (message.abstain !== "0") { + writer.uint32(40).uint64(message.abstain); + } + if (message.total !== "0") { + writer.uint32(48).uint64(message.total); + } + if (message.status !== BundleStatus.BUNDLE_STATUS_UNSPECIFIED) { + writer.uint32(56).int32(bundleStatusToNumber(message.status)); + } + if (message.reward_treasury !== "0") { + writer.uint32(64).uint64(message.reward_treasury); + } + if (message.reward_uploader !== "0") { + writer.uint32(72).uint64(message.reward_uploader); + } + if (message.reward_delegation !== "0") { + writer.uint32(80).uint64(message.reward_delegation); + } + if (message.reward_total !== "0") { + writer.uint32(88).uint64(message.reward_total); + } + if (message.finalized_at !== "0") { + writer.uint32(96).uint64(message.finalized_at); + } + if (message.uploader !== "") { + writer.uint32(106).string(message.uploader); + } + if (message.next_uploader !== "") { + writer.uint32(114).string(message.next_uploader); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleFinalized { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBundleFinalized(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.valid = longToString(reader.uint64() as Long); + break; + case 4: + message.invalid = longToString(reader.uint64() as Long); + break; + case 5: + message.abstain = longToString(reader.uint64() as Long); + break; + case 6: + message.total = longToString(reader.uint64() as Long); + break; + case 7: + message.status = bundleStatusFromJSON(reader.int32()); + break; + case 8: + message.reward_treasury = longToString(reader.uint64() as Long); + break; + case 9: + message.reward_uploader = longToString(reader.uint64() as Long); + break; + case 10: + message.reward_delegation = longToString(reader.uint64() as Long); + break; + case 11: + message.reward_total = longToString(reader.uint64() as Long); + break; + case 12: + message.finalized_at = longToString(reader.uint64() as Long); + break; + case 13: + message.uploader = reader.string(); + break; + case 14: + message.next_uploader = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventBundleFinalized { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + valid: isSet(object.valid) ? String(object.valid) : "0", + invalid: isSet(object.invalid) ? String(object.invalid) : "0", + abstain: isSet(object.abstain) ? String(object.abstain) : "0", + total: isSet(object.total) ? String(object.total) : "0", + status: isSet(object.status) ? bundleStatusFromJSON(object.status) : BundleStatus.BUNDLE_STATUS_UNSPECIFIED, + reward_treasury: isSet(object.reward_treasury) ? String(object.reward_treasury) : "0", + reward_uploader: isSet(object.reward_uploader) ? String(object.reward_uploader) : "0", + reward_delegation: isSet(object.reward_delegation) ? String(object.reward_delegation) : "0", + reward_total: isSet(object.reward_total) ? String(object.reward_total) : "0", + finalized_at: isSet(object.finalized_at) ? String(object.finalized_at) : "0", + uploader: isSet(object.uploader) ? String(object.uploader) : "", + next_uploader: isSet(object.next_uploader) ? String(object.next_uploader) : "", + }; + }, + + toJSON(message: EventBundleFinalized): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + message.valid !== undefined && (obj.valid = message.valid); + message.invalid !== undefined && (obj.invalid = message.invalid); + message.abstain !== undefined && (obj.abstain = message.abstain); + message.total !== undefined && (obj.total = message.total); + message.status !== undefined && (obj.status = bundleStatusToJSON(message.status)); + message.reward_treasury !== undefined && (obj.reward_treasury = message.reward_treasury); + message.reward_uploader !== undefined && (obj.reward_uploader = message.reward_uploader); + message.reward_delegation !== undefined && (obj.reward_delegation = message.reward_delegation); + message.reward_total !== undefined && (obj.reward_total = message.reward_total); + message.finalized_at !== undefined && (obj.finalized_at = message.finalized_at); + message.uploader !== undefined && (obj.uploader = message.uploader); + message.next_uploader !== undefined && (obj.next_uploader = message.next_uploader); + return obj; + }, + + fromPartial, I>>(object: I): EventBundleFinalized { + const message = createBaseEventBundleFinalized(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + message.valid = object.valid ?? "0"; + message.invalid = object.invalid ?? "0"; + message.abstain = object.abstain ?? "0"; + message.total = object.total ?? "0"; + message.status = object.status ?? BundleStatus.BUNDLE_STATUS_UNSPECIFIED; + message.reward_treasury = object.reward_treasury ?? "0"; + message.reward_uploader = object.reward_uploader ?? "0"; + message.reward_delegation = object.reward_delegation ?? "0"; + message.reward_total = object.reward_total ?? "0"; + message.finalized_at = object.finalized_at ?? "0"; + message.uploader = object.uploader ?? ""; + message.next_uploader = object.next_uploader ?? ""; + return message; + }, +}; + +function createBaseEventClaimedUploaderRole(): EventClaimedUploaderRole { + return { pool_id: "0", id: "0", new_uploader: "" }; +} + +export const EventClaimedUploaderRole = { + encode(message: EventClaimedUploaderRole, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.new_uploader !== "") { + writer.uint32(26).string(message.new_uploader); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimedUploaderRole { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventClaimedUploaderRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.new_uploader = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventClaimedUploaderRole { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + new_uploader: isSet(object.new_uploader) ? String(object.new_uploader) : "", + }; + }, + + toJSON(message: EventClaimedUploaderRole): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + message.new_uploader !== undefined && (obj.new_uploader = message.new_uploader); + return obj; + }, + + fromPartial, I>>(object: I): EventClaimedUploaderRole { + const message = createBaseEventClaimedUploaderRole(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + message.new_uploader = object.new_uploader ?? ""; + return message; + }, +}; + +function createBaseEventSkippedUploaderRole(): EventSkippedUploaderRole { + return { pool_id: "0", id: "0", previous_uploader: "", new_uploader: "" }; +} + +export const EventSkippedUploaderRole = { + encode(message: EventSkippedUploaderRole, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.previous_uploader !== "") { + writer.uint32(26).string(message.previous_uploader); + } + if (message.new_uploader !== "") { + writer.uint32(34).string(message.new_uploader); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventSkippedUploaderRole { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSkippedUploaderRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.previous_uploader = reader.string(); + break; + case 4: + message.new_uploader = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventSkippedUploaderRole { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + previous_uploader: isSet(object.previous_uploader) ? String(object.previous_uploader) : "", + new_uploader: isSet(object.new_uploader) ? String(object.new_uploader) : "", + }; + }, + + toJSON(message: EventSkippedUploaderRole): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + message.previous_uploader !== undefined && (obj.previous_uploader = message.previous_uploader); + message.new_uploader !== undefined && (obj.new_uploader = message.new_uploader); + return obj; + }, + + fromPartial, I>>(object: I): EventSkippedUploaderRole { + const message = createBaseEventSkippedUploaderRole(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + message.previous_uploader = object.previous_uploader ?? ""; + message.new_uploader = object.new_uploader ?? ""; + return message; + }, +}; + +function createBaseEventPointIncreased(): EventPointIncreased { + return { pool_id: "0", staker: "", current_points: "0" }; +} + +export const EventPointIncreased = { + encode(message: EventPointIncreased, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.current_points !== "0") { + writer.uint32(24).uint64(message.current_points); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventPointIncreased { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventPointIncreased(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.current_points = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventPointIncreased { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + current_points: isSet(object.current_points) ? String(object.current_points) : "0", + }; + }, + + toJSON(message: EventPointIncreased): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.current_points !== undefined && (obj.current_points = message.current_points); + return obj; + }, + + fromPartial, I>>(object: I): EventPointIncreased { + const message = createBaseEventPointIncreased(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.current_points = object.current_points ?? "0"; + return message; + }, +}; + +function createBaseEventPointsReset(): EventPointsReset { + return { pool_id: "0", staker: "" }; +} + +export const EventPointsReset = { + encode(message: EventPointsReset, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventPointsReset { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventPointsReset(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventPointsReset { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + }; + }, + + toJSON(message: EventPointsReset): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + return obj; + }, + + fromPartial, I>>(object: I): EventPointsReset { + const message = createBaseEventPointsReset(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/genesis.ts b/common/types/src/lcd/kyve/bundles/v1beta1/genesis.ts new file mode 100644 index 00000000..1257e971 --- /dev/null +++ b/common/types/src/lcd/kyve/bundles/v1beta1/genesis.ts @@ -0,0 +1,112 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { BundleProposal, FinalizedBundle } from "./bundles"; +import { Params } from "./params"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** GenesisState defines the bundles module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params?: Params; + /** bundle_proposal_list ... */ + bundle_proposal_list: BundleProposal[]; + /** finalized_bundle_list ... */ + finalized_bundle_list: FinalizedBundle[]; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, bundle_proposal_list: [], finalized_bundle_list: [] }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.bundle_proposal_list) { + BundleProposal.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.finalized_bundle_list) { + FinalizedBundle.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.bundle_proposal_list.push(BundleProposal.decode(reader, reader.uint32())); + break; + case 3: + message.finalized_bundle_list.push(FinalizedBundle.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + bundle_proposal_list: Array.isArray(object?.bundle_proposal_list) + ? object.bundle_proposal_list.map((e: any) => BundleProposal.fromJSON(e)) + : [], + finalized_bundle_list: Array.isArray(object?.finalized_bundle_list) + ? object.finalized_bundle_list.map((e: any) => FinalizedBundle.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.bundle_proposal_list) { + obj.bundle_proposal_list = message.bundle_proposal_list.map((e) => e ? BundleProposal.toJSON(e) : undefined); + } else { + obj.bundle_proposal_list = []; + } + if (message.finalized_bundle_list) { + obj.finalized_bundle_list = message.finalized_bundle_list.map((e) => e ? FinalizedBundle.toJSON(e) : undefined); + } else { + obj.finalized_bundle_list = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.bundle_proposal_list = object.bundle_proposal_list?.map((e) => BundleProposal.fromPartial(e)) || []; + message.finalized_bundle_list = object.finalized_bundle_list?.map((e) => FinalizedBundle.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/params.ts b/common/types/src/lcd/kyve/bundles/v1beta1/params.ts new file mode 100644 index 00000000..f45fa651 --- /dev/null +++ b/common/types/src/lcd/kyve/bundles/v1beta1/params.ts @@ -0,0 +1,117 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** Params defines the bundles module parameters. */ +export interface Params { + /** upload_timeout ... */ + upload_timeout: string; + /** storage_cost ... */ + storage_cost: string; + /** network_fee ... */ + network_fee: string; + /** max_points ... */ + max_points: string; +} + +function createBaseParams(): Params { + return { upload_timeout: "0", storage_cost: "0", network_fee: "", max_points: "0" }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.upload_timeout !== "0") { + writer.uint32(8).uint64(message.upload_timeout); + } + if (message.storage_cost !== "0") { + writer.uint32(16).uint64(message.storage_cost); + } + if (message.network_fee !== "") { + writer.uint32(26).string(message.network_fee); + } + if (message.max_points !== "0") { + writer.uint32(32).uint64(message.max_points); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.upload_timeout = longToString(reader.uint64() as Long); + break; + case 2: + message.storage_cost = longToString(reader.uint64() as Long); + break; + case 3: + message.network_fee = reader.string(); + break; + case 4: + message.max_points = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + upload_timeout: isSet(object.upload_timeout) ? String(object.upload_timeout) : "0", + storage_cost: isSet(object.storage_cost) ? String(object.storage_cost) : "0", + network_fee: isSet(object.network_fee) ? String(object.network_fee) : "", + max_points: isSet(object.max_points) ? String(object.max_points) : "0", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.upload_timeout !== undefined && (obj.upload_timeout = message.upload_timeout); + message.storage_cost !== undefined && (obj.storage_cost = message.storage_cost); + message.network_fee !== undefined && (obj.network_fee = message.network_fee); + message.max_points !== undefined && (obj.max_points = message.max_points); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.upload_timeout = object.upload_timeout ?? "0"; + message.storage_cost = object.storage_cost ?? "0"; + message.network_fee = object.network_fee ?? ""; + message.max_points = object.max_points ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/query.ts b/common/types/src/lcd/kyve/bundles/v1beta1/query.ts new file mode 100644 index 00000000..e66091c3 --- /dev/null +++ b/common/types/src/lcd/kyve/bundles/v1beta1/query.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./params"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.bundles.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/tx.ts b/common/types/src/lcd/kyve/bundles/v1beta1/tx.ts new file mode 100644 index 00000000..4587650e --- /dev/null +++ b/common/types/src/lcd/kyve/bundles/v1beta1/tx.ts @@ -0,0 +1,881 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.bundles.v1beta1"; + +/** VoteType ... */ +export enum VoteType { + /** VOTE_TYPE_UNSPECIFIED - VOTE_TYPE_UNSPECIFIED ... */ + VOTE_TYPE_UNSPECIFIED = "VOTE_TYPE_UNSPECIFIED", + /** VOTE_TYPE_VALID - VOTE_TYPE_VALID ... */ + VOTE_TYPE_VALID = "VOTE_TYPE_VALID", + /** VOTE_TYPE_INVALID - VOTE_TYPE_INVALID ... */ + VOTE_TYPE_INVALID = "VOTE_TYPE_INVALID", + /** VOTE_TYPE_ABSTAIN - VOTE_TYPE_ABSTAIN ... */ + VOTE_TYPE_ABSTAIN = "VOTE_TYPE_ABSTAIN", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function voteTypeFromJSON(object: any): VoteType { + switch (object) { + case 0: + case "VOTE_TYPE_UNSPECIFIED": + return VoteType.VOTE_TYPE_UNSPECIFIED; + case 1: + case "VOTE_TYPE_VALID": + return VoteType.VOTE_TYPE_VALID; + case 2: + case "VOTE_TYPE_INVALID": + return VoteType.VOTE_TYPE_INVALID; + case 3: + case "VOTE_TYPE_ABSTAIN": + return VoteType.VOTE_TYPE_ABSTAIN; + case -1: + case "UNRECOGNIZED": + default: + return VoteType.UNRECOGNIZED; + } +} + +export function voteTypeToJSON(object: VoteType): string { + switch (object) { + case VoteType.VOTE_TYPE_UNSPECIFIED: + return "VOTE_TYPE_UNSPECIFIED"; + case VoteType.VOTE_TYPE_VALID: + return "VOTE_TYPE_VALID"; + case VoteType.VOTE_TYPE_INVALID: + return "VOTE_TYPE_INVALID"; + case VoteType.VOTE_TYPE_ABSTAIN: + return "VOTE_TYPE_ABSTAIN"; + case VoteType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function voteTypeToNumber(object: VoteType): number { + switch (object) { + case VoteType.VOTE_TYPE_UNSPECIFIED: + return 0; + case VoteType.VOTE_TYPE_VALID: + return 1; + case VoteType.VOTE_TYPE_INVALID: + return 2; + case VoteType.VOTE_TYPE_ABSTAIN: + return 3; + case VoteType.UNRECOGNIZED: + default: + return -1; + } +} + +/** MsgSubmitBundleProposal defines a SDK message for submitting a bundle proposal. */ +export interface MsgSubmitBundleProposal { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** storage_id ... */ + storage_id: string; + /** data_size ... */ + data_size: string; + /** data_hash ... */ + data_hash: string; + /** from_index ... */ + from_index: string; + /** bundle_size ... */ + bundle_size: string; + /** from_key */ + from_key: string; + /** to_key ... */ + to_key: string; + /** bundle_summary ... */ + bundle_summary: string; +} + +/** MsgSubmitBundleProposalResponse defines the Msg/SubmitBundleProposal response type. */ +export interface MsgSubmitBundleProposalResponse { +} + +/** MsgVoteBundleProposal defines a SDK message for voting on a bundle proposal. */ +export interface MsgVoteBundleProposal { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** id ... */ + pool_id: string; + /** storage_id ... */ + storage_id: string; + /** vote ... */ + vote: VoteType; +} + +/** MsgVoteBundleProposalResponse defines the Msg/VoteBundleProposal response type. */ +export interface MsgVoteBundleProposalResponse { +} + +/** MsgClaimUploaderRole defines a SDK message for claiming the uploader role. */ +export interface MsgClaimUploaderRole { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** id ... */ + pool_id: string; +} + +/** MsgClaimUploaderRoleResponse defines the Msg/ClaimUploaderRole response type. */ +export interface MsgClaimUploaderRoleResponse { +} + +/** MsgSubmitBundleProposal defines a SDK message for submitting a bundle proposal. */ +export interface MsgSkipUploaderRole { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** from_index ... */ + from_index: string; +} + +/** MsgSubmitBundleProposalResponse defines the Msg/SubmitBundleProposal response type. */ +export interface MsgSkipUploaderRoleResponse { +} + +/** MsgUpdateParams defines a SDK message for updating the module parameters. */ +export interface MsgUpdateParams { + /** authority is the address of the governance account. */ + authority: string; + /** payload defines the x/bundles parameters to update. */ + payload: string; +} + +/** MsgUpdateParamsResponse defines the Msg/UpdateParams response type. */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgSubmitBundleProposal(): MsgSubmitBundleProposal { + return { + creator: "", + staker: "", + pool_id: "0", + storage_id: "", + data_size: "0", + data_hash: "", + from_index: "0", + bundle_size: "0", + from_key: "", + to_key: "", + bundle_summary: "", + }; +} + +export const MsgSubmitBundleProposal = { + encode(message: MsgSubmitBundleProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.storage_id !== "") { + writer.uint32(34).string(message.storage_id); + } + if (message.data_size !== "0") { + writer.uint32(40).uint64(message.data_size); + } + if (message.data_hash !== "") { + writer.uint32(50).string(message.data_hash); + } + if (message.from_index !== "0") { + writer.uint32(56).uint64(message.from_index); + } + if (message.bundle_size !== "0") { + writer.uint32(64).uint64(message.bundle_size); + } + if (message.from_key !== "") { + writer.uint32(74).string(message.from_key); + } + if (message.to_key !== "") { + writer.uint32(82).string(message.to_key); + } + if (message.bundle_summary !== "") { + writer.uint32(90).string(message.bundle_summary); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitBundleProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitBundleProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.storage_id = reader.string(); + break; + case 5: + message.data_size = longToString(reader.uint64() as Long); + break; + case 6: + message.data_hash = reader.string(); + break; + case 7: + message.from_index = longToString(reader.uint64() as Long); + break; + case 8: + message.bundle_size = longToString(reader.uint64() as Long); + break; + case 9: + message.from_key = reader.string(); + break; + case 10: + message.to_key = reader.string(); + break; + case 11: + message.bundle_summary = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSubmitBundleProposal { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + data_size: isSet(object.data_size) ? String(object.data_size) : "0", + data_hash: isSet(object.data_hash) ? String(object.data_hash) : "", + from_index: isSet(object.from_index) ? String(object.from_index) : "0", + bundle_size: isSet(object.bundle_size) ? String(object.bundle_size) : "0", + from_key: isSet(object.from_key) ? String(object.from_key) : "", + to_key: isSet(object.to_key) ? String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? String(object.bundle_summary) : "", + }; + }, + + toJSON(message: MsgSubmitBundleProposal): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.data_size !== undefined && (obj.data_size = message.data_size); + message.data_hash !== undefined && (obj.data_hash = message.data_hash); + message.from_index !== undefined && (obj.from_index = message.from_index); + message.bundle_size !== undefined && (obj.bundle_size = message.bundle_size); + message.from_key !== undefined && (obj.from_key = message.from_key); + message.to_key !== undefined && (obj.to_key = message.to_key); + message.bundle_summary !== undefined && (obj.bundle_summary = message.bundle_summary); + return obj; + }, + + fromPartial, I>>(object: I): MsgSubmitBundleProposal { + const message = createBaseMsgSubmitBundleProposal(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.storage_id = object.storage_id ?? ""; + message.data_size = object.data_size ?? "0"; + message.data_hash = object.data_hash ?? ""; + message.from_index = object.from_index ?? "0"; + message.bundle_size = object.bundle_size ?? "0"; + message.from_key = object.from_key ?? ""; + message.to_key = object.to_key ?? ""; + message.bundle_summary = object.bundle_summary ?? ""; + return message; + }, +}; + +function createBaseMsgSubmitBundleProposalResponse(): MsgSubmitBundleProposalResponse { + return {}; +} + +export const MsgSubmitBundleProposalResponse = { + encode(_: MsgSubmitBundleProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitBundleProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitBundleProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgSubmitBundleProposalResponse { + return {}; + }, + + toJSON(_: MsgSubmitBundleProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSubmitBundleProposalResponse { + const message = createBaseMsgSubmitBundleProposalResponse(); + return message; + }, +}; + +function createBaseMsgVoteBundleProposal(): MsgVoteBundleProposal { + return { creator: "", staker: "", pool_id: "0", storage_id: "", vote: VoteType.VOTE_TYPE_UNSPECIFIED }; +} + +export const MsgVoteBundleProposal = { + encode(message: MsgVoteBundleProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.storage_id !== "") { + writer.uint32(34).string(message.storage_id); + } + if (message.vote !== VoteType.VOTE_TYPE_UNSPECIFIED) { + writer.uint32(40).int32(voteTypeToNumber(message.vote)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteBundleProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteBundleProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.storage_id = reader.string(); + break; + case 5: + message.vote = voteTypeFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgVoteBundleProposal { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + vote: isSet(object.vote) ? voteTypeFromJSON(object.vote) : VoteType.VOTE_TYPE_UNSPECIFIED, + }; + }, + + toJSON(message: MsgVoteBundleProposal): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.vote !== undefined && (obj.vote = voteTypeToJSON(message.vote)); + return obj; + }, + + fromPartial, I>>(object: I): MsgVoteBundleProposal { + const message = createBaseMsgVoteBundleProposal(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.storage_id = object.storage_id ?? ""; + message.vote = object.vote ?? VoteType.VOTE_TYPE_UNSPECIFIED; + return message; + }, +}; + +function createBaseMsgVoteBundleProposalResponse(): MsgVoteBundleProposalResponse { + return {}; +} + +export const MsgVoteBundleProposalResponse = { + encode(_: MsgVoteBundleProposalResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteBundleProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteBundleProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgVoteBundleProposalResponse { + return {}; + }, + + toJSON(_: MsgVoteBundleProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgVoteBundleProposalResponse { + const message = createBaseMsgVoteBundleProposalResponse(); + return message; + }, +}; + +function createBaseMsgClaimUploaderRole(): MsgClaimUploaderRole { + return { creator: "", staker: "", pool_id: "0" }; +} + +export const MsgClaimUploaderRole = { + encode(message: MsgClaimUploaderRole, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUploaderRole { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClaimUploaderRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgClaimUploaderRole { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + }; + }, + + toJSON(message: MsgClaimUploaderRole): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgClaimUploaderRole { + const message = createBaseMsgClaimUploaderRole(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +function createBaseMsgClaimUploaderRoleResponse(): MsgClaimUploaderRoleResponse { + return {}; +} + +export const MsgClaimUploaderRoleResponse = { + encode(_: MsgClaimUploaderRoleResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUploaderRoleResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClaimUploaderRoleResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgClaimUploaderRoleResponse { + return {}; + }, + + toJSON(_: MsgClaimUploaderRoleResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgClaimUploaderRoleResponse { + const message = createBaseMsgClaimUploaderRoleResponse(); + return message; + }, +}; + +function createBaseMsgSkipUploaderRole(): MsgSkipUploaderRole { + return { creator: "", staker: "", pool_id: "0", from_index: "0" }; +} + +export const MsgSkipUploaderRole = { + encode(message: MsgSkipUploaderRole, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.from_index !== "0") { + writer.uint32(32).uint64(message.from_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSkipUploaderRole { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSkipUploaderRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.from_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgSkipUploaderRole { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + from_index: isSet(object.from_index) ? String(object.from_index) : "0", + }; + }, + + toJSON(message: MsgSkipUploaderRole): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.from_index !== undefined && (obj.from_index = message.from_index); + return obj; + }, + + fromPartial, I>>(object: I): MsgSkipUploaderRole { + const message = createBaseMsgSkipUploaderRole(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.from_index = object.from_index ?? "0"; + return message; + }, +}; + +function createBaseMsgSkipUploaderRoleResponse(): MsgSkipUploaderRoleResponse { + return {}; +} + +export const MsgSkipUploaderRoleResponse = { + encode(_: MsgSkipUploaderRoleResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSkipUploaderRoleResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSkipUploaderRoleResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgSkipUploaderRoleResponse { + return {}; + }, + + toJSON(_: MsgSkipUploaderRoleResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgSkipUploaderRoleResponse { + const message = createBaseMsgSkipUploaderRoleResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", payload: "" }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.payload !== "") { + writer.uint32(18).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** SubmitBundleProposal ... */ + SubmitBundleProposal(request: MsgSubmitBundleProposal): Promise; + /** VoteBundleProposal ... */ + VoteBundleProposal(request: MsgVoteBundleProposal): Promise; + /** ClaimUploaderRole ... */ + ClaimUploaderRole(request: MsgClaimUploaderRole): Promise; + /** SkipUploaderRole ... */ + SkipUploaderRole(request: MsgSkipUploaderRole): Promise; + /** + * UpdateParams defines a governance operation for updating the x/bundles module + * parameters. The authority is hard-coded to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.bundles.v1beta1.Msg"; + this.rpc = rpc; + this.SubmitBundleProposal = this.SubmitBundleProposal.bind(this); + this.VoteBundleProposal = this.VoteBundleProposal.bind(this); + this.ClaimUploaderRole = this.ClaimUploaderRole.bind(this); + this.SkipUploaderRole = this.SkipUploaderRole.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + } + SubmitBundleProposal(request: MsgSubmitBundleProposal): Promise { + const data = MsgSubmitBundleProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "SubmitBundleProposal", data); + return promise.then((data) => MsgSubmitBundleProposalResponse.decode(new _m0.Reader(data))); + } + + VoteBundleProposal(request: MsgVoteBundleProposal): Promise { + const data = MsgVoteBundleProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "VoteBundleProposal", data); + return promise.then((data) => MsgVoteBundleProposalResponse.decode(new _m0.Reader(data))); + } + + ClaimUploaderRole(request: MsgClaimUploaderRole): Promise { + const data = MsgClaimUploaderRole.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClaimUploaderRole", data); + return promise.then((data) => MsgClaimUploaderRoleResponse.decode(new _m0.Reader(data))); + } + + SkipUploaderRole(request: MsgSkipUploaderRole): Promise { + const data = MsgSkipUploaderRole.encode(request).finish(); + const promise = this.rpc.request(this.service, "SkipUploaderRole", data); + return promise.then((data) => MsgSkipUploaderRoleResponse.decode(new _m0.Reader(data))); + } + + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/delegation.ts b/common/types/src/lcd/kyve/delegation/v1beta1/delegation.ts new file mode 100644 index 00000000..d123c63b --- /dev/null +++ b/common/types/src/lcd/kyve/delegation/v1beta1/delegation.ts @@ -0,0 +1,704 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** SlashType ... */ +export enum SlashType { + /** SLASH_TYPE_UNSPECIFIED - SLASH_TYPE_UNSPECIFIED ... */ + SLASH_TYPE_UNSPECIFIED = "SLASH_TYPE_UNSPECIFIED", + /** SLASH_TYPE_TIMEOUT - SLASH_TYPE_TIMEOUT ... */ + SLASH_TYPE_TIMEOUT = "SLASH_TYPE_TIMEOUT", + /** SLASH_TYPE_VOTE - SLASH_TYPE_VOTE ... */ + SLASH_TYPE_VOTE = "SLASH_TYPE_VOTE", + /** SLASH_TYPE_UPLOAD - SLASH_TYPE_UPLOAD ... */ + SLASH_TYPE_UPLOAD = "SLASH_TYPE_UPLOAD", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function slashTypeFromJSON(object: any): SlashType { + switch (object) { + case 0: + case "SLASH_TYPE_UNSPECIFIED": + return SlashType.SLASH_TYPE_UNSPECIFIED; + case 1: + case "SLASH_TYPE_TIMEOUT": + return SlashType.SLASH_TYPE_TIMEOUT; + case 2: + case "SLASH_TYPE_VOTE": + return SlashType.SLASH_TYPE_VOTE; + case 3: + case "SLASH_TYPE_UPLOAD": + return SlashType.SLASH_TYPE_UPLOAD; + case -1: + case "UNRECOGNIZED": + default: + return SlashType.UNRECOGNIZED; + } +} + +export function slashTypeToJSON(object: SlashType): string { + switch (object) { + case SlashType.SLASH_TYPE_UNSPECIFIED: + return "SLASH_TYPE_UNSPECIFIED"; + case SlashType.SLASH_TYPE_TIMEOUT: + return "SLASH_TYPE_TIMEOUT"; + case SlashType.SLASH_TYPE_VOTE: + return "SLASH_TYPE_VOTE"; + case SlashType.SLASH_TYPE_UPLOAD: + return "SLASH_TYPE_UPLOAD"; + case SlashType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function slashTypeToNumber(object: SlashType): number { + switch (object) { + case SlashType.SLASH_TYPE_UNSPECIFIED: + return 0; + case SlashType.SLASH_TYPE_TIMEOUT: + return 1; + case SlashType.SLASH_TYPE_VOTE: + return 2; + case SlashType.SLASH_TYPE_UPLOAD: + return 3; + case SlashType.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * Delegator stores the information that one address has delegated to another address + * It stores important information for the F1-Fee distribution algorithm + */ +export interface Delegator { + /** staker corresponds to a KYVE-staker on the protocol-side */ + staker: string; + /** + * delegator the user who delegate to the staker. + * If staker and delegator are the same we call it: self-delegation + */ + delegator: string; + /** k_index is an internal index for the f1-distribution algorithm */ + k_index: string; + /** + * initial_amount of stake the user had when it delegated. + * slashes can cause that the actual stake is lower. + */ + initial_amount: string; +} + +/** + * DelegationEntry represents an entry according to the F1-Fee-Distribution algorithm. + * Take a look at x/delegation/keeper/logic_f1distribution.go for more details + */ +export interface DelegationEntry { + /** staker on protocol level */ + staker: string; + /** k_index is the of the period this entry ends */ + k_index: string; + /** value is the quotient of collected rewards and total stake according to F1-distribution */ + value: string; +} + +/** DelegationPoolData stores general delegation information for every staker */ +export interface DelegationData { + /** Every staker has one DelegationData */ + staker: string; + /** current_rewards ... */ + current_rewards: string; + /** total_delegation ... */ + total_delegation: string; + /** latest_index_k ... */ + latest_index_k: string; + /** delegator_count the amount of different addresses delegating to the staker */ + delegator_count: string; + /** latest_index_was_undelegation helps indicates when an entry can be deleted */ + latest_index_was_undelegation: boolean; +} + +/** + * DelegationSlash represents an f1-slash + * these entries needs to be iterated to obtain the current amount of the actual stake + * Every staker can have n slash-entries + */ +export interface DelegationSlash { + /** staker who got slashed */ + staker: string; + /** k_index for f1-algorithm */ + k_index: string; + /** fraction that got slashed */ + fraction: string; +} + +/** UndelegationQueueEntry ... */ +export interface UndelegationQueueEntry { + /** index ... */ + index: string; + /** staker ... */ + staker: string; + /** delegator ... */ + delegator: string; + /** amount ... */ + amount: string; + /** creation_time ... */ + creation_time: string; +} + +/** QueueState ... */ +export interface QueueState { + /** low_index ... */ + low_index: string; + /** high_index ... */ + high_index: string; +} + +/** RedelegationCooldown ... */ +export interface RedelegationCooldown { + /** low_index ... */ + address: string; + /** high_index ... */ + creation_date: string; +} + +function createBaseDelegator(): Delegator { + return { staker: "", delegator: "", k_index: "0", initial_amount: "0" }; +} + +export const Delegator = { + encode(message: Delegator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.delegator !== "") { + writer.uint32(18).string(message.delegator); + } + if (message.k_index !== "0") { + writer.uint32(24).uint64(message.k_index); + } + if (message.initial_amount !== "0") { + writer.uint32(32).uint64(message.initial_amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Delegator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.delegator = reader.string(); + break; + case 3: + message.k_index = longToString(reader.uint64() as Long); + break; + case 4: + message.initial_amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Delegator { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + delegator: isSet(object.delegator) ? String(object.delegator) : "", + k_index: isSet(object.k_index) ? String(object.k_index) : "0", + initial_amount: isSet(object.initial_amount) ? String(object.initial_amount) : "0", + }; + }, + + toJSON(message: Delegator): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.delegator !== undefined && (obj.delegator = message.delegator); + message.k_index !== undefined && (obj.k_index = message.k_index); + message.initial_amount !== undefined && (obj.initial_amount = message.initial_amount); + return obj; + }, + + fromPartial, I>>(object: I): Delegator { + const message = createBaseDelegator(); + message.staker = object.staker ?? ""; + message.delegator = object.delegator ?? ""; + message.k_index = object.k_index ?? "0"; + message.initial_amount = object.initial_amount ?? "0"; + return message; + }, +}; + +function createBaseDelegationEntry(): DelegationEntry { + return { staker: "", k_index: "0", value: "" }; +} + +export const DelegationEntry = { + encode(message: DelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.k_index !== "0") { + writer.uint32(16).uint64(message.k_index); + } + if (message.value !== "") { + writer.uint32(26).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.k_index = longToString(reader.uint64() as Long); + break; + case 3: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationEntry { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + k_index: isSet(object.k_index) ? String(object.k_index) : "0", + value: isSet(object.value) ? String(object.value) : "", + }; + }, + + toJSON(message: DelegationEntry): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.k_index !== undefined && (obj.k_index = message.k_index); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + fromPartial, I>>(object: I): DelegationEntry { + const message = createBaseDelegationEntry(); + message.staker = object.staker ?? ""; + message.k_index = object.k_index ?? "0"; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseDelegationData(): DelegationData { + return { + staker: "", + current_rewards: "0", + total_delegation: "0", + latest_index_k: "0", + delegator_count: "0", + latest_index_was_undelegation: false, + }; +} + +export const DelegationData = { + encode(message: DelegationData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.current_rewards !== "0") { + writer.uint32(16).uint64(message.current_rewards); + } + if (message.total_delegation !== "0") { + writer.uint32(24).uint64(message.total_delegation); + } + if (message.latest_index_k !== "0") { + writer.uint32(32).uint64(message.latest_index_k); + } + if (message.delegator_count !== "0") { + writer.uint32(40).uint64(message.delegator_count); + } + if (message.latest_index_was_undelegation === true) { + writer.uint32(48).bool(message.latest_index_was_undelegation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.current_rewards = longToString(reader.uint64() as Long); + break; + case 3: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 4: + message.latest_index_k = longToString(reader.uint64() as Long); + break; + case 5: + message.delegator_count = longToString(reader.uint64() as Long); + break; + case 6: + message.latest_index_was_undelegation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationData { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + current_rewards: isSet(object.current_rewards) ? String(object.current_rewards) : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + latest_index_k: isSet(object.latest_index_k) ? String(object.latest_index_k) : "0", + delegator_count: isSet(object.delegator_count) ? String(object.delegator_count) : "0", + latest_index_was_undelegation: isSet(object.latest_index_was_undelegation) + ? Boolean(object.latest_index_was_undelegation) + : false, + }; + }, + + toJSON(message: DelegationData): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.current_rewards !== undefined && (obj.current_rewards = message.current_rewards); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.latest_index_k !== undefined && (obj.latest_index_k = message.latest_index_k); + message.delegator_count !== undefined && (obj.delegator_count = message.delegator_count); + message.latest_index_was_undelegation !== undefined && + (obj.latest_index_was_undelegation = message.latest_index_was_undelegation); + return obj; + }, + + fromPartial, I>>(object: I): DelegationData { + const message = createBaseDelegationData(); + message.staker = object.staker ?? ""; + message.current_rewards = object.current_rewards ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.latest_index_k = object.latest_index_k ?? "0"; + message.delegator_count = object.delegator_count ?? "0"; + message.latest_index_was_undelegation = object.latest_index_was_undelegation ?? false; + return message; + }, +}; + +function createBaseDelegationSlash(): DelegationSlash { + return { staker: "", k_index: "0", fraction: "" }; +} + +export const DelegationSlash = { + encode(message: DelegationSlash, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.k_index !== "0") { + writer.uint32(16).uint64(message.k_index); + } + if (message.fraction !== "") { + writer.uint32(26).string(message.fraction); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationSlash { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationSlash(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.k_index = longToString(reader.uint64() as Long); + break; + case 3: + message.fraction = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationSlash { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + k_index: isSet(object.k_index) ? String(object.k_index) : "0", + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: DelegationSlash): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.k_index !== undefined && (obj.k_index = message.k_index); + message.fraction !== undefined && (obj.fraction = message.fraction); + return obj; + }, + + fromPartial, I>>(object: I): DelegationSlash { + const message = createBaseDelegationSlash(); + message.staker = object.staker ?? ""; + message.k_index = object.k_index ?? "0"; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +function createBaseUndelegationQueueEntry(): UndelegationQueueEntry { + return { index: "0", staker: "", delegator: "", amount: "0", creation_time: "0" }; +} + +export const UndelegationQueueEntry = { + encode(message: UndelegationQueueEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.delegator !== "") { + writer.uint32(26).string(message.delegator); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + if (message.creation_time !== "0") { + writer.uint32(40).uint64(message.creation_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UndelegationQueueEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUndelegationQueueEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.delegator = reader.string(); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + case 5: + message.creation_time = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UndelegationQueueEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + delegator: isSet(object.delegator) ? String(object.delegator) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? String(object.creation_time) : "0", + }; + }, + + toJSON(message: UndelegationQueueEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.delegator !== undefined && (obj.delegator = message.delegator); + message.amount !== undefined && (obj.amount = message.amount); + message.creation_time !== undefined && (obj.creation_time = message.creation_time); + return obj; + }, + + fromPartial, I>>(object: I): UndelegationQueueEntry { + const message = createBaseUndelegationQueueEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.delegator = object.delegator ?? ""; + message.amount = object.amount ?? "0"; + message.creation_time = object.creation_time ?? "0"; + return message; + }, +}; + +function createBaseQueueState(): QueueState { + return { low_index: "0", high_index: "0" }; +} + +export const QueueState = { + encode(message: QueueState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.low_index !== "0") { + writer.uint32(8).uint64(message.low_index); + } + if (message.high_index !== "0") { + writer.uint32(16).uint64(message.high_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueueState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.low_index = longToString(reader.uint64() as Long); + break; + case 2: + message.high_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueueState { + return { + low_index: isSet(object.low_index) ? String(object.low_index) : "0", + high_index: isSet(object.high_index) ? String(object.high_index) : "0", + }; + }, + + toJSON(message: QueueState): unknown { + const obj: any = {}; + message.low_index !== undefined && (obj.low_index = message.low_index); + message.high_index !== undefined && (obj.high_index = message.high_index); + return obj; + }, + + fromPartial, I>>(object: I): QueueState { + const message = createBaseQueueState(); + message.low_index = object.low_index ?? "0"; + message.high_index = object.high_index ?? "0"; + return message; + }, +}; + +function createBaseRedelegationCooldown(): RedelegationCooldown { + return { address: "", creation_date: "0" }; +} + +export const RedelegationCooldown = { + encode(message: RedelegationCooldown, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.creation_date !== "0") { + writer.uint32(16).uint64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationCooldown { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationCooldown(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.creation_date = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RedelegationCooldown { + return { + address: isSet(object.address) ? String(object.address) : "", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: RedelegationCooldown): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): RedelegationCooldown { + const message = createBaseRedelegationCooldown(); + message.address = object.address ?? ""; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/events.ts b/common/types/src/lcd/kyve/delegation/v1beta1/events.ts new file mode 100644 index 00000000..96669313 --- /dev/null +++ b/common/types/src/lcd/kyve/delegation/v1beta1/events.ts @@ -0,0 +1,452 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { SlashType, slashTypeFromJSON, slashTypeToJSON, slashTypeToNumber } from "./delegation"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** + * EventDelegate is an event emitted when someone delegates to a protocol node. + * emitted_by: MsgDelegate + */ +export interface EventDelegate { + /** address is the account address of the delegator. */ + address: string; + /** staker is the account address of the protocol node. */ + staker: string; + /** amount ... */ + amount: string; +} + +/** + * EventUndelegate is an event emitted when someone undelegates from a protocol node. + * emitted_by: EndBlock + */ +export interface EventUndelegate { + /** address is the account address of the delegator. */ + address: string; + /** staker is the account address of the protocol node. */ + staker: string; + /** amount ... */ + amount: string; +} + +/** + * EventRedelegate is an event emitted when someone redelegates from one protocol node to another. + * emitted_by: MsgRedelegate + */ +export interface EventRedelegate { + /** address is the account address of the delegator. */ + address: string; + /** from_staker ... */ + from_staker: string; + /** to_staker is the account address of the new staker in the the pool */ + to_staker: string; + /** amount ... */ + amount: string; +} + +/** + * EventWithdrawRewards ... + * emitted_by: MsgRedelegate, MsgDelegate, MsgWithdrawRewards, EndBlock + */ +export interface EventWithdrawRewards { + /** address is the account address of the delegator. */ + address: string; + /** staker is the account address of the protocol node the users withdraws from. */ + staker: string; + /** amount ... */ + amount: string; +} + +/** + * EventSlash is an event emitted when a protocol node is slashed. + * emitted_by: MsgSubmitBundleProposal, EndBlock + */ +export interface EventSlash { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** staker is the account address of the protocol node. */ + staker: string; + /** amount ... */ + amount: string; + /** slash_type */ + slash_type: SlashType; +} + +function createBaseEventDelegate(): EventDelegate { + return { address: "", staker: "", amount: "0" }; +} + +export const EventDelegate = { + encode(message: EventDelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventDelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventDelegate { + return { + address: isSet(object.address) ? String(object.address) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventDelegate): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventDelegate { + const message = createBaseEventDelegate(); + message.address = object.address ?? ""; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventUndelegate(): EventUndelegate { + return { address: "", staker: "", amount: "0" }; +} + +export const EventUndelegate = { + encode(message: EventUndelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUndelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventUndelegate { + return { + address: isSet(object.address) ? String(object.address) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventUndelegate): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventUndelegate { + const message = createBaseEventUndelegate(); + message.address = object.address ?? ""; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventRedelegate(): EventRedelegate { + return { address: "", from_staker: "", to_staker: "", amount: "0" }; +} + +export const EventRedelegate = { + encode(message: EventRedelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.from_staker !== "") { + writer.uint32(18).string(message.from_staker); + } + if (message.to_staker !== "") { + writer.uint32(26).string(message.to_staker); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventRedelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.from_staker = reader.string(); + break; + case 3: + message.to_staker = reader.string(); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventRedelegate { + return { + address: isSet(object.address) ? String(object.address) : "", + from_staker: isSet(object.from_staker) ? String(object.from_staker) : "", + to_staker: isSet(object.to_staker) ? String(object.to_staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventRedelegate): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.from_staker !== undefined && (obj.from_staker = message.from_staker); + message.to_staker !== undefined && (obj.to_staker = message.to_staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventRedelegate { + const message = createBaseEventRedelegate(); + message.address = object.address ?? ""; + message.from_staker = object.from_staker ?? ""; + message.to_staker = object.to_staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventWithdrawRewards(): EventWithdrawRewards { + return { address: "", staker: "", amount: "0" }; +} + +export const EventWithdrawRewards = { + encode(message: EventWithdrawRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventWithdrawRewards { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventWithdrawRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventWithdrawRewards { + return { + address: isSet(object.address) ? String(object.address) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventWithdrawRewards): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventWithdrawRewards { + const message = createBaseEventWithdrawRewards(); + message.address = object.address ?? ""; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventSlash(): EventSlash { + return { pool_id: "0", staker: "", amount: "0", slash_type: SlashType.SLASH_TYPE_UNSPECIFIED }; +} + +export const EventSlash = { + encode(message: EventSlash, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + if (message.slash_type !== SlashType.SLASH_TYPE_UNSPECIFIED) { + writer.uint32(32).int32(slashTypeToNumber(message.slash_type)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventSlash { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSlash(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + case 4: + message.slash_type = slashTypeFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventSlash { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + slash_type: isSet(object.slash_type) ? slashTypeFromJSON(object.slash_type) : SlashType.SLASH_TYPE_UNSPECIFIED, + }; + }, + + toJSON(message: EventSlash): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + message.slash_type !== undefined && (obj.slash_type = slashTypeToJSON(message.slash_type)); + return obj; + }, + + fromPartial, I>>(object: I): EventSlash { + const message = createBaseEventSlash(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + message.slash_type = object.slash_type ?? SlashType.SLASH_TYPE_UNSPECIFIED; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/genesis.ts b/common/types/src/lcd/kyve/delegation/v1beta1/genesis.ts new file mode 100644 index 00000000..a94db103 --- /dev/null +++ b/common/types/src/lcd/kyve/delegation/v1beta1/genesis.ts @@ -0,0 +1,221 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { + DelegationData, + DelegationEntry, + DelegationSlash, + Delegator, + QueueState, + RedelegationCooldown, + UndelegationQueueEntry, +} from "./delegation"; +import { Params } from "./params"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** GenesisState defines the delegation module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params?: Params; + /** delegator_list ... */ + delegator_list: Delegator[]; + /** delegation_entry_list ... */ + delegation_entry_list: DelegationEntry[]; + /** delegation_data_list ... */ + delegation_data_list: DelegationData[]; + /** delegation_slash_list ... */ + delegation_slash_list: DelegationSlash[]; + /** undelegation_queue_entry_list ... */ + undelegation_queue_entry_list: UndelegationQueueEntry[]; + /** queue_state_undelegation ... */ + queue_state_undelegation?: QueueState; + /** redelegation_cooldown_list ... */ + redelegation_cooldown_list: RedelegationCooldown[]; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + delegator_list: [], + delegation_entry_list: [], + delegation_data_list: [], + delegation_slash_list: [], + undelegation_queue_entry_list: [], + queue_state_undelegation: undefined, + redelegation_cooldown_list: [], + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.delegator_list) { + Delegator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegation_entry_list) { + DelegationEntry.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.delegation_data_list) { + DelegationData.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.delegation_slash_list) { + DelegationSlash.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.undelegation_queue_entry_list) { + UndelegationQueueEntry.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.queue_state_undelegation !== undefined) { + QueueState.encode(message.queue_state_undelegation, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.redelegation_cooldown_list) { + RedelegationCooldown.encode(v!, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.delegator_list.push(Delegator.decode(reader, reader.uint32())); + break; + case 3: + message.delegation_entry_list.push(DelegationEntry.decode(reader, reader.uint32())); + break; + case 4: + message.delegation_data_list.push(DelegationData.decode(reader, reader.uint32())); + break; + case 5: + message.delegation_slash_list.push(DelegationSlash.decode(reader, reader.uint32())); + break; + case 6: + message.undelegation_queue_entry_list.push(UndelegationQueueEntry.decode(reader, reader.uint32())); + break; + case 7: + message.queue_state_undelegation = QueueState.decode(reader, reader.uint32()); + break; + case 8: + message.redelegation_cooldown_list.push(RedelegationCooldown.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + delegator_list: Array.isArray(object?.delegator_list) + ? object.delegator_list.map((e: any) => Delegator.fromJSON(e)) + : [], + delegation_entry_list: Array.isArray(object?.delegation_entry_list) + ? object.delegation_entry_list.map((e: any) => DelegationEntry.fromJSON(e)) + : [], + delegation_data_list: Array.isArray(object?.delegation_data_list) + ? object.delegation_data_list.map((e: any) => DelegationData.fromJSON(e)) + : [], + delegation_slash_list: Array.isArray(object?.delegation_slash_list) + ? object.delegation_slash_list.map((e: any) => DelegationSlash.fromJSON(e)) + : [], + undelegation_queue_entry_list: Array.isArray(object?.undelegation_queue_entry_list) + ? object.undelegation_queue_entry_list.map((e: any) => UndelegationQueueEntry.fromJSON(e)) + : [], + queue_state_undelegation: isSet(object.queue_state_undelegation) + ? QueueState.fromJSON(object.queue_state_undelegation) + : undefined, + redelegation_cooldown_list: Array.isArray(object?.redelegation_cooldown_list) + ? object.redelegation_cooldown_list.map((e: any) => RedelegationCooldown.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.delegator_list) { + obj.delegator_list = message.delegator_list.map((e) => e ? Delegator.toJSON(e) : undefined); + } else { + obj.delegator_list = []; + } + if (message.delegation_entry_list) { + obj.delegation_entry_list = message.delegation_entry_list.map((e) => e ? DelegationEntry.toJSON(e) : undefined); + } else { + obj.delegation_entry_list = []; + } + if (message.delegation_data_list) { + obj.delegation_data_list = message.delegation_data_list.map((e) => e ? DelegationData.toJSON(e) : undefined); + } else { + obj.delegation_data_list = []; + } + if (message.delegation_slash_list) { + obj.delegation_slash_list = message.delegation_slash_list.map((e) => e ? DelegationSlash.toJSON(e) : undefined); + } else { + obj.delegation_slash_list = []; + } + if (message.undelegation_queue_entry_list) { + obj.undelegation_queue_entry_list = message.undelegation_queue_entry_list.map((e) => + e ? UndelegationQueueEntry.toJSON(e) : undefined + ); + } else { + obj.undelegation_queue_entry_list = []; + } + message.queue_state_undelegation !== undefined && (obj.queue_state_undelegation = message.queue_state_undelegation + ? QueueState.toJSON(message.queue_state_undelegation) + : undefined); + if (message.redelegation_cooldown_list) { + obj.redelegation_cooldown_list = message.redelegation_cooldown_list.map((e) => + e ? RedelegationCooldown.toJSON(e) : undefined + ); + } else { + obj.redelegation_cooldown_list = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.delegator_list = object.delegator_list?.map((e) => Delegator.fromPartial(e)) || []; + message.delegation_entry_list = object.delegation_entry_list?.map((e) => DelegationEntry.fromPartial(e)) || []; + message.delegation_data_list = object.delegation_data_list?.map((e) => DelegationData.fromPartial(e)) || []; + message.delegation_slash_list = object.delegation_slash_list?.map((e) => DelegationSlash.fromPartial(e)) || []; + message.undelegation_queue_entry_list = + object.undelegation_queue_entry_list?.map((e) => UndelegationQueueEntry.fromPartial(e)) || []; + message.queue_state_undelegation = + (object.queue_state_undelegation !== undefined && object.queue_state_undelegation !== null) + ? QueueState.fromPartial(object.queue_state_undelegation) + : undefined; + message.redelegation_cooldown_list = + object.redelegation_cooldown_list?.map((e) => RedelegationCooldown.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/params.ts b/common/types/src/lcd/kyve/delegation/v1beta1/params.ts new file mode 100644 index 00000000..5e5d02f5 --- /dev/null +++ b/common/types/src/lcd/kyve/delegation/v1beta1/params.ts @@ -0,0 +1,149 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** Params defines the delegation module parameters. */ +export interface Params { + /** unbonding_delegation_time ... */ + unbonding_delegation_time: string; + /** unbonding_delegation_time ... */ + redelegation_cooldown: string; + /** unbonding_delegation_time ... */ + redelegation_max_amount: string; + /** vote_slash ... */ + vote_slash: string; + /** upload_slash ... */ + upload_slash: string; + /** timeout_slash ... */ + timeout_slash: string; +} + +function createBaseParams(): Params { + return { + unbonding_delegation_time: "0", + redelegation_cooldown: "0", + redelegation_max_amount: "0", + vote_slash: "", + upload_slash: "", + timeout_slash: "", + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.unbonding_delegation_time !== "0") { + writer.uint32(8).uint64(message.unbonding_delegation_time); + } + if (message.redelegation_cooldown !== "0") { + writer.uint32(16).uint64(message.redelegation_cooldown); + } + if (message.redelegation_max_amount !== "0") { + writer.uint32(24).uint64(message.redelegation_max_amount); + } + if (message.vote_slash !== "") { + writer.uint32(34).string(message.vote_slash); + } + if (message.upload_slash !== "") { + writer.uint32(42).string(message.upload_slash); + } + if (message.timeout_slash !== "") { + writer.uint32(50).string(message.timeout_slash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.unbonding_delegation_time = longToString(reader.uint64() as Long); + break; + case 2: + message.redelegation_cooldown = longToString(reader.uint64() as Long); + break; + case 3: + message.redelegation_max_amount = longToString(reader.uint64() as Long); + break; + case 4: + message.vote_slash = reader.string(); + break; + case 5: + message.upload_slash = reader.string(); + break; + case 6: + message.timeout_slash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + unbonding_delegation_time: isSet(object.unbonding_delegation_time) + ? String(object.unbonding_delegation_time) + : "0", + redelegation_cooldown: isSet(object.redelegation_cooldown) ? String(object.redelegation_cooldown) : "0", + redelegation_max_amount: isSet(object.redelegation_max_amount) ? String(object.redelegation_max_amount) : "0", + vote_slash: isSet(object.vote_slash) ? String(object.vote_slash) : "", + upload_slash: isSet(object.upload_slash) ? String(object.upload_slash) : "", + timeout_slash: isSet(object.timeout_slash) ? String(object.timeout_slash) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.unbonding_delegation_time !== undefined && + (obj.unbonding_delegation_time = message.unbonding_delegation_time); + message.redelegation_cooldown !== undefined && (obj.redelegation_cooldown = message.redelegation_cooldown); + message.redelegation_max_amount !== undefined && (obj.redelegation_max_amount = message.redelegation_max_amount); + message.vote_slash !== undefined && (obj.vote_slash = message.vote_slash); + message.upload_slash !== undefined && (obj.upload_slash = message.upload_slash); + message.timeout_slash !== undefined && (obj.timeout_slash = message.timeout_slash); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.unbonding_delegation_time = object.unbonding_delegation_time ?? "0"; + message.redelegation_cooldown = object.redelegation_cooldown ?? "0"; + message.redelegation_max_amount = object.redelegation_max_amount ?? "0"; + message.vote_slash = object.vote_slash ?? ""; + message.upload_slash = object.upload_slash ?? ""; + message.timeout_slash = object.timeout_slash ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/query.ts b/common/types/src/lcd/kyve/delegation/v1beta1/query.ts new file mode 100644 index 00000000..b1b5f625 --- /dev/null +++ b/common/types/src/lcd/kyve/delegation/v1beta1/query.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./params"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.delegation.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/tx.ts b/common/types/src/lcd/kyve/delegation/v1beta1/tx.ts new file mode 100644 index 00000000..257ba0c5 --- /dev/null +++ b/common/types/src/lcd/kyve/delegation/v1beta1/tx.ts @@ -0,0 +1,685 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.delegation.v1beta1"; + +/** MsgDelegate ... */ +export interface MsgDelegate { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** amount ... */ + amount: string; +} + +/** MsgDelegatePoolResponse defines the Msg/DelegatePool response type. */ +export interface MsgDelegateResponse { +} + +/** MsgWithdrawPool defines a SDK message for withdrawing delegation rewards from a specific pool. */ +export interface MsgWithdrawRewards { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; +} + +/** MsgWithdrawPoolResponse defines the Msg/WithdrawPool response type. */ +export interface MsgWithdrawRewardsResponse { +} + +/** MsgUndelegatePool defines a SDK message for undelegating from a specific pool. */ +export interface MsgUndelegate { + /** creator ... */ + creator: string; + /** staker ... */ + staker: string; + /** amount ... */ + amount: string; +} + +/** MsgUndelegatePoolResponse defines the Msg/UndelegatePool response type. */ +export interface MsgUndelegateResponse { +} + +/** + * MsgRedelegatePool defines a SDK message for redelegating from a + * staker in a pool to another staker in the same or another pool + */ +export interface MsgRedelegate { + /** creator ... */ + creator: string; + /** staker ... */ + from_staker: string; + /** staker ... */ + to_staker: string; + /** amount ... */ + amount: string; +} + +/** MsgUndelegatePoolResponse defines the Msg/UndelegatePool response type. */ +export interface MsgRedelegateResponse { +} + +/** MsgUpdateParams defines a SDK message for updating the module parameters. */ +export interface MsgUpdateParams { + /** authority is the address of the governance account. */ + authority: string; + /** payload defines the x/delegation parameters to update. */ + payload: string; +} + +/** MsgUpdateParamsResponse defines the Msg/UpdateParams response type. */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgDelegate(): MsgDelegate { + return { creator: "", staker: "", amount: "0" }; +} + +export const MsgDelegate = { + encode(message: MsgDelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDelegate { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgDelegate { + const message = createBaseMsgDelegate(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} + +export const MsgDelegateResponse = { + encode(_: MsgDelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgDelegateResponse { + return {}; + }, + + toJSON(_: MsgDelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; + +function createBaseMsgWithdrawRewards(): MsgWithdrawRewards { + return { creator: "", staker: "" }; +} + +export const MsgWithdrawRewards = { + encode(message: MsgWithdrawRewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawRewards { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgWithdrawRewards { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + }; + }, + + toJSON(message: MsgWithdrawRewards): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + return obj; + }, + + fromPartial, I>>(object: I): MsgWithdrawRewards { + const message = createBaseMsgWithdrawRewards(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + return message; + }, +}; + +function createBaseMsgWithdrawRewardsResponse(): MsgWithdrawRewardsResponse { + return {}; +} + +export const MsgWithdrawRewardsResponse = { + encode(_: MsgWithdrawRewardsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawRewardsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgWithdrawRewardsResponse { + return {}; + }, + + toJSON(_: MsgWithdrawRewardsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgWithdrawRewardsResponse { + const message = createBaseMsgWithdrawRewardsResponse(); + return message; + }, +}; + +function createBaseMsgUndelegate(): MsgUndelegate { + return { creator: "", staker: "", amount: "0" }; +} + +export const MsgUndelegate = { + encode(message: MsgUndelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.creator = reader.string(); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUndelegate { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.creator = object.creator ?? ""; + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return {}; +} + +export const MsgUndelegateResponse = { + encode(_: MsgUndelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUndelegateResponse { + return {}; + }, + + toJSON(_: MsgUndelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + return message; + }, +}; + +function createBaseMsgRedelegate(): MsgRedelegate { + return { creator: "", from_staker: "", to_staker: "", amount: "0" }; +} + +export const MsgRedelegate = { + encode(message: MsgRedelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.from_staker !== "") { + writer.uint32(18).string(message.from_staker); + } + if (message.to_staker !== "") { + writer.uint32(26).string(message.to_staker); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRedelegate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.from_staker = reader.string(); + break; + case 3: + message.to_staker = reader.string(); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgRedelegate { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + from_staker: isSet(object.from_staker) ? String(object.from_staker) : "", + to_staker: isSet(object.to_staker) ? String(object.to_staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgRedelegate): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.from_staker !== undefined && (obj.from_staker = message.from_staker); + message.to_staker !== undefined && (obj.to_staker = message.to_staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgRedelegate { + const message = createBaseMsgRedelegate(); + message.creator = object.creator ?? ""; + message.from_staker = object.from_staker ?? ""; + message.to_staker = object.to_staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgRedelegateResponse(): MsgRedelegateResponse { + return {}; +} + +export const MsgRedelegateResponse = { + encode(_: MsgRedelegateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRedelegateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgRedelegateResponse { + return {}; + }, + + toJSON(_: MsgRedelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgRedelegateResponse { + const message = createBaseMsgRedelegateResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", payload: "" }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.payload !== "") { + writer.uint32(18).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** Delegate ... */ + Delegate(request: MsgDelegate): Promise; + /** Withdraw ... */ + WithdrawRewards(request: MsgWithdrawRewards): Promise; + /** Undelegate ... */ + Undelegate(request: MsgUndelegate): Promise; + /** Redelegate ... */ + Redelegate(request: MsgRedelegate): Promise; + /** + * UpdateParams defines a governance operation for updating the x/delegation module + * parameters. The authority is hard-coded to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.delegation.v1beta1.Msg"; + this.rpc = rpc; + this.Delegate = this.Delegate.bind(this); + this.WithdrawRewards = this.WithdrawRewards.bind(this); + this.Undelegate = this.Undelegate.bind(this); + this.Redelegate = this.Redelegate.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + } + Delegate(request: MsgDelegate): Promise { + const data = MsgDelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "Delegate", data); + return promise.then((data) => MsgDelegateResponse.decode(new _m0.Reader(data))); + } + + WithdrawRewards(request: MsgWithdrawRewards): Promise { + const data = MsgWithdrawRewards.encode(request).finish(); + const promise = this.rpc.request(this.service, "WithdrawRewards", data); + return promise.then((data) => MsgWithdrawRewardsResponse.decode(new _m0.Reader(data))); + } + + Undelegate(request: MsgUndelegate): Promise { + const data = MsgUndelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "Undelegate", data); + return promise.then((data) => MsgUndelegateResponse.decode(new _m0.Reader(data))); + } + + Redelegate(request: MsgRedelegate): Promise { + const data = MsgRedelegate.encode(request).finish(); + const promise = this.rpc.request(this.service, "Redelegate", data); + return promise.then((data) => MsgRedelegateResponse.decode(new _m0.Reader(data))); + } + + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/fees/v1beta1/fees.ts b/common/types/src/lcd/kyve/fees/v1beta1/fees.ts new file mode 100644 index 00000000..bae73d97 --- /dev/null +++ b/common/types/src/lcd/kyve/fees/v1beta1/fees.ts @@ -0,0 +1,273 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.fees.v1beta1"; + +/** Params defines the fees module parameters. */ +export interface Params { + /** min_gas_price defines the minimum gas price value for all transactions. */ + min_gas_price: string; + /** burn_ratio defines the ratio of transaction fees burnt. */ + burn_ratio: string; + /** gas_adjustments ... */ + gas_adjustments: GasAdjustment[]; + /** gas_refunds ... */ + gas_refunds: GasRefund[]; + /** min_initial_deposit_ratio ... */ + min_initial_deposit_ratio: string; +} + +/** GasAdjustment ... */ +export interface GasAdjustment { + /** type ... */ + type: string; + /** amount ... */ + amount: string; +} + +/** GasRefund ... */ +export interface GasRefund { + /** type ... */ + type: string; + /** fraction ... */ + fraction: string; +} + +function createBaseParams(): Params { + return { min_gas_price: "", burn_ratio: "", gas_adjustments: [], gas_refunds: [], min_initial_deposit_ratio: "" }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.min_gas_price !== "") { + writer.uint32(10).string(message.min_gas_price); + } + if (message.burn_ratio !== "") { + writer.uint32(18).string(message.burn_ratio); + } + for (const v of message.gas_adjustments) { + GasAdjustment.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.gas_refunds) { + GasRefund.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.min_initial_deposit_ratio !== "") { + writer.uint32(42).string(message.min_initial_deposit_ratio); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.min_gas_price = reader.string(); + break; + case 2: + message.burn_ratio = reader.string(); + break; + case 3: + message.gas_adjustments.push(GasAdjustment.decode(reader, reader.uint32())); + break; + case 4: + message.gas_refunds.push(GasRefund.decode(reader, reader.uint32())); + break; + case 5: + message.min_initial_deposit_ratio = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + min_gas_price: isSet(object.min_gas_price) ? String(object.min_gas_price) : "", + burn_ratio: isSet(object.burn_ratio) ? String(object.burn_ratio) : "", + gas_adjustments: Array.isArray(object?.gas_adjustments) + ? object.gas_adjustments.map((e: any) => GasAdjustment.fromJSON(e)) + : [], + gas_refunds: Array.isArray(object?.gas_refunds) ? object.gas_refunds.map((e: any) => GasRefund.fromJSON(e)) : [], + min_initial_deposit_ratio: isSet(object.min_initial_deposit_ratio) + ? String(object.min_initial_deposit_ratio) + : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.min_gas_price !== undefined && (obj.min_gas_price = message.min_gas_price); + message.burn_ratio !== undefined && (obj.burn_ratio = message.burn_ratio); + if (message.gas_adjustments) { + obj.gas_adjustments = message.gas_adjustments.map((e) => e ? GasAdjustment.toJSON(e) : undefined); + } else { + obj.gas_adjustments = []; + } + if (message.gas_refunds) { + obj.gas_refunds = message.gas_refunds.map((e) => e ? GasRefund.toJSON(e) : undefined); + } else { + obj.gas_refunds = []; + } + message.min_initial_deposit_ratio !== undefined && + (obj.min_initial_deposit_ratio = message.min_initial_deposit_ratio); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.min_gas_price = object.min_gas_price ?? ""; + message.burn_ratio = object.burn_ratio ?? ""; + message.gas_adjustments = object.gas_adjustments?.map((e) => GasAdjustment.fromPartial(e)) || []; + message.gas_refunds = object.gas_refunds?.map((e) => GasRefund.fromPartial(e)) || []; + message.min_initial_deposit_ratio = object.min_initial_deposit_ratio ?? ""; + return message; + }, +}; + +function createBaseGasAdjustment(): GasAdjustment { + return { type: "", amount: "0" }; +} + +export const GasAdjustment = { + encode(message: GasAdjustment, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.amount !== "0") { + writer.uint32(16).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GasAdjustment { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasAdjustment(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GasAdjustment { + return { + type: isSet(object.type) ? String(object.type) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: GasAdjustment): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): GasAdjustment { + const message = createBaseGasAdjustment(); + message.type = object.type ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseGasRefund(): GasRefund { + return { type: "", fraction: "" }; +} + +export const GasRefund = { + encode(message: GasRefund, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GasRefund { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasRefund(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.fraction = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GasRefund { + return { + type: isSet(object.type) ? String(object.type) : "", + fraction: isSet(object.fraction) ? String(object.fraction) : "", + }; + }, + + toJSON(message: GasRefund): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + message.fraction !== undefined && (obj.fraction = message.fraction); + return obj; + }, + + fromPartial, I>>(object: I): GasRefund { + const message = createBaseGasRefund(); + message.type = object.type ?? ""; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/fees/v1beta1/genesis.ts b/common/types/src/lcd/kyve/fees/v1beta1/genesis.ts new file mode 100644 index 00000000..2f88a030 --- /dev/null +++ b/common/types/src/lcd/kyve/fees/v1beta1/genesis.ts @@ -0,0 +1,75 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./fees"; + +export const protobufPackage = "kyve.fees.v1beta1"; + +/** GenesisState defines the fees module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params?: Params; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + 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; + }, + + fromJSON(object: any): GenesisState { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/fees/v1beta1/query.ts b/common/types/src/lcd/kyve/fees/v1beta1/query.ts new file mode 100644 index 00000000..323d2704 --- /dev/null +++ b/common/types/src/lcd/kyve/fees/v1beta1/query.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./fees"; + +export const protobufPackage = "kyve.fees.v1beta1"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.fees.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/fees/v1beta1/tx.ts b/common/types/src/lcd/kyve/fees/v1beta1/tx.ts new file mode 100644 index 00000000..13875dce --- /dev/null +++ b/common/types/src/lcd/kyve/fees/v1beta1/tx.ts @@ -0,0 +1,156 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.fees.v1beta1"; + +/** MsgUpdateParams defines a SDK message for updating the module parameters. */ +export interface MsgUpdateParams { + /** authority is the address of the governance account. */ + authority: string; + /** payload defines the x/fees parameters to update. */ + payload: string; +} + +/** MsgUpdateParamsResponse defines the Msg/UpdateParams response type. */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", payload: "" }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.payload !== "") { + writer.uint32(18).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/fees module + * parameters. The authority is hard-coded to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.fees.v1beta1.Msg"; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + } + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/pool/v1beta1/events.ts b/common/types/src/lcd/kyve/pool/v1beta1/events.ts new file mode 100644 index 00000000..faa36114 --- /dev/null +++ b/common/types/src/lcd/kyve/pool/v1beta1/events.ts @@ -0,0 +1,541 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.pool.v1beta1"; + +/** + * EventCreatePool ... + * emitted_by: EndBlock(gov) + */ +export interface EventCreatePool { + /** id ... */ + id: string; + /** name ... */ + name: string; + /** runtime ... */ + runtime: string; + /** logo ... */ + logo: string; + /** config ... */ + config: string; + /** start_key ... */ + start_key: string; + /** upload_interval ... */ + upload_interval: string; + /** operating_cost ... */ + operating_cost: string; + /** min_delegation ... */ + min_delegation: string; + /** max_bundle_size ... */ + max_bundle_size: string; + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** storage_provider_id ... */ + storage_provider_id: number; + /** compression_id ... */ + compression_id: number; +} + +/** + * EventFundPool is an event emitted when a pool is funded. + * emitted_by: MsgFundPool + */ +export interface EventFundPool { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** address is the account address of the pool funder. */ + address: string; + /** amount ... */ + amount: string; +} + +/** + * EventDefundPool is an event emitted when a pool is defunded. + * emitted_by: MsgDefundPool + */ +export interface EventDefundPool { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** address is the account address of the pool funder. */ + address: string; + /** amount ... */ + amount: string; +} + +/** + * EventDefundPool is an event emitted when a pool is defunded. + * emitted_by: MsgSubmitBundleProposal + */ +export interface EventPoolFundsSlashed { + /** pool_id is the unique ID of the pool. */ + pool_id: string; + /** address is the account address of the pool funder. */ + address: string; + /** amount ... */ + amount: string; +} + +/** + * EventPoolOutOfFunds is an event emitted when a pool has run out of funds + * emitted_by: MsgSubmitBundleProposal + */ +export interface EventPoolOutOfFunds { + /** pool_id is the unique ID of the pool. */ + pool_id: string; +} + +function createBaseEventCreatePool(): EventCreatePool { + return { + id: "0", + name: "", + runtime: "", + logo: "", + config: "", + start_key: "", + upload_interval: "0", + operating_cost: "0", + min_delegation: "0", + max_bundle_size: "0", + version: "", + binaries: "", + storage_provider_id: 0, + compression_id: 0, + }; +} + +export const EventCreatePool = { + encode(message: EventCreatePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + if (message.config !== "") { + writer.uint32(42).string(message.config); + } + if (message.start_key !== "") { + writer.uint32(50).string(message.start_key); + } + if (message.upload_interval !== "0") { + writer.uint32(56).uint64(message.upload_interval); + } + if (message.operating_cost !== "0") { + writer.uint32(64).uint64(message.operating_cost); + } + if (message.min_delegation !== "0") { + writer.uint32(72).uint64(message.min_delegation); + } + if (message.max_bundle_size !== "0") { + writer.uint32(80).uint64(message.max_bundle_size); + } + if (message.version !== "") { + writer.uint32(90).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(98).string(message.binaries); + } + if (message.storage_provider_id !== 0) { + writer.uint32(104).uint32(message.storage_provider_id); + } + if (message.compression_id !== 0) { + writer.uint32(112).uint32(message.compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventCreatePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreatePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.runtime = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + case 5: + message.config = reader.string(); + break; + case 6: + message.start_key = reader.string(); + break; + case 7: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 8: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 9: + message.min_delegation = longToString(reader.uint64() as Long); + break; + case 10: + message.max_bundle_size = longToString(reader.uint64() as Long); + break; + case 11: + message.version = reader.string(); + break; + case 12: + message.binaries = reader.string(); + break; + case 13: + message.storage_provider_id = reader.uint32(); + break; + case 14: + message.compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventCreatePool { + return { + id: isSet(object.id) ? String(object.id) : "0", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + config: isSet(object.config) ? String(object.config) : "", + start_key: isSet(object.start_key) ? String(object.start_key) : "", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? String(object.max_bundle_size) : "0", + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? Number(object.compression_id) : 0, + }; + }, + + toJSON(message: EventCreatePool): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.config !== undefined && (obj.config = message.config); + message.start_key !== undefined && (obj.start_key = message.start_key); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.min_delegation !== undefined && (obj.min_delegation = message.min_delegation); + message.max_bundle_size !== undefined && (obj.max_bundle_size = message.max_bundle_size); + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + message.compression_id !== undefined && (obj.compression_id = Math.round(message.compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): EventCreatePool { + const message = createBaseEventCreatePool(); + message.id = object.id ?? "0"; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.config = object.config ?? ""; + message.start_key = object.start_key ?? ""; + message.upload_interval = object.upload_interval ?? "0"; + message.operating_cost = object.operating_cost ?? "0"; + message.min_delegation = object.min_delegation ?? "0"; + message.max_bundle_size = object.max_bundle_size ?? "0"; + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.storage_provider_id = object.storage_provider_id ?? 0; + message.compression_id = object.compression_id ?? 0; + return message; + }, +}; + +function createBaseEventFundPool(): EventFundPool { + return { pool_id: "0", address: "", amount: "0" }; +} + +export const EventFundPool = { + encode(message: EventFundPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventFundPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventFundPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventFundPool { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + address: isSet(object.address) ? String(object.address) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventFundPool): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.address !== undefined && (obj.address = message.address); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventFundPool { + const message = createBaseEventFundPool(); + message.pool_id = object.pool_id ?? "0"; + message.address = object.address ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventDefundPool(): EventDefundPool { + return { pool_id: "0", address: "", amount: "0" }; +} + +export const EventDefundPool = { + encode(message: EventDefundPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventDefundPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDefundPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventDefundPool { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + address: isSet(object.address) ? String(object.address) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventDefundPool): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.address !== undefined && (obj.address = message.address); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventDefundPool { + const message = createBaseEventDefundPool(); + message.pool_id = object.pool_id ?? "0"; + message.address = object.address ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventPoolFundsSlashed(): EventPoolFundsSlashed { + return { pool_id: "0", address: "", amount: "0" }; +} + +export const EventPoolFundsSlashed = { + encode(message: EventPoolFundsSlashed, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolFundsSlashed { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventPoolFundsSlashed(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.address = reader.string(); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventPoolFundsSlashed { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + address: isSet(object.address) ? String(object.address) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventPoolFundsSlashed): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.address !== undefined && (obj.address = message.address); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventPoolFundsSlashed { + const message = createBaseEventPoolFundsSlashed(); + message.pool_id = object.pool_id ?? "0"; + message.address = object.address ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventPoolOutOfFunds(): EventPoolOutOfFunds { + return { pool_id: "0" }; +} + +export const EventPoolOutOfFunds = { + encode(message: EventPoolOutOfFunds, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolOutOfFunds { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventPoolOutOfFunds(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventPoolOutOfFunds { + return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + }, + + toJSON(message: EventPoolOutOfFunds): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>(object: I): EventPoolOutOfFunds { + const message = createBaseEventPoolOutOfFunds(); + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/pool/v1beta1/genesis.ts b/common/types/src/lcd/kyve/pool/v1beta1/genesis.ts new file mode 100644 index 00000000..86bfc818 --- /dev/null +++ b/common/types/src/lcd/kyve/pool/v1beta1/genesis.ts @@ -0,0 +1,100 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Pool } from "./pool"; + +export const protobufPackage = "kyve.pool.v1beta1"; + +/** GenesisState defines the pool module's genesis state. */ +export interface GenesisState { + /** pool_list ... */ + pool_list: Pool[]; + /** pool_count ... */ + pool_count: string; +} + +function createBaseGenesisState(): GenesisState { + return { pool_list: [], pool_count: "0" }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pool_list) { + Pool.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pool_count !== "0") { + writer.uint32(24).uint64(message.pool_count); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.pool_list.push(Pool.decode(reader, reader.uint32())); + break; + case 3: + message.pool_count = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + pool_list: Array.isArray(object?.pool_list) ? object.pool_list.map((e: any) => Pool.fromJSON(e)) : [], + pool_count: isSet(object.pool_count) ? String(object.pool_count) : "0", + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.pool_list) { + obj.pool_list = message.pool_list.map((e) => e ? Pool.toJSON(e) : undefined); + } else { + obj.pool_list = []; + } + message.pool_count !== undefined && (obj.pool_count = message.pool_count); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.pool_list = object.pool_list?.map((e) => Pool.fromPartial(e)) || []; + message.pool_count = object.pool_count ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/pool/v1beta1/pool.ts b/common/types/src/lcd/kyve/pool/v1beta1/pool.ts new file mode 100644 index 00000000..0a2a70f5 --- /dev/null +++ b/common/types/src/lcd/kyve/pool/v1beta1/pool.ts @@ -0,0 +1,654 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.pool.v1beta1"; + +/** PoolStatus ... */ +export enum PoolStatus { + /** POOL_STATUS_UNSPECIFIED - POOL_STATUS_UNSPECIFIED ... */ + POOL_STATUS_UNSPECIFIED = "POOL_STATUS_UNSPECIFIED", + /** POOL_STATUS_ACTIVE - POOL_STATUS_ACTIVE ... */ + POOL_STATUS_ACTIVE = "POOL_STATUS_ACTIVE", + /** POOL_STATUS_PAUSED - POOL_STATUS_PAUSED ... */ + POOL_STATUS_PAUSED = "POOL_STATUS_PAUSED", + /** POOL_STATUS_NO_FUNDS - POOL_STATUS_NO_FUNDS ... */ + POOL_STATUS_NO_FUNDS = "POOL_STATUS_NO_FUNDS", + /** POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_NOT_ENOUGH_DELEGATION ... */ + POOL_STATUS_NOT_ENOUGH_DELEGATION = "POOL_STATUS_NOT_ENOUGH_DELEGATION", + /** POOL_STATUS_UPGRADING - POOL_STATUS_UPGRADING ... */ + POOL_STATUS_UPGRADING = "POOL_STATUS_UPGRADING", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function poolStatusFromJSON(object: any): PoolStatus { + switch (object) { + case 0: + case "POOL_STATUS_UNSPECIFIED": + return PoolStatus.POOL_STATUS_UNSPECIFIED; + case 1: + case "POOL_STATUS_ACTIVE": + return PoolStatus.POOL_STATUS_ACTIVE; + case 2: + case "POOL_STATUS_PAUSED": + return PoolStatus.POOL_STATUS_PAUSED; + case 3: + case "POOL_STATUS_NO_FUNDS": + return PoolStatus.POOL_STATUS_NO_FUNDS; + case 4: + case "POOL_STATUS_NOT_ENOUGH_DELEGATION": + return PoolStatus.POOL_STATUS_NOT_ENOUGH_DELEGATION; + case 5: + case "POOL_STATUS_UPGRADING": + return PoolStatus.POOL_STATUS_UPGRADING; + case -1: + case "UNRECOGNIZED": + default: + return PoolStatus.UNRECOGNIZED; + } +} + +export function poolStatusToJSON(object: PoolStatus): string { + switch (object) { + case PoolStatus.POOL_STATUS_UNSPECIFIED: + return "POOL_STATUS_UNSPECIFIED"; + case PoolStatus.POOL_STATUS_ACTIVE: + return "POOL_STATUS_ACTIVE"; + case PoolStatus.POOL_STATUS_PAUSED: + return "POOL_STATUS_PAUSED"; + case PoolStatus.POOL_STATUS_NO_FUNDS: + return "POOL_STATUS_NO_FUNDS"; + case PoolStatus.POOL_STATUS_NOT_ENOUGH_DELEGATION: + return "POOL_STATUS_NOT_ENOUGH_DELEGATION"; + case PoolStatus.POOL_STATUS_UPGRADING: + return "POOL_STATUS_UPGRADING"; + case PoolStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function poolStatusToNumber(object: PoolStatus): number { + switch (object) { + case PoolStatus.POOL_STATUS_UNSPECIFIED: + return 0; + case PoolStatus.POOL_STATUS_ACTIVE: + return 1; + case PoolStatus.POOL_STATUS_PAUSED: + return 2; + case PoolStatus.POOL_STATUS_NO_FUNDS: + return 3; + case PoolStatus.POOL_STATUS_NOT_ENOUGH_DELEGATION: + return 4; + case PoolStatus.POOL_STATUS_UPGRADING: + return 5; + case PoolStatus.UNRECOGNIZED: + default: + return -1; + } +} + +/** Protocol ... */ +export interface Protocol { + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** last_upgrade ... */ + last_upgrade: string; +} + +/** Upgrade ... */ +export interface UpgradePlan { + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** scheduled_at ... */ + scheduled_at: string; + /** duration ... */ + duration: string; +} + +/** Funder ... */ +export interface Funder { + /** address ... */ + address: string; + /** amount ... */ + amount: string; +} + +/** Pool ... */ +export interface Pool { + /** id ... */ + id: string; + /** name ... */ + name: string; + /** runtime ... */ + runtime: string; + /** logo ... */ + logo: string; + /** config ... */ + config: string; + /** start_key ... */ + start_key: string; + /** current_key ... */ + current_key: string; + /** current_summary ... */ + current_summary: string; + /** current_index ... */ + current_index: string; + /** total_bundles ... */ + total_bundles: string; + /** upload_interval ... */ + upload_interval: string; + /** operating_cost ... */ + operating_cost: string; + /** min_delegation ... */ + min_delegation: string; + /** max_bundle_size ... */ + max_bundle_size: string; + /** paused ... */ + paused: boolean; + /** funders ... */ + funders: Funder[]; + /** total_funds ... */ + total_funds: string; + /** protocol ... */ + protocol?: Protocol; + /** upgrade_plan ... */ + upgrade_plan?: UpgradePlan; + /** storage_provider_id ... */ + current_storage_provider_id: number; + /** compression_id ... */ + current_compression_id: number; +} + +function createBaseProtocol(): Protocol { + return { version: "", binaries: "", last_upgrade: "0" }; +} + +export const Protocol = { + encode(message: Protocol, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(18).string(message.binaries); + } + if (message.last_upgrade !== "0") { + writer.uint32(24).uint64(message.last_upgrade); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Protocol { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProtocol(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.binaries = reader.string(); + break; + case 3: + message.last_upgrade = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Protocol { + return { + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + last_upgrade: isSet(object.last_upgrade) ? String(object.last_upgrade) : "0", + }; + }, + + toJSON(message: Protocol): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.last_upgrade !== undefined && (obj.last_upgrade = message.last_upgrade); + return obj; + }, + + fromPartial, I>>(object: I): Protocol { + const message = createBaseProtocol(); + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.last_upgrade = object.last_upgrade ?? "0"; + return message; + }, +}; + +function createBaseUpgradePlan(): UpgradePlan { + return { version: "", binaries: "", scheduled_at: "0", duration: "0" }; +} + +export const UpgradePlan = { + encode(message: UpgradePlan, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(18).string(message.binaries); + } + if (message.scheduled_at !== "0") { + writer.uint32(24).uint64(message.scheduled_at); + } + if (message.duration !== "0") { + writer.uint32(32).uint64(message.duration); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpgradePlan { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpgradePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.binaries = reader.string(); + break; + case 3: + message.scheduled_at = longToString(reader.uint64() as Long); + break; + case 4: + message.duration = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UpgradePlan { + return { + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + scheduled_at: isSet(object.scheduled_at) ? String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? String(object.duration) : "0", + }; + }, + + toJSON(message: UpgradePlan): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.scheduled_at !== undefined && (obj.scheduled_at = message.scheduled_at); + message.duration !== undefined && (obj.duration = message.duration); + return obj; + }, + + fromPartial, I>>(object: I): UpgradePlan { + const message = createBaseUpgradePlan(); + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.scheduled_at = object.scheduled_at ?? "0"; + message.duration = object.duration ?? "0"; + return message; + }, +}; + +function createBaseFunder(): Funder { + return { address: "", amount: "0" }; +} + +export const Funder = { + encode(message: Funder, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.amount !== "0") { + writer.uint32(16).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Funder { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Funder { + return { + address: isSet(object.address) ? String(object.address) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: Funder): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): Funder { + const message = createBaseFunder(); + message.address = object.address ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBasePool(): Pool { + return { + id: "0", + name: "", + runtime: "", + logo: "", + config: "", + start_key: "", + current_key: "", + current_summary: "", + current_index: "0", + total_bundles: "0", + upload_interval: "0", + operating_cost: "0", + min_delegation: "0", + max_bundle_size: "0", + paused: false, + funders: [], + total_funds: "0", + protocol: undefined, + upgrade_plan: undefined, + current_storage_provider_id: 0, + current_compression_id: 0, + }; +} + +export const Pool = { + encode(message: Pool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + if (message.config !== "") { + writer.uint32(42).string(message.config); + } + if (message.start_key !== "") { + writer.uint32(50).string(message.start_key); + } + if (message.current_key !== "") { + writer.uint32(58).string(message.current_key); + } + if (message.current_summary !== "") { + writer.uint32(66).string(message.current_summary); + } + if (message.current_index !== "0") { + writer.uint32(72).uint64(message.current_index); + } + if (message.total_bundles !== "0") { + writer.uint32(80).uint64(message.total_bundles); + } + if (message.upload_interval !== "0") { + writer.uint32(88).uint64(message.upload_interval); + } + if (message.operating_cost !== "0") { + writer.uint32(96).uint64(message.operating_cost); + } + if (message.min_delegation !== "0") { + writer.uint32(104).uint64(message.min_delegation); + } + if (message.max_bundle_size !== "0") { + writer.uint32(112).uint64(message.max_bundle_size); + } + if (message.paused === true) { + writer.uint32(120).bool(message.paused); + } + for (const v of message.funders) { + Funder.encode(v!, writer.uint32(130).fork()).ldelim(); + } + if (message.total_funds !== "0") { + writer.uint32(136).uint64(message.total_funds); + } + if (message.protocol !== undefined) { + Protocol.encode(message.protocol, writer.uint32(146).fork()).ldelim(); + } + if (message.upgrade_plan !== undefined) { + UpgradePlan.encode(message.upgrade_plan, writer.uint32(154).fork()).ldelim(); + } + if (message.current_storage_provider_id !== 0) { + writer.uint32(160).uint32(message.current_storage_provider_id); + } + if (message.current_compression_id !== 0) { + writer.uint32(168).uint32(message.current_compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Pool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.id = longToString(reader.uint64() as Long); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.runtime = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + case 5: + message.config = reader.string(); + break; + case 6: + message.start_key = reader.string(); + break; + case 7: + message.current_key = reader.string(); + break; + case 8: + message.current_summary = reader.string(); + break; + case 9: + message.current_index = longToString(reader.uint64() as Long); + break; + case 10: + message.total_bundles = longToString(reader.uint64() as Long); + break; + case 11: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 12: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 13: + message.min_delegation = longToString(reader.uint64() as Long); + break; + case 14: + message.max_bundle_size = longToString(reader.uint64() as Long); + break; + case 15: + message.paused = reader.bool(); + break; + case 16: + message.funders.push(Funder.decode(reader, reader.uint32())); + break; + case 17: + message.total_funds = longToString(reader.uint64() as Long); + break; + case 18: + message.protocol = Protocol.decode(reader, reader.uint32()); + break; + case 19: + message.upgrade_plan = UpgradePlan.decode(reader, reader.uint32()); + break; + case 20: + message.current_storage_provider_id = reader.uint32(); + break; + case 21: + message.current_compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Pool { + return { + id: isSet(object.id) ? String(object.id) : "0", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + config: isSet(object.config) ? String(object.config) : "", + start_key: isSet(object.start_key) ? String(object.start_key) : "", + current_key: isSet(object.current_key) ? String(object.current_key) : "", + current_summary: isSet(object.current_summary) ? String(object.current_summary) : "", + current_index: isSet(object.current_index) ? String(object.current_index) : "0", + total_bundles: isSet(object.total_bundles) ? String(object.total_bundles) : "0", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? String(object.max_bundle_size) : "0", + paused: isSet(object.paused) ? Boolean(object.paused) : false, + funders: Array.isArray(object?.funders) ? object.funders.map((e: any) => Funder.fromJSON(e)) : [], + total_funds: isSet(object.total_funds) ? String(object.total_funds) : "0", + protocol: isSet(object.protocol) ? Protocol.fromJSON(object.protocol) : undefined, + upgrade_plan: isSet(object.upgrade_plan) ? UpgradePlan.fromJSON(object.upgrade_plan) : undefined, + current_storage_provider_id: isSet(object.current_storage_provider_id) + ? Number(object.current_storage_provider_id) + : 0, + current_compression_id: isSet(object.current_compression_id) ? Number(object.current_compression_id) : 0, + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.config !== undefined && (obj.config = message.config); + message.start_key !== undefined && (obj.start_key = message.start_key); + message.current_key !== undefined && (obj.current_key = message.current_key); + message.current_summary !== undefined && (obj.current_summary = message.current_summary); + message.current_index !== undefined && (obj.current_index = message.current_index); + message.total_bundles !== undefined && (obj.total_bundles = message.total_bundles); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.min_delegation !== undefined && (obj.min_delegation = message.min_delegation); + message.max_bundle_size !== undefined && (obj.max_bundle_size = message.max_bundle_size); + message.paused !== undefined && (obj.paused = message.paused); + if (message.funders) { + obj.funders = message.funders.map((e) => e ? Funder.toJSON(e) : undefined); + } else { + obj.funders = []; + } + message.total_funds !== undefined && (obj.total_funds = message.total_funds); + message.protocol !== undefined && (obj.protocol = message.protocol ? Protocol.toJSON(message.protocol) : undefined); + message.upgrade_plan !== undefined && + (obj.upgrade_plan = message.upgrade_plan ? UpgradePlan.toJSON(message.upgrade_plan) : undefined); + message.current_storage_provider_id !== undefined && + (obj.current_storage_provider_id = Math.round(message.current_storage_provider_id)); + message.current_compression_id !== undefined && + (obj.current_compression_id = Math.round(message.current_compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.id = object.id ?? "0"; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.config = object.config ?? ""; + message.start_key = object.start_key ?? ""; + message.current_key = object.current_key ?? ""; + message.current_summary = object.current_summary ?? ""; + message.current_index = object.current_index ?? "0"; + message.total_bundles = object.total_bundles ?? "0"; + message.upload_interval = object.upload_interval ?? "0"; + message.operating_cost = object.operating_cost ?? "0"; + message.min_delegation = object.min_delegation ?? "0"; + message.max_bundle_size = object.max_bundle_size ?? "0"; + message.paused = object.paused ?? false; + message.funders = object.funders?.map((e) => Funder.fromPartial(e)) || []; + message.total_funds = object.total_funds ?? "0"; + message.protocol = (object.protocol !== undefined && object.protocol !== null) + ? Protocol.fromPartial(object.protocol) + : undefined; + message.upgrade_plan = (object.upgrade_plan !== undefined && object.upgrade_plan !== null) + ? UpgradePlan.fromPartial(object.upgrade_plan) + : undefined; + message.current_storage_provider_id = object.current_storage_provider_id ?? 0; + message.current_compression_id = object.current_compression_id ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/pool/v1beta1/tx.ts b/common/types/src/lcd/kyve/pool/v1beta1/tx.ts new file mode 100644 index 00000000..885fad21 --- /dev/null +++ b/common/types/src/lcd/kyve/pool/v1beta1/tx.ts @@ -0,0 +1,1233 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.pool.v1beta1"; + +/** MsgFundPool defines a SDK message for funding a pool. */ +export interface MsgFundPool { + /** creator ... */ + creator: string; + /** id ... */ + id: string; + /** amount ... */ + amount: string; +} + +/** MsgFundPoolResponse defines the Msg/DefundPool response type. */ +export interface MsgFundPoolResponse { +} + +/** MsgDefundPool defines a SDK message for defunding a pool. */ +export interface MsgDefundPool { + /** creator ... */ + creator: string; + /** id ... */ + id: string; + /** amount ... */ + amount: string; +} + +/** MsgDefundPoolResponse defines the Msg/DefundPool response type. */ +export interface MsgDefundPoolResponse { +} + +/** MsgCreatePool defines a SDK message for creating a new pool. */ +export interface MsgCreatePool { + /** authority is the address of the governance account. */ + authority: string; + /** name ... */ + name: string; + /** runtime ... */ + runtime: string; + /** logo ... */ + logo: string; + /** config ... */ + config: string; + /** start_key ... */ + start_key: string; + /** upload_interval ... */ + upload_interval: string; + /** operating_cost ... */ + operating_cost: string; + /** min_delegation ... */ + min_delegation: string; + /** max_bundle_size ... */ + max_bundle_size: string; + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** storage_provider_id ... */ + storage_provider_id: number; + /** compression_id ... */ + compression_id: number; +} + +/** MsgCreatePoolResponse defines the Msg/CreatePool response type. */ +export interface MsgCreatePoolResponse { +} + +/** MsgUpdatePool defines a SDK message for updating an existing pool. */ +export interface MsgUpdatePool { + /** authority is the address of the governance account. */ + authority: string; + /** id ... */ + id: string; + /** payload ... */ + payload: string; +} + +/** MsgUpdatePoolResponse defines the Msg/UpdatePool response type. */ +export interface MsgUpdatePoolResponse { +} + +/** MsgPausePool defines a SDK message for pausing an existing pool. */ +export interface MsgPausePool { + /** authority is the address of the governance account. */ + authority: string; + /** id ... */ + id: string; +} + +/** MsgPausePoolResponse defines the Msg/PausePool response type. */ +export interface MsgPausePoolResponse { +} + +/** MsgUnpausePool defines a SDK message for unpausing an existing pool. */ +export interface MsgUnpausePool { + /** authority is the address of the governance account. */ + authority: string; + /** id ... */ + id: string; +} + +/** MsgUnpausePoolResponse defines the Msg/UnpausePool response type. */ +export interface MsgUnpausePoolResponse { +} + +/** MsgScheduleRuntimeUpgrade defines a SDK message for scheduling a runtime upgrade. */ +export interface MsgScheduleRuntimeUpgrade { + /** authority is the address of the governance account. */ + authority: string; + /** runtime ... */ + runtime: string; + /** version ... */ + version: string; + /** scheduled_at ... */ + scheduled_at: string; + /** duration ... */ + duration: string; + /** binaries ... */ + binaries: string; +} + +/** MsgScheduleRuntimeUpgradeResponse defines the Msg/ScheduleRuntimeUpgrade response type. */ +export interface MsgScheduleRuntimeUpgradeResponse { +} + +/** MsgCancelRuntimeUpgrade defines a SDK message for cancelling a runtime upgrade. */ +export interface MsgCancelRuntimeUpgrade { + /** authority is the address of the governance account. */ + authority: string; + /** runtime ... */ + runtime: string; +} + +/** MsgCancelRuntimeUpgradeResponse defines the Msg/CancelRuntimeUpgrade response type. */ +export interface MsgCancelRuntimeUpgradeResponse { +} + +function createBaseMsgFundPool(): MsgFundPool { + return { creator: "", id: "0", amount: "0" }; +} + +export const MsgFundPool = { + encode(message: MsgFundPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgFundPool { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + id: isSet(object.id) ? String(object.id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgFundPool): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.id !== undefined && (obj.id = message.id); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgFundPool { + const message = createBaseMsgFundPool(); + message.creator = object.creator ?? ""; + message.id = object.id ?? "0"; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgFundPoolResponse(): MsgFundPoolResponse { + return {}; +} + +export const MsgFundPoolResponse = { + encode(_: MsgFundPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgFundPoolResponse { + return {}; + }, + + toJSON(_: MsgFundPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgFundPoolResponse { + const message = createBaseMsgFundPoolResponse(); + return message; + }, +}; + +function createBaseMsgDefundPool(): MsgDefundPool { + return { creator: "", id: "0", amount: "0" }; +} + +export const MsgDefundPool = { + encode(message: MsgDefundPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDefundPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDefundPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgDefundPool { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + id: isSet(object.id) ? String(object.id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgDefundPool): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.id !== undefined && (obj.id = message.id); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgDefundPool { + const message = createBaseMsgDefundPool(); + message.creator = object.creator ?? ""; + message.id = object.id ?? "0"; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgDefundPoolResponse(): MsgDefundPoolResponse { + return {}; +} + +export const MsgDefundPoolResponse = { + encode(_: MsgDefundPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDefundPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDefundPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgDefundPoolResponse { + return {}; + }, + + toJSON(_: MsgDefundPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgDefundPoolResponse { + const message = createBaseMsgDefundPoolResponse(); + return message; + }, +}; + +function createBaseMsgCreatePool(): MsgCreatePool { + return { + authority: "", + name: "", + runtime: "", + logo: "", + config: "", + start_key: "", + upload_interval: "0", + operating_cost: "0", + min_delegation: "0", + max_bundle_size: "0", + version: "", + binaries: "", + storage_provider_id: 0, + compression_id: 0, + }; +} + +export const MsgCreatePool = { + encode(message: MsgCreatePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + if (message.config !== "") { + writer.uint32(42).string(message.config); + } + if (message.start_key !== "") { + writer.uint32(50).string(message.start_key); + } + if (message.upload_interval !== "0") { + writer.uint32(56).uint64(message.upload_interval); + } + if (message.operating_cost !== "0") { + writer.uint32(64).uint64(message.operating_cost); + } + if (message.min_delegation !== "0") { + writer.uint32(72).uint64(message.min_delegation); + } + if (message.max_bundle_size !== "0") { + writer.uint32(80).uint64(message.max_bundle_size); + } + if (message.version !== "") { + writer.uint32(90).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(98).string(message.binaries); + } + if (message.storage_provider_id !== 0) { + writer.uint32(104).uint32(message.storage_provider_id); + } + if (message.compression_id !== 0) { + writer.uint32(112).uint32(message.compression_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.runtime = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + case 5: + message.config = reader.string(); + break; + case 6: + message.start_key = reader.string(); + break; + case 7: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 8: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 9: + message.min_delegation = longToString(reader.uint64() as Long); + break; + case 10: + message.max_bundle_size = longToString(reader.uint64() as Long); + break; + case 11: + message.version = reader.string(); + break; + case 12: + message.binaries = reader.string(); + break; + case 13: + message.storage_provider_id = reader.uint32(); + break; + case 14: + message.compression_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreatePool { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + config: isSet(object.config) ? String(object.config) : "", + start_key: isSet(object.start_key) ? String(object.start_key) : "", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? String(object.max_bundle_size) : "0", + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? Number(object.compression_id) : 0, + }; + }, + + toJSON(message: MsgCreatePool): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.config !== undefined && (obj.config = message.config); + message.start_key !== undefined && (obj.start_key = message.start_key); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.min_delegation !== undefined && (obj.min_delegation = message.min_delegation); + message.max_bundle_size !== undefined && (obj.max_bundle_size = message.max_bundle_size); + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + message.compression_id !== undefined && (obj.compression_id = Math.round(message.compression_id)); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreatePool { + const message = createBaseMsgCreatePool(); + message.authority = object.authority ?? ""; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.config = object.config ?? ""; + message.start_key = object.start_key ?? ""; + message.upload_interval = object.upload_interval ?? "0"; + message.operating_cost = object.operating_cost ?? "0"; + message.min_delegation = object.min_delegation ?? "0"; + message.max_bundle_size = object.max_bundle_size ?? "0"; + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.storage_provider_id = object.storage_provider_id ?? 0; + message.compression_id = object.compression_id ?? 0; + return message; + }, +}; + +function createBaseMsgCreatePoolResponse(): MsgCreatePoolResponse { + return {}; +} + +export const MsgCreatePoolResponse = { + encode(_: MsgCreatePoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCreatePoolResponse { + return {}; + }, + + toJSON(_: MsgCreatePoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCreatePoolResponse { + const message = createBaseMsgCreatePoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdatePool(): MsgUpdatePool { + return { authority: "", id: "0", payload: "" }; +} + +export const MsgUpdatePool = { + encode(message: MsgUpdatePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + if (message.payload !== "") { + writer.uint32(26).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdatePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdatePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + case 3: + message.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdatePool { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + id: isSet(object.id) ? String(object.id) : "0", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: MsgUpdatePool): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.id !== undefined && (obj.id = message.id); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdatePool { + const message = createBaseMsgUpdatePool(); + message.authority = object.authority ?? ""; + message.id = object.id ?? "0"; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBaseMsgUpdatePoolResponse(): MsgUpdatePoolResponse { + return {}; +} + +export const MsgUpdatePoolResponse = { + encode(_: MsgUpdatePoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdatePoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdatePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUpdatePoolResponse { + return {}; + }, + + toJSON(_: MsgUpdatePoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdatePoolResponse { + const message = createBaseMsgUpdatePoolResponse(); + return message; + }, +}; + +function createBaseMsgPausePool(): MsgPausePool { + return { authority: "", id: "0" }; +} + +export const MsgPausePool = { + encode(message: MsgPausePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgPausePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPausePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgPausePool { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + id: isSet(object.id) ? String(object.id) : "0", + }; + }, + + toJSON(message: MsgPausePool): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): MsgPausePool { + const message = createBaseMsgPausePool(); + message.authority = object.authority ?? ""; + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseMsgPausePoolResponse(): MsgPausePoolResponse { + return {}; +} + +export const MsgPausePoolResponse = { + encode(_: MsgPausePoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgPausePoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPausePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgPausePoolResponse { + return {}; + }, + + toJSON(_: MsgPausePoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgPausePoolResponse { + const message = createBaseMsgPausePoolResponse(); + return message; + }, +}; + +function createBaseMsgUnpausePool(): MsgUnpausePool { + return { authority: "", id: "0" }; +} + +export const MsgUnpausePool = { + encode(message: MsgUnpausePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUnpausePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpausePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUnpausePool { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + id: isSet(object.id) ? String(object.id) : "0", + }; + }, + + toJSON(message: MsgUnpausePool): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): MsgUnpausePool { + const message = createBaseMsgUnpausePool(); + message.authority = object.authority ?? ""; + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseMsgUnpausePoolResponse(): MsgUnpausePoolResponse { + return {}; +} + +export const MsgUnpausePoolResponse = { + encode(_: MsgUnpausePoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUnpausePoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpausePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUnpausePoolResponse { + return {}; + }, + + toJSON(_: MsgUnpausePoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUnpausePoolResponse { + const message = createBaseMsgUnpausePoolResponse(); + return message; + }, +}; + +function createBaseMsgScheduleRuntimeUpgrade(): MsgScheduleRuntimeUpgrade { + return { authority: "", runtime: "", version: "", scheduled_at: "0", duration: "0", binaries: "" }; +} + +export const MsgScheduleRuntimeUpgrade = { + encode(message: MsgScheduleRuntimeUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.runtime !== "") { + writer.uint32(18).string(message.runtime); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.scheduled_at !== "0") { + writer.uint32(32).uint64(message.scheduled_at); + } + if (message.duration !== "0") { + writer.uint32(40).uint64(message.duration); + } + if (message.binaries !== "") { + writer.uint32(50).string(message.binaries); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgScheduleRuntimeUpgrade { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgScheduleRuntimeUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.runtime = reader.string(); + break; + case 3: + message.version = reader.string(); + break; + case 4: + message.scheduled_at = longToString(reader.uint64() as Long); + break; + case 5: + message.duration = longToString(reader.uint64() as Long); + break; + case 6: + message.binaries = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgScheduleRuntimeUpgrade { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + version: isSet(object.version) ? String(object.version) : "", + scheduled_at: isSet(object.scheduled_at) ? String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? String(object.duration) : "0", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + }; + }, + + toJSON(message: MsgScheduleRuntimeUpgrade): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.version !== undefined && (obj.version = message.version); + message.scheduled_at !== undefined && (obj.scheduled_at = message.scheduled_at); + message.duration !== undefined && (obj.duration = message.duration); + message.binaries !== undefined && (obj.binaries = message.binaries); + return obj; + }, + + fromPartial, I>>(object: I): MsgScheduleRuntimeUpgrade { + const message = createBaseMsgScheduleRuntimeUpgrade(); + message.authority = object.authority ?? ""; + message.runtime = object.runtime ?? ""; + message.version = object.version ?? ""; + message.scheduled_at = object.scheduled_at ?? "0"; + message.duration = object.duration ?? "0"; + message.binaries = object.binaries ?? ""; + return message; + }, +}; + +function createBaseMsgScheduleRuntimeUpgradeResponse(): MsgScheduleRuntimeUpgradeResponse { + return {}; +} + +export const MsgScheduleRuntimeUpgradeResponse = { + encode(_: MsgScheduleRuntimeUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgScheduleRuntimeUpgradeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgScheduleRuntimeUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgScheduleRuntimeUpgradeResponse { + return {}; + }, + + toJSON(_: MsgScheduleRuntimeUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I, + ): MsgScheduleRuntimeUpgradeResponse { + const message = createBaseMsgScheduleRuntimeUpgradeResponse(); + return message; + }, +}; + +function createBaseMsgCancelRuntimeUpgrade(): MsgCancelRuntimeUpgrade { + return { authority: "", runtime: "" }; +} + +export const MsgCancelRuntimeUpgrade = { + encode(message: MsgCancelRuntimeUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.runtime !== "") { + writer.uint32(18).string(message.runtime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelRuntimeUpgrade { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelRuntimeUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.runtime = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCancelRuntimeUpgrade { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + }; + }, + + toJSON(message: MsgCancelRuntimeUpgrade): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.runtime !== undefined && (obj.runtime = message.runtime); + return obj; + }, + + fromPartial, I>>(object: I): MsgCancelRuntimeUpgrade { + const message = createBaseMsgCancelRuntimeUpgrade(); + message.authority = object.authority ?? ""; + message.runtime = object.runtime ?? ""; + return message; + }, +}; + +function createBaseMsgCancelRuntimeUpgradeResponse(): MsgCancelRuntimeUpgradeResponse { + return {}; +} + +export const MsgCancelRuntimeUpgradeResponse = { + encode(_: MsgCancelRuntimeUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelRuntimeUpgradeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelRuntimeUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCancelRuntimeUpgradeResponse { + return {}; + }, + + toJSON(_: MsgCancelRuntimeUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCancelRuntimeUpgradeResponse { + const message = createBaseMsgCancelRuntimeUpgradeResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** FundPool ... */ + FundPool(request: MsgFundPool): Promise; + /** DefundPool ... */ + DefundPool(request: MsgDefundPool): Promise; + /** + * CreatePool defines a governance operation for creating a new pool. + * The authority is hard-coded to the x/gov module account. + */ + CreatePool(request: MsgCreatePool): Promise; + /** + * UpdatePool defines a governance operation for updating an existing pool. + * The authority is hard-coded to the x/gov module account. + */ + UpdatePool(request: MsgUpdatePool): Promise; + /** + * PausingPool defines a governance operation for pausing an existing pool. + * The authority is hard-coded to the x/gov module account. + */ + PausePool(request: MsgPausePool): Promise; + /** + * UnpausePool defines a governance operation for unpausing an existing pool. + * The authority is hard-coded to the x/gov module account. + */ + UnpausePool(request: MsgUnpausePool): Promise; + /** + * ScheduleRuntimeUpgrade defines a governance operation for scheduling a runtime upgrade. + * The authority is hard-coded to the x/gov module account. + */ + ScheduleRuntimeUpgrade(request: MsgScheduleRuntimeUpgrade): Promise; + /** + * CancelRuntimeUpgrade defines a governance operation for cancelling a runtime upgrade. + * The authority is hard-coded to the x/gov module account. + */ + CancelRuntimeUpgrade(request: MsgCancelRuntimeUpgrade): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.pool.v1beta1.Msg"; + this.rpc = rpc; + this.FundPool = this.FundPool.bind(this); + this.DefundPool = this.DefundPool.bind(this); + this.CreatePool = this.CreatePool.bind(this); + this.UpdatePool = this.UpdatePool.bind(this); + this.PausePool = this.PausePool.bind(this); + this.UnpausePool = this.UnpausePool.bind(this); + this.ScheduleRuntimeUpgrade = this.ScheduleRuntimeUpgrade.bind(this); + this.CancelRuntimeUpgrade = this.CancelRuntimeUpgrade.bind(this); + } + FundPool(request: MsgFundPool): Promise { + const data = MsgFundPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "FundPool", data); + return promise.then((data) => MsgFundPoolResponse.decode(new _m0.Reader(data))); + } + + DefundPool(request: MsgDefundPool): Promise { + const data = MsgDefundPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "DefundPool", data); + return promise.then((data) => MsgDefundPoolResponse.decode(new _m0.Reader(data))); + } + + CreatePool(request: MsgCreatePool): Promise { + const data = MsgCreatePool.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreatePool", data); + return promise.then((data) => MsgCreatePoolResponse.decode(new _m0.Reader(data))); + } + + UpdatePool(request: MsgUpdatePool): Promise { + const data = MsgUpdatePool.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdatePool", data); + return promise.then((data) => MsgUpdatePoolResponse.decode(new _m0.Reader(data))); + } + + PausePool(request: MsgPausePool): Promise { + const data = MsgPausePool.encode(request).finish(); + const promise = this.rpc.request(this.service, "PausePool", data); + return promise.then((data) => MsgPausePoolResponse.decode(new _m0.Reader(data))); + } + + UnpausePool(request: MsgUnpausePool): Promise { + const data = MsgUnpausePool.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnpausePool", data); + return promise.then((data) => MsgUnpausePoolResponse.decode(new _m0.Reader(data))); + } + + ScheduleRuntimeUpgrade(request: MsgScheduleRuntimeUpgrade): Promise { + const data = MsgScheduleRuntimeUpgrade.encode(request).finish(); + const promise = this.rpc.request(this.service, "ScheduleRuntimeUpgrade", data); + return promise.then((data) => MsgScheduleRuntimeUpgradeResponse.decode(new _m0.Reader(data))); + } + + CancelRuntimeUpgrade(request: MsgCancelRuntimeUpgrade): Promise { + const data = MsgCancelRuntimeUpgrade.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelRuntimeUpgrade", data); + return promise.then((data) => MsgCancelRuntimeUpgradeResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/query/v1beta1/account.ts b/common/types/src/lcd/kyve/query/v1beta1/account.ts new file mode 100644 index 00000000..1a12e74d --- /dev/null +++ b/common/types/src/lcd/kyve/query/v1beta1/account.ts @@ -0,0 +1,880 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { BasicPool, FullStaker } from "./query"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** QueryAccountAssetsRequest is the request type for the Query/AccountAssets RPC method. */ +export interface QueryAccountAssetsRequest { + /** address ... */ + address: string; +} + +/** QueryAccountAssetsResponse is the response type for the Query/AccountAssets RPC method. */ +export interface QueryAccountAssetsResponse { + /** balance ... */ + balance: string; + /** protocol_staking ... */ + protocol_self_delegation: string; + /** protocol_staking_unbonding */ + protocol_self_delegation_unbonding: string; + /** protocol_delegation ... */ + protocol_delegation: string; + /** protocol_delegation_unbonding */ + protocol_delegation_unbonding: string; + /** protocol_rewards ... */ + protocol_rewards: string; + /** protocol_funding ... */ + protocol_funding: string; +} + +/** QueryAccountFundedListRequest ... */ +export interface QueryAccountDelegationUnbondingsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** address ... */ + address: string; +} + +/** QueryAccountAssetsResponse is the response type for the Query/AccountAssets RPC method. */ +export interface QueryAccountDelegationUnbondingsResponse { + /** balance ... */ + unbondings: DelegationUnbonding[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryAccountAssetsResponse is the response type for the Query/AccountAssets RPC method. */ +export interface DelegationUnbonding { + /** amount */ + amount: string; + /** creation_time */ + creation_time: string; + /** staker */ + staker?: FullStaker; +} + +/** QueryAccountFundedListRequest is the request type for the account queries with pagination */ +export interface QueryAccountFundedListRequest { + /** address ... */ + address: string; +} + +/** QueryAccountFundedListResponse is the response type for the Query/AccountFundedList RPC method. */ +export interface QueryAccountFundedListResponse { + /** funded ... */ + funded: Funded[]; +} + +/** Funded ... */ +export interface Funded { + /** amount ... */ + amount: string; + /** pool ... */ + pool?: BasicPool; +} + +/** QueryAccountDelegationListRequest ... */ +export interface QueryAccountRedelegationRequest { + /** address ... */ + address: string; +} + +/** QueryAccountDelegationListRequest is the response type for the Query/AccountDelegationList RPC method. */ +export interface QueryAccountRedelegationResponse { + /** redelegation_cooldown_entries ... */ + redelegation_cooldown_entries: RedelegationEntry[]; + /** availableSlots ... */ + available_slots: string; +} + +/** RedelegationEntry ... */ +export interface RedelegationEntry { + /** creation_date ... */ + creation_date: string; + /** finish_date ... */ + finish_date: string; +} + +function createBaseQueryAccountAssetsRequest(): QueryAccountAssetsRequest { + return { address: "" }; +} + +export const QueryAccountAssetsRequest = { + encode(message: QueryAccountAssetsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountAssetsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAssetsRequest(); + 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; + }, + + fromJSON(object: any): QueryAccountAssetsRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryAccountAssetsRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountAssetsRequest { + const message = createBaseQueryAccountAssetsRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountAssetsResponse(): QueryAccountAssetsResponse { + return { + balance: "0", + protocol_self_delegation: "0", + protocol_self_delegation_unbonding: "0", + protocol_delegation: "0", + protocol_delegation_unbonding: "0", + protocol_rewards: "0", + protocol_funding: "0", + }; +} + +export const QueryAccountAssetsResponse = { + encode(message: QueryAccountAssetsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.balance !== "0") { + writer.uint32(8).uint64(message.balance); + } + if (message.protocol_self_delegation !== "0") { + writer.uint32(16).uint64(message.protocol_self_delegation); + } + if (message.protocol_self_delegation_unbonding !== "0") { + writer.uint32(24).uint64(message.protocol_self_delegation_unbonding); + } + if (message.protocol_delegation !== "0") { + writer.uint32(32).uint64(message.protocol_delegation); + } + if (message.protocol_delegation_unbonding !== "0") { + writer.uint32(40).uint64(message.protocol_delegation_unbonding); + } + if (message.protocol_rewards !== "0") { + writer.uint32(48).uint64(message.protocol_rewards); + } + if (message.protocol_funding !== "0") { + writer.uint32(56).uint64(message.protocol_funding); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountAssetsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAssetsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balance = longToString(reader.uint64() as Long); + break; + case 2: + message.protocol_self_delegation = longToString(reader.uint64() as Long); + break; + case 3: + message.protocol_self_delegation_unbonding = longToString(reader.uint64() as Long); + break; + case 4: + message.protocol_delegation = longToString(reader.uint64() as Long); + break; + case 5: + message.protocol_delegation_unbonding = longToString(reader.uint64() as Long); + break; + case 6: + message.protocol_rewards = longToString(reader.uint64() as Long); + break; + case 7: + message.protocol_funding = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountAssetsResponse { + return { + balance: isSet(object.balance) ? String(object.balance) : "0", + protocol_self_delegation: isSet(object.protocol_self_delegation) ? String(object.protocol_self_delegation) : "0", + protocol_self_delegation_unbonding: isSet(object.protocol_self_delegation_unbonding) + ? String(object.protocol_self_delegation_unbonding) + : "0", + protocol_delegation: isSet(object.protocol_delegation) ? String(object.protocol_delegation) : "0", + protocol_delegation_unbonding: isSet(object.protocol_delegation_unbonding) + ? String(object.protocol_delegation_unbonding) + : "0", + protocol_rewards: isSet(object.protocol_rewards) ? String(object.protocol_rewards) : "0", + protocol_funding: isSet(object.protocol_funding) ? String(object.protocol_funding) : "0", + }; + }, + + toJSON(message: QueryAccountAssetsResponse): unknown { + const obj: any = {}; + message.balance !== undefined && (obj.balance = message.balance); + message.protocol_self_delegation !== undefined && (obj.protocol_self_delegation = message.protocol_self_delegation); + message.protocol_self_delegation_unbonding !== undefined && + (obj.protocol_self_delegation_unbonding = message.protocol_self_delegation_unbonding); + message.protocol_delegation !== undefined && (obj.protocol_delegation = message.protocol_delegation); + message.protocol_delegation_unbonding !== undefined && + (obj.protocol_delegation_unbonding = message.protocol_delegation_unbonding); + message.protocol_rewards !== undefined && (obj.protocol_rewards = message.protocol_rewards); + message.protocol_funding !== undefined && (obj.protocol_funding = message.protocol_funding); + return obj; + }, + + fromPartial, I>>(object: I): QueryAccountAssetsResponse { + const message = createBaseQueryAccountAssetsResponse(); + message.balance = object.balance ?? "0"; + message.protocol_self_delegation = object.protocol_self_delegation ?? "0"; + message.protocol_self_delegation_unbonding = object.protocol_self_delegation_unbonding ?? "0"; + message.protocol_delegation = object.protocol_delegation ?? "0"; + message.protocol_delegation_unbonding = object.protocol_delegation_unbonding ?? "0"; + message.protocol_rewards = object.protocol_rewards ?? "0"; + message.protocol_funding = object.protocol_funding ?? "0"; + return message; + }, +}; + +function createBaseQueryAccountDelegationUnbondingsRequest(): QueryAccountDelegationUnbondingsRequest { + return { pagination: undefined, address: "" }; +} + +export const QueryAccountDelegationUnbondingsRequest = { + encode(message: QueryAccountDelegationUnbondingsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountDelegationUnbondingsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountDelegationUnbondingsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountDelegationUnbondingsRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + address: isSet(object.address) ? String(object.address) : "", + }; + }, + + toJSON(message: QueryAccountDelegationUnbondingsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountDelegationUnbondingsRequest { + const message = createBaseQueryAccountDelegationUnbondingsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountDelegationUnbondingsResponse(): QueryAccountDelegationUnbondingsResponse { + return { unbondings: [], pagination: undefined }; +} + +export const QueryAccountDelegationUnbondingsResponse = { + encode(message: QueryAccountDelegationUnbondingsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.unbondings) { + DelegationUnbonding.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountDelegationUnbondingsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountDelegationUnbondingsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbondings.push(DelegationUnbonding.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountDelegationUnbondingsResponse { + return { + unbondings: Array.isArray(object?.unbondings) + ? object.unbondings.map((e: any) => DelegationUnbonding.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAccountDelegationUnbondingsResponse): unknown { + const obj: any = {}; + if (message.unbondings) { + obj.unbondings = message.unbondings.map((e) => e ? DelegationUnbonding.toJSON(e) : undefined); + } else { + obj.unbondings = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountDelegationUnbondingsResponse { + const message = createBaseQueryAccountDelegationUnbondingsResponse(); + message.unbondings = object.unbondings?.map((e) => DelegationUnbonding.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseDelegationUnbonding(): DelegationUnbonding { + return { amount: "0", creation_time: "0", staker: undefined }; +} + +export const DelegationUnbonding = { + encode(message: DelegationUnbonding, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== "0") { + writer.uint32(8).uint64(message.amount); + } + if (message.creation_time !== "0") { + writer.uint32(16).uint64(message.creation_time); + } + if (message.staker !== undefined) { + FullStaker.encode(message.staker, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationUnbonding { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationUnbonding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = longToString(reader.uint64() as Long); + break; + case 2: + message.creation_time = longToString(reader.uint64() as Long); + break; + case 3: + message.staker = FullStaker.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationUnbonding { + return { + amount: isSet(object.amount) ? String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? String(object.creation_time) : "0", + staker: isSet(object.staker) ? FullStaker.fromJSON(object.staker) : undefined, + }; + }, + + toJSON(message: DelegationUnbonding): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount); + message.creation_time !== undefined && (obj.creation_time = message.creation_time); + message.staker !== undefined && (obj.staker = message.staker ? FullStaker.toJSON(message.staker) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): DelegationUnbonding { + const message = createBaseDelegationUnbonding(); + message.amount = object.amount ?? "0"; + message.creation_time = object.creation_time ?? "0"; + message.staker = (object.staker !== undefined && object.staker !== null) + ? FullStaker.fromPartial(object.staker) + : undefined; + return message; + }, +}; + +function createBaseQueryAccountFundedListRequest(): QueryAccountFundedListRequest { + return { address: "" }; +} + +export const QueryAccountFundedListRequest = { + encode(message: QueryAccountFundedListRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountFundedListRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountFundedListRequest(); + 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; + }, + + fromJSON(object: any): QueryAccountFundedListRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryAccountFundedListRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountFundedListRequest { + const message = createBaseQueryAccountFundedListRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountFundedListResponse(): QueryAccountFundedListResponse { + return { funded: [] }; +} + +export const QueryAccountFundedListResponse = { + encode(message: QueryAccountFundedListResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.funded) { + Funded.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountFundedListResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountFundedListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.funded.push(Funded.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountFundedListResponse { + return { funded: Array.isArray(object?.funded) ? object.funded.map((e: any) => Funded.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryAccountFundedListResponse): unknown { + const obj: any = {}; + if (message.funded) { + obj.funded = message.funded.map((e) => e ? Funded.toJSON(e) : undefined); + } else { + obj.funded = []; + } + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountFundedListResponse { + const message = createBaseQueryAccountFundedListResponse(); + message.funded = object.funded?.map((e) => Funded.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFunded(): Funded { + return { amount: "0", pool: undefined }; +} + +export const Funded = { + encode(message: Funded, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.amount !== "0") { + writer.uint32(8).uint64(message.amount); + } + if (message.pool !== undefined) { + BasicPool.encode(message.pool, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Funded { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunded(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = longToString(reader.uint64() as Long); + break; + case 2: + message.pool = BasicPool.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Funded { + return { + amount: isSet(object.amount) ? String(object.amount) : "0", + pool: isSet(object.pool) ? BasicPool.fromJSON(object.pool) : undefined, + }; + }, + + toJSON(message: Funded): unknown { + const obj: any = {}; + message.amount !== undefined && (obj.amount = message.amount); + message.pool !== undefined && (obj.pool = message.pool ? BasicPool.toJSON(message.pool) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Funded { + const message = createBaseFunded(); + message.amount = object.amount ?? "0"; + message.pool = (object.pool !== undefined && object.pool !== null) ? BasicPool.fromPartial(object.pool) : undefined; + return message; + }, +}; + +function createBaseQueryAccountRedelegationRequest(): QueryAccountRedelegationRequest { + return { address: "" }; +} + +export const QueryAccountRedelegationRequest = { + encode(message: QueryAccountRedelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRedelegationRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRedelegationRequest(); + 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; + }, + + fromJSON(object: any): QueryAccountRedelegationRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRedelegationRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountRedelegationRequest { + const message = createBaseQueryAccountRedelegationRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryAccountRedelegationResponse(): QueryAccountRedelegationResponse { + return { redelegation_cooldown_entries: [], available_slots: "0" }; +} + +export const QueryAccountRedelegationResponse = { + encode(message: QueryAccountRedelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.redelegation_cooldown_entries) { + RedelegationEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.available_slots !== "0") { + writer.uint32(16).uint64(message.available_slots); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRedelegationResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegation_cooldown_entries.push(RedelegationEntry.decode(reader, reader.uint32())); + break; + case 2: + message.available_slots = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAccountRedelegationResponse { + return { + redelegation_cooldown_entries: Array.isArray(object?.redelegation_cooldown_entries) + ? object.redelegation_cooldown_entries.map((e: any) => RedelegationEntry.fromJSON(e)) + : [], + available_slots: isSet(object.available_slots) ? String(object.available_slots) : "0", + }; + }, + + toJSON(message: QueryAccountRedelegationResponse): unknown { + const obj: any = {}; + if (message.redelegation_cooldown_entries) { + obj.redelegation_cooldown_entries = message.redelegation_cooldown_entries.map((e) => + e ? RedelegationEntry.toJSON(e) : undefined + ); + } else { + obj.redelegation_cooldown_entries = []; + } + message.available_slots !== undefined && (obj.available_slots = message.available_slots); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryAccountRedelegationResponse { + const message = createBaseQueryAccountRedelegationResponse(); + message.redelegation_cooldown_entries = + object.redelegation_cooldown_entries?.map((e) => RedelegationEntry.fromPartial(e)) || []; + message.available_slots = object.available_slots ?? "0"; + return message; + }, +}; + +function createBaseRedelegationEntry(): RedelegationEntry { + return { creation_date: "0", finish_date: "0" }; +} + +export const RedelegationEntry = { + encode(message: RedelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creation_date !== "0") { + writer.uint32(8).uint64(message.creation_date); + } + if (message.finish_date !== "0") { + writer.uint32(16).uint64(message.finish_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.creation_date = longToString(reader.uint64() as Long); + break; + case 2: + message.finish_date = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RedelegationEntry { + return { + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + finish_date: isSet(object.finish_date) ? String(object.finish_date) : "0", + }; + }, + + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + message.finish_date !== undefined && (obj.finish_date = message.finish_date); + return obj; + }, + + fromPartial, I>>(object: I): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creation_date = object.creation_date ?? "0"; + message.finish_date = object.finish_date ?? "0"; + return message; + }, +}; + +/** QueryDelegation contains all rpc requests related to direct delegation data */ +export interface QueryAccount { + /** AccountAssets returns an overview of the sum of all balances for a given user. e.g. balance, staking, funding, etc. */ + AccountAssets(request: QueryAccountAssetsRequest): Promise; + /** AccountDelegationUnbondings ... */ + AccountDelegationUnbondings( + request: QueryAccountDelegationUnbondingsRequest, + ): Promise; + /** AccountFundedList returns all pools the given user has funded into. */ + AccountFundedList(request: QueryAccountFundedListRequest): Promise; + /** AccountRedelegation ... */ + AccountRedelegation(request: QueryAccountRedelegationRequest): Promise; +} + +export class QueryAccountClientImpl implements QueryAccount { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryAccount"; + this.rpc = rpc; + this.AccountAssets = this.AccountAssets.bind(this); + this.AccountDelegationUnbondings = this.AccountDelegationUnbondings.bind(this); + this.AccountFundedList = this.AccountFundedList.bind(this); + this.AccountRedelegation = this.AccountRedelegation.bind(this); + } + AccountAssets(request: QueryAccountAssetsRequest): Promise { + const data = QueryAccountAssetsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountAssets", data); + return promise.then((data) => QueryAccountAssetsResponse.decode(new _m0.Reader(data))); + } + + AccountDelegationUnbondings( + request: QueryAccountDelegationUnbondingsRequest, + ): Promise { + const data = QueryAccountDelegationUnbondingsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountDelegationUnbondings", data); + return promise.then((data) => QueryAccountDelegationUnbondingsResponse.decode(new _m0.Reader(data))); + } + + AccountFundedList(request: QueryAccountFundedListRequest): Promise { + const data = QueryAccountFundedListRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountFundedList", data); + return promise.then((data) => QueryAccountFundedListResponse.decode(new _m0.Reader(data))); + } + + AccountRedelegation(request: QueryAccountRedelegationRequest): Promise { + const data = QueryAccountRedelegationRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountRedelegation", data); + return promise.then((data) => QueryAccountRedelegationResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/query/v1beta1/bundles.ts b/common/types/src/lcd/kyve/query/v1beta1/bundles.ts new file mode 100644 index 00000000..fa32d124 --- /dev/null +++ b/common/types/src/lcd/kyve/query/v1beta1/bundles.ts @@ -0,0 +1,1097 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { FinalizedBundle } from "../../bundles/v1beta1/bundles"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** QueryFinalizedBundlesRequest is the request type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundlesRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** pool_id ... */ + pool_id: string; +} + +/** QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundlesResponse { + /** finalized_bundles ... */ + finalized_bundles: FinalizedBundle[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryFinalizedBundleRequest is the request type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundleRequest { + /** pool_id ... */ + pool_id: string; + /** id ... */ + id: string; +} + +/** QueryFinalizedBundleResponse is the response type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundleResponse { + /** finalized_bundle ... */ + finalized_bundle?: FinalizedBundle; +} + +/** QueryFinalizedBundleRequest is the request type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundlesByHeightRequest { + /** pool_id ... */ + pool_id: string; + /** id ... */ + height: string; +} + +/** QueryFinalizedBundleResponse is the response type for the Query/Staker RPC method. */ +export interface QueryFinalizedBundlesByHeightResponse { + /** finalized_bundle ... */ + finalized_bundle?: FinalizedBundle; +} + +/** QueryCurrentVoteStatusRequest is the request type for the Query/Staker RPC method. */ +export interface QueryCurrentVoteStatusRequest { + /** pool_id ... */ + pool_id: string; +} + +/** QueryCurrentVoteStatusResponse is the response type for the Query/Staker RPC method. */ +export interface QueryCurrentVoteStatusResponse { + /** valid ... */ + valid: string; + /** invalid ... */ + invalid: string; + /** abstain ... */ + abstain: string; + /** total ... */ + total: string; +} + +/** QueryCanProposeRequest is the request type for the Query/CanPropose RPC method. */ +export interface QueryCanValidateRequest { + /** pool_id defines the unique ID of the pool. */ + pool_id: string; + /** valaddress ... */ + valaddress: string; +} + +/** QueryCanProposeResponse is the response type for the Query/CanPropose RPC method. */ +export interface QueryCanValidateResponse { + /** possible ... */ + possible: boolean; + /** reason ... */ + reason: string; +} + +/** QueryCanProposeRequest is the request type for the Query/CanPropose RPC method. */ +export interface QueryCanProposeRequest { + /** pool_id defines the unique ID of the pool. */ + pool_id: string; + /** staker ... */ + staker: string; + /** proposer ... */ + proposer: string; + /** from_index ... */ + from_index: string; +} + +/** QueryCanProposeResponse is the response type for the Query/CanPropose RPC method. */ +export interface QueryCanProposeResponse { + /** possible ... */ + possible: boolean; + /** reason ... */ + reason: string; +} + +/** QueryCanVoteRequest is the request type for the Query/CanVote RPC method. */ +export interface QueryCanVoteRequest { + /** pool_id defines the unique ID of the pool. */ + pool_id: string; + /** staker ... */ + staker: string; + /** voter ... */ + voter: string; + /** storage_id ... */ + storage_id: string; +} + +/** QueryCanVoteResponse is the response type for the Query/CanVote RPC method. */ +export interface QueryCanVoteResponse { + /** possible ... */ + possible: boolean; + /** reason ... */ + reason: string; +} + +function createBaseQueryFinalizedBundlesRequest(): QueryFinalizedBundlesRequest { + return { pagination: undefined, pool_id: "0" }; +} + +export const QueryFinalizedBundlesRequest = { + encode(message: QueryFinalizedBundlesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundlesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundlesRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + }; + }, + + toJSON(message: QueryFinalizedBundlesRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryFinalizedBundlesRequest { + const message = createBaseQueryFinalizedBundlesRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +function createBaseQueryFinalizedBundlesResponse(): QueryFinalizedBundlesResponse { + return { finalized_bundles: [], pagination: undefined }; +} + +export const QueryFinalizedBundlesResponse = { + encode(message: QueryFinalizedBundlesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.finalized_bundles) { + FinalizedBundle.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundlesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.finalized_bundles.push(FinalizedBundle.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundlesResponse { + return { + finalized_bundles: Array.isArray(object?.finalized_bundles) + ? object.finalized_bundles.map((e: any) => FinalizedBundle.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryFinalizedBundlesResponse): unknown { + const obj: any = {}; + if (message.finalized_bundles) { + obj.finalized_bundles = message.finalized_bundles.map((e) => e ? FinalizedBundle.toJSON(e) : undefined); + } else { + obj.finalized_bundles = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryFinalizedBundlesResponse { + const message = createBaseQueryFinalizedBundlesResponse(); + message.finalized_bundles = object.finalized_bundles?.map((e) => FinalizedBundle.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryFinalizedBundleRequest(): QueryFinalizedBundleRequest { + return { pool_id: "0", id: "0" }; +} + +export const QueryFinalizedBundleRequest = { + encode(message: QueryFinalizedBundleRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.id !== "0") { + writer.uint32(16).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundleRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundleRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundleRequest { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + id: isSet(object.id) ? String(object.id) : "0", + }; + }, + + toJSON(message: QueryFinalizedBundleRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): QueryFinalizedBundleRequest { + const message = createBaseQueryFinalizedBundleRequest(); + message.pool_id = object.pool_id ?? "0"; + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseQueryFinalizedBundleResponse(): QueryFinalizedBundleResponse { + return { finalized_bundle: undefined }; +} + +export const QueryFinalizedBundleResponse = { + encode(message: QueryFinalizedBundleResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.finalized_bundle !== undefined) { + FinalizedBundle.encode(message.finalized_bundle, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundleResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundleResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.finalized_bundle = FinalizedBundle.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundleResponse { + return { + finalized_bundle: isSet(object.finalized_bundle) ? FinalizedBundle.fromJSON(object.finalized_bundle) : undefined, + }; + }, + + toJSON(message: QueryFinalizedBundleResponse): unknown { + const obj: any = {}; + message.finalized_bundle !== undefined && + (obj.finalized_bundle = message.finalized_bundle ? FinalizedBundle.toJSON(message.finalized_bundle) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryFinalizedBundleResponse { + const message = createBaseQueryFinalizedBundleResponse(); + message.finalized_bundle = (object.finalized_bundle !== undefined && object.finalized_bundle !== null) + ? FinalizedBundle.fromPartial(object.finalized_bundle) + : undefined; + return message; + }, +}; + +function createBaseQueryFinalizedBundlesByHeightRequest(): QueryFinalizedBundlesByHeightRequest { + return { pool_id: "0", height: "0" }; +} + +export const QueryFinalizedBundlesByHeightRequest = { + encode(message: QueryFinalizedBundlesByHeightRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.height !== "0") { + writer.uint32(16).uint64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesByHeightRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundlesByHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.height = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundlesByHeightRequest { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + height: isSet(object.height) ? String(object.height) : "0", + }; + }, + + toJSON(message: QueryFinalizedBundlesByHeightRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryFinalizedBundlesByHeightRequest { + const message = createBaseQueryFinalizedBundlesByHeightRequest(); + message.pool_id = object.pool_id ?? "0"; + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseQueryFinalizedBundlesByHeightResponse(): QueryFinalizedBundlesByHeightResponse { + return { finalized_bundle: undefined }; +} + +export const QueryFinalizedBundlesByHeightResponse = { + encode(message: QueryFinalizedBundlesByHeightResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.finalized_bundle !== undefined) { + FinalizedBundle.encode(message.finalized_bundle, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesByHeightResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFinalizedBundlesByHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.finalized_bundle = FinalizedBundle.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryFinalizedBundlesByHeightResponse { + return { + finalized_bundle: isSet(object.finalized_bundle) ? FinalizedBundle.fromJSON(object.finalized_bundle) : undefined, + }; + }, + + toJSON(message: QueryFinalizedBundlesByHeightResponse): unknown { + const obj: any = {}; + message.finalized_bundle !== undefined && + (obj.finalized_bundle = message.finalized_bundle ? FinalizedBundle.toJSON(message.finalized_bundle) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryFinalizedBundlesByHeightResponse { + const message = createBaseQueryFinalizedBundlesByHeightResponse(); + message.finalized_bundle = (object.finalized_bundle !== undefined && object.finalized_bundle !== null) + ? FinalizedBundle.fromPartial(object.finalized_bundle) + : undefined; + return message; + }, +}; + +function createBaseQueryCurrentVoteStatusRequest(): QueryCurrentVoteStatusRequest { + return { pool_id: "0" }; +} + +export const QueryCurrentVoteStatusRequest = { + encode(message: QueryCurrentVoteStatusRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentVoteStatusRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentVoteStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCurrentVoteStatusRequest { + return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + }, + + toJSON(message: QueryCurrentVoteStatusRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryCurrentVoteStatusRequest { + const message = createBaseQueryCurrentVoteStatusRequest(); + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +function createBaseQueryCurrentVoteStatusResponse(): QueryCurrentVoteStatusResponse { + return { valid: "0", invalid: "0", abstain: "0", total: "0" }; +} + +export const QueryCurrentVoteStatusResponse = { + encode(message: QueryCurrentVoteStatusResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.valid !== "0") { + writer.uint32(8).uint64(message.valid); + } + if (message.invalid !== "0") { + writer.uint32(16).uint64(message.invalid); + } + if (message.abstain !== "0") { + writer.uint32(24).uint64(message.abstain); + } + if (message.total !== "0") { + writer.uint32(32).uint64(message.total); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentVoteStatusResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentVoteStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.valid = longToString(reader.uint64() as Long); + break; + case 2: + message.invalid = longToString(reader.uint64() as Long); + break; + case 3: + message.abstain = longToString(reader.uint64() as Long); + break; + case 4: + message.total = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCurrentVoteStatusResponse { + return { + valid: isSet(object.valid) ? String(object.valid) : "0", + invalid: isSet(object.invalid) ? String(object.invalid) : "0", + abstain: isSet(object.abstain) ? String(object.abstain) : "0", + total: isSet(object.total) ? String(object.total) : "0", + }; + }, + + toJSON(message: QueryCurrentVoteStatusResponse): unknown { + const obj: any = {}; + message.valid !== undefined && (obj.valid = message.valid); + message.invalid !== undefined && (obj.invalid = message.invalid); + message.abstain !== undefined && (obj.abstain = message.abstain); + message.total !== undefined && (obj.total = message.total); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryCurrentVoteStatusResponse { + const message = createBaseQueryCurrentVoteStatusResponse(); + message.valid = object.valid ?? "0"; + message.invalid = object.invalid ?? "0"; + message.abstain = object.abstain ?? "0"; + message.total = object.total ?? "0"; + return message; + }, +}; + +function createBaseQueryCanValidateRequest(): QueryCanValidateRequest { + return { pool_id: "0", valaddress: "" }; +} + +export const QueryCanValidateRequest = { + encode(message: QueryCanValidateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.valaddress !== "") { + writer.uint32(18).string(message.valaddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanValidateRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanValidateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.valaddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanValidateRequest { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + valaddress: isSet(object.valaddress) ? String(object.valaddress) : "", + }; + }, + + toJSON(message: QueryCanValidateRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.valaddress !== undefined && (obj.valaddress = message.valaddress); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanValidateRequest { + const message = createBaseQueryCanValidateRequest(); + message.pool_id = object.pool_id ?? "0"; + message.valaddress = object.valaddress ?? ""; + return message; + }, +}; + +function createBaseQueryCanValidateResponse(): QueryCanValidateResponse { + return { possible: false, reason: "" }; +} + +export const QueryCanValidateResponse = { + encode(message: QueryCanValidateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.possible === true) { + writer.uint32(8).bool(message.possible); + } + if (message.reason !== "") { + writer.uint32(18).string(message.reason); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanValidateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanValidateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.possible = reader.bool(); + break; + case 2: + message.reason = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanValidateResponse { + return { + possible: isSet(object.possible) ? Boolean(object.possible) : false, + reason: isSet(object.reason) ? String(object.reason) : "", + }; + }, + + toJSON(message: QueryCanValidateResponse): unknown { + const obj: any = {}; + message.possible !== undefined && (obj.possible = message.possible); + message.reason !== undefined && (obj.reason = message.reason); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanValidateResponse { + const message = createBaseQueryCanValidateResponse(); + message.possible = object.possible ?? false; + message.reason = object.reason ?? ""; + return message; + }, +}; + +function createBaseQueryCanProposeRequest(): QueryCanProposeRequest { + return { pool_id: "0", staker: "", proposer: "", from_index: "0" }; +} + +export const QueryCanProposeRequest = { + encode(message: QueryCanProposeRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.from_index !== "0") { + writer.uint32(32).uint64(message.from_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanProposeRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanProposeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.proposer = reader.string(); + break; + case 4: + message.from_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanProposeRequest { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + proposer: isSet(object.proposer) ? String(object.proposer) : "", + from_index: isSet(object.from_index) ? String(object.from_index) : "0", + }; + }, + + toJSON(message: QueryCanProposeRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.proposer !== undefined && (obj.proposer = message.proposer); + message.from_index !== undefined && (obj.from_index = message.from_index); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanProposeRequest { + const message = createBaseQueryCanProposeRequest(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.proposer = object.proposer ?? ""; + message.from_index = object.from_index ?? "0"; + return message; + }, +}; + +function createBaseQueryCanProposeResponse(): QueryCanProposeResponse { + return { possible: false, reason: "" }; +} + +export const QueryCanProposeResponse = { + encode(message: QueryCanProposeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.possible === true) { + writer.uint32(8).bool(message.possible); + } + if (message.reason !== "") { + writer.uint32(18).string(message.reason); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanProposeResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanProposeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.possible = reader.bool(); + break; + case 2: + message.reason = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanProposeResponse { + return { + possible: isSet(object.possible) ? Boolean(object.possible) : false, + reason: isSet(object.reason) ? String(object.reason) : "", + }; + }, + + toJSON(message: QueryCanProposeResponse): unknown { + const obj: any = {}; + message.possible !== undefined && (obj.possible = message.possible); + message.reason !== undefined && (obj.reason = message.reason); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanProposeResponse { + const message = createBaseQueryCanProposeResponse(); + message.possible = object.possible ?? false; + message.reason = object.reason ?? ""; + return message; + }, +}; + +function createBaseQueryCanVoteRequest(): QueryCanVoteRequest { + return { pool_id: "0", staker: "", voter: "", storage_id: "" }; +} + +export const QueryCanVoteRequest = { + encode(message: QueryCanVoteRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.voter !== "") { + writer.uint32(26).string(message.voter); + } + if (message.storage_id !== "") { + writer.uint32(34).string(message.storage_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanVoteRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.voter = reader.string(); + break; + case 4: + message.storage_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanVoteRequest { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + voter: isSet(object.voter) ? String(object.voter) : "", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + }; + }, + + toJSON(message: QueryCanVoteRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.voter !== undefined && (obj.voter = message.voter); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanVoteRequest { + const message = createBaseQueryCanVoteRequest(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.voter = object.voter ?? ""; + message.storage_id = object.storage_id ?? ""; + return message; + }, +}; + +function createBaseQueryCanVoteResponse(): QueryCanVoteResponse { + return { possible: false, reason: "" }; +} + +export const QueryCanVoteResponse = { + encode(message: QueryCanVoteResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.possible === true) { + writer.uint32(8).bool(message.possible); + } + if (message.reason !== "") { + writer.uint32(18).string(message.reason); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCanVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.possible = reader.bool(); + break; + case 2: + message.reason = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCanVoteResponse { + return { + possible: isSet(object.possible) ? Boolean(object.possible) : false, + reason: isSet(object.reason) ? String(object.reason) : "", + }; + }, + + toJSON(message: QueryCanVoteResponse): unknown { + const obj: any = {}; + message.possible !== undefined && (obj.possible = message.possible); + message.reason !== undefined && (obj.reason = message.reason); + return obj; + }, + + fromPartial, I>>(object: I): QueryCanVoteResponse { + const message = createBaseQueryCanVoteResponse(); + message.possible = object.possible ?? false; + message.reason = object.reason ?? ""; + return message; + }, +}; + +/** QueryDelegation contains all rpc requests related to direct delegation data */ +export interface QueryBundles { + /** FinalizedBundles ... */ + FinalizedBundles(request: QueryFinalizedBundlesRequest): Promise; + /** FinalizedBundle ... */ + FinalizedBundle(request: QueryFinalizedBundleRequest): Promise; + /** Queries the bundle which contains the data given height */ + FinalizedBundlesByHeight( + request: QueryFinalizedBundlesByHeightRequest, + ): Promise; + /** CurrentVoteStatus ... */ + CurrentVoteStatus(request: QueryCurrentVoteStatusRequest): Promise; + /** CanValidate ... */ + CanValidate(request: QueryCanValidateRequest): Promise; + /** CanPropose ... */ + CanPropose(request: QueryCanProposeRequest): Promise; + /** CanVote checks if voter on pool can still vote for the given bundle */ + CanVote(request: QueryCanVoteRequest): Promise; +} + +export class QueryBundlesClientImpl implements QueryBundles { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryBundles"; + this.rpc = rpc; + this.FinalizedBundles = this.FinalizedBundles.bind(this); + this.FinalizedBundle = this.FinalizedBundle.bind(this); + this.FinalizedBundlesByHeight = this.FinalizedBundlesByHeight.bind(this); + this.CurrentVoteStatus = this.CurrentVoteStatus.bind(this); + this.CanValidate = this.CanValidate.bind(this); + this.CanPropose = this.CanPropose.bind(this); + this.CanVote = this.CanVote.bind(this); + } + FinalizedBundles(request: QueryFinalizedBundlesRequest): Promise { + const data = QueryFinalizedBundlesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizedBundles", data); + return promise.then((data) => QueryFinalizedBundlesResponse.decode(new _m0.Reader(data))); + } + + FinalizedBundle(request: QueryFinalizedBundleRequest): Promise { + const data = QueryFinalizedBundleRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizedBundle", data); + return promise.then((data) => QueryFinalizedBundleResponse.decode(new _m0.Reader(data))); + } + + FinalizedBundlesByHeight( + request: QueryFinalizedBundlesByHeightRequest, + ): Promise { + const data = QueryFinalizedBundlesByHeightRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FinalizedBundlesByHeight", data); + return promise.then((data) => QueryFinalizedBundlesByHeightResponse.decode(new _m0.Reader(data))); + } + + CurrentVoteStatus(request: QueryCurrentVoteStatusRequest): Promise { + const data = QueryCurrentVoteStatusRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CurrentVoteStatus", data); + return promise.then((data) => QueryCurrentVoteStatusResponse.decode(new _m0.Reader(data))); + } + + CanValidate(request: QueryCanValidateRequest): Promise { + const data = QueryCanValidateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CanValidate", data); + return promise.then((data) => QueryCanValidateResponse.decode(new _m0.Reader(data))); + } + + CanPropose(request: QueryCanProposeRequest): Promise { + const data = QueryCanProposeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CanPropose", data); + return promise.then((data) => QueryCanProposeResponse.decode(new _m0.Reader(data))); + } + + CanVote(request: QueryCanVoteRequest): Promise { + const data = QueryCanVoteRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CanVote", data); + return promise.then((data) => QueryCanVoteResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/query/v1beta1/delegation.ts b/common/types/src/lcd/kyve/query/v1beta1/delegation.ts new file mode 100644 index 00000000..5c87d5b4 --- /dev/null +++ b/common/types/src/lcd/kyve/query/v1beta1/delegation.ts @@ -0,0 +1,698 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { FullStaker } from "./query"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** QueryDelegatorRequest is the request type for the Query/Delegator RPC method. */ +export interface QueryDelegatorRequest { + /** staker ... */ + staker: string; + /** delegator ... */ + delegator: string; +} + +/** QueryDelegatorResponse is the response type for the Query/Delegator RPC method. */ +export interface QueryDelegatorResponse { + /** delegator ... */ + delegator?: StakerDelegatorResponse; +} + +/** StakerDelegatorResponse ... */ +export interface StakerDelegatorResponse { + /** delegator ... */ + delegator: string; + /** current_reward ... */ + current_reward: string; + /** delegation_amount ... */ + delegation_amount: string; + /** staker ... */ + staker: string; +} + +/** QueryDelegatorsByStakerRequest ... */ +export interface QueryDelegatorsByStakerRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** staker ... */ + staker: string; +} + +/** QueryDelegatorsByStakerResponse ... */ +export interface QueryDelegatorsByStakerResponse { + /** delegators ... */ + delegators: StakerDelegatorResponse[]; + /** total_delegation ... (consider metadata object) */ + total_delegation: string; + /** total_delegation ... */ + total_delegator_count: string; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryStakersByDelegatorRequest ... */ +export interface QueryStakersByDelegatorRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** delegator ... */ + delegator: string; +} + +/** QueryStakersByDelegatorResponse ... */ +export interface QueryStakersByDelegatorResponse { + /** delegator ... */ + delegator: string; + /** stakers ... */ + stakers: DelegationForStakerResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** DelegationForStakerResponse ... */ +export interface DelegationForStakerResponse { + /** staker ... */ + staker?: FullStaker; + /** current_reward ... */ + current_reward: string; + /** delegation_amount ... */ + delegation_amount: string; +} + +function createBaseQueryDelegatorRequest(): QueryDelegatorRequest { + return { staker: "", delegator: "" }; +} + +export const QueryDelegatorRequest = { + encode(message: QueryDelegatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.delegator !== "") { + writer.uint32(18).string(message.delegator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.delegator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorRequest { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + delegator: isSet(object.delegator) ? String(object.delegator) : "", + }; + }, + + toJSON(message: QueryDelegatorRequest): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.delegator !== undefined && (obj.delegator = message.delegator); + return obj; + }, + + fromPartial, I>>(object: I): QueryDelegatorRequest { + const message = createBaseQueryDelegatorRequest(); + message.staker = object.staker ?? ""; + message.delegator = object.delegator ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorResponse(): QueryDelegatorResponse { + return { delegator: undefined }; +} + +export const QueryDelegatorResponse = { + encode(message: QueryDelegatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator !== undefined) { + StakerDelegatorResponse.encode(message.delegator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator = StakerDelegatorResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorResponse { + return { delegator: isSet(object.delegator) ? StakerDelegatorResponse.fromJSON(object.delegator) : undefined }; + }, + + toJSON(message: QueryDelegatorResponse): unknown { + const obj: any = {}; + message.delegator !== undefined && + (obj.delegator = message.delegator ? StakerDelegatorResponse.toJSON(message.delegator) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryDelegatorResponse { + const message = createBaseQueryDelegatorResponse(); + message.delegator = (object.delegator !== undefined && object.delegator !== null) + ? StakerDelegatorResponse.fromPartial(object.delegator) + : undefined; + return message; + }, +}; + +function createBaseStakerDelegatorResponse(): StakerDelegatorResponse { + return { delegator: "", current_reward: "0", delegation_amount: "0", staker: "" }; +} + +export const StakerDelegatorResponse = { + encode(message: StakerDelegatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator !== "") { + writer.uint32(10).string(message.delegator); + } + if (message.current_reward !== "0") { + writer.uint32(16).uint64(message.current_reward); + } + if (message.delegation_amount !== "0") { + writer.uint32(24).uint64(message.delegation_amount); + } + if (message.staker !== "") { + writer.uint32(34).string(message.staker); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakerDelegatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakerDelegatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator = reader.string(); + break; + case 2: + message.current_reward = longToString(reader.uint64() as Long); + break; + case 3: + message.delegation_amount = longToString(reader.uint64() as Long); + break; + case 4: + message.staker = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StakerDelegatorResponse { + return { + delegator: isSet(object.delegator) ? String(object.delegator) : "", + current_reward: isSet(object.current_reward) ? String(object.current_reward) : "0", + delegation_amount: isSet(object.delegation_amount) ? String(object.delegation_amount) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + }; + }, + + toJSON(message: StakerDelegatorResponse): unknown { + const obj: any = {}; + message.delegator !== undefined && (obj.delegator = message.delegator); + message.current_reward !== undefined && (obj.current_reward = message.current_reward); + message.delegation_amount !== undefined && (obj.delegation_amount = message.delegation_amount); + message.staker !== undefined && (obj.staker = message.staker); + return obj; + }, + + fromPartial, I>>(object: I): StakerDelegatorResponse { + const message = createBaseStakerDelegatorResponse(); + message.delegator = object.delegator ?? ""; + message.current_reward = object.current_reward ?? "0"; + message.delegation_amount = object.delegation_amount ?? "0"; + message.staker = object.staker ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorsByStakerRequest(): QueryDelegatorsByStakerRequest { + return { pagination: undefined, staker: "" }; +} + +export const QueryDelegatorsByStakerRequest = { + encode(message: QueryDelegatorsByStakerRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorsByStakerRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorsByStakerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.staker = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorsByStakerRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + staker: isSet(object.staker) ? String(object.staker) : "", + }; + }, + + toJSON(message: QueryDelegatorsByStakerRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.staker !== undefined && (obj.staker = message.staker); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorsByStakerRequest { + const message = createBaseQueryDelegatorsByStakerRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.staker = object.staker ?? ""; + return message; + }, +}; + +function createBaseQueryDelegatorsByStakerResponse(): QueryDelegatorsByStakerResponse { + return { delegators: [], total_delegation: "0", total_delegator_count: "0", pagination: undefined }; +} + +export const QueryDelegatorsByStakerResponse = { + encode(message: QueryDelegatorsByStakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.delegators) { + StakerDelegatorResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.total_delegation !== "0") { + writer.uint32(16).uint64(message.total_delegation); + } + if (message.total_delegator_count !== "0") { + writer.uint32(24).uint64(message.total_delegator_count); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorsByStakerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorsByStakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegators.push(StakerDelegatorResponse.decode(reader, reader.uint32())); + break; + case 2: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 3: + message.total_delegator_count = longToString(reader.uint64() as Long); + break; + case 4: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryDelegatorsByStakerResponse { + return { + delegators: Array.isArray(object?.delegators) + ? object.delegators.map((e: any) => StakerDelegatorResponse.fromJSON(e)) + : [], + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + total_delegator_count: isSet(object.total_delegator_count) ? String(object.total_delegator_count) : "0", + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorsByStakerResponse): unknown { + const obj: any = {}; + if (message.delegators) { + obj.delegators = message.delegators.map((e) => e ? StakerDelegatorResponse.toJSON(e) : undefined); + } else { + obj.delegators = []; + } + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.total_delegator_count !== undefined && (obj.total_delegator_count = message.total_delegator_count); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryDelegatorsByStakerResponse { + const message = createBaseQueryDelegatorsByStakerResponse(); + message.delegators = object.delegators?.map((e) => StakerDelegatorResponse.fromPartial(e)) || []; + message.total_delegation = object.total_delegation ?? "0"; + message.total_delegator_count = object.total_delegator_count ?? "0"; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryStakersByDelegatorRequest(): QueryStakersByDelegatorRequest { + return { pagination: undefined, delegator: "" }; +} + +export const QueryStakersByDelegatorRequest = { + encode(message: QueryStakersByDelegatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.delegator !== "") { + writer.uint32(18).string(message.delegator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByDelegatorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByDelegatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.delegator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersByDelegatorRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + delegator: isSet(object.delegator) ? String(object.delegator) : "", + }; + }, + + toJSON(message: QueryStakersByDelegatorRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.delegator !== undefined && (obj.delegator = message.delegator); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryStakersByDelegatorRequest { + const message = createBaseQueryStakersByDelegatorRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.delegator = object.delegator ?? ""; + return message; + }, +}; + +function createBaseQueryStakersByDelegatorResponse(): QueryStakersByDelegatorResponse { + return { delegator: "", stakers: [], pagination: undefined }; +} + +export const QueryStakersByDelegatorResponse = { + encode(message: QueryStakersByDelegatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.delegator !== "") { + writer.uint32(10).string(message.delegator); + } + for (const v of message.stakers) { + DelegationForStakerResponse.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByDelegatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByDelegatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator = reader.string(); + break; + case 2: + message.stakers.push(DelegationForStakerResponse.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersByDelegatorResponse { + return { + delegator: isSet(object.delegator) ? String(object.delegator) : "", + stakers: Array.isArray(object?.stakers) + ? object.stakers.map((e: any) => DelegationForStakerResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryStakersByDelegatorResponse): unknown { + const obj: any = {}; + message.delegator !== undefined && (obj.delegator = message.delegator); + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e ? DelegationForStakerResponse.toJSON(e) : undefined); + } else { + obj.stakers = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryStakersByDelegatorResponse { + const message = createBaseQueryStakersByDelegatorResponse(); + message.delegator = object.delegator ?? ""; + message.stakers = object.stakers?.map((e) => DelegationForStakerResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseDelegationForStakerResponse(): DelegationForStakerResponse { + return { staker: undefined, current_reward: "0", delegation_amount: "0" }; +} + +export const DelegationForStakerResponse = { + encode(message: DelegationForStakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== undefined) { + FullStaker.encode(message.staker, writer.uint32(10).fork()).ldelim(); + } + if (message.current_reward !== "0") { + writer.uint32(16).uint64(message.current_reward); + } + if (message.delegation_amount !== "0") { + writer.uint32(24).uint64(message.delegation_amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationForStakerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationForStakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = FullStaker.decode(reader, reader.uint32()); + break; + case 2: + message.current_reward = longToString(reader.uint64() as Long); + break; + case 3: + message.delegation_amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationForStakerResponse { + return { + staker: isSet(object.staker) ? FullStaker.fromJSON(object.staker) : undefined, + current_reward: isSet(object.current_reward) ? String(object.current_reward) : "0", + delegation_amount: isSet(object.delegation_amount) ? String(object.delegation_amount) : "0", + }; + }, + + toJSON(message: DelegationForStakerResponse): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker ? FullStaker.toJSON(message.staker) : undefined); + message.current_reward !== undefined && (obj.current_reward = message.current_reward); + message.delegation_amount !== undefined && (obj.delegation_amount = message.delegation_amount); + return obj; + }, + + fromPartial, I>>(object: I): DelegationForStakerResponse { + const message = createBaseDelegationForStakerResponse(); + message.staker = (object.staker !== undefined && object.staker !== null) + ? FullStaker.fromPartial(object.staker) + : undefined; + message.current_reward = object.current_reward ?? "0"; + message.delegation_amount = object.delegation_amount ?? "0"; + return message; + }, +}; + +/** QueryDelegation contains all rpc requests related to direct delegation data */ +export interface QueryDelegation { + /** Delegator returns delegation information for a specific delegator of a specific staker. */ + Delegator(request: QueryDelegatorRequest): Promise; + /** + * DelegatorsByStaker returns all delegators that have delegated to the given staker + * This query is paginated. + */ + DelegatorsByStaker(request: QueryDelegatorsByStakerRequest): Promise; + /** + * StakersByPoolAndDelegator returns all stakers the given delegator has delegated to. + * This query is paginated. + */ + StakersByDelegator(request: QueryStakersByDelegatorRequest): Promise; +} + +export class QueryDelegationClientImpl implements QueryDelegation { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryDelegation"; + this.rpc = rpc; + this.Delegator = this.Delegator.bind(this); + this.DelegatorsByStaker = this.DelegatorsByStaker.bind(this); + this.StakersByDelegator = this.StakersByDelegator.bind(this); + } + Delegator(request: QueryDelegatorRequest): Promise { + const data = QueryDelegatorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Delegator", data); + return promise.then((data) => QueryDelegatorResponse.decode(new _m0.Reader(data))); + } + + DelegatorsByStaker(request: QueryDelegatorsByStakerRequest): Promise { + const data = QueryDelegatorsByStakerRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DelegatorsByStaker", data); + return promise.then((data) => QueryDelegatorsByStakerResponse.decode(new _m0.Reader(data))); + } + + StakersByDelegator(request: QueryStakersByDelegatorRequest): Promise { + const data = QueryStakersByDelegatorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "StakersByDelegator", data); + return promise.then((data) => QueryStakersByDelegatorResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/query/v1beta1/params.ts b/common/types/src/lcd/kyve/query/v1beta1/params.ts new file mode 100644 index 00000000..86e71a3a --- /dev/null +++ b/common/types/src/lcd/kyve/query/v1beta1/params.ts @@ -0,0 +1,212 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { QueryParamsResponse as QueryParamsResponse3 } from "../../../cosmos/gov/v1/query"; +import { Params } from "../../bundles/v1beta1/params"; +import { Params as Params1 } from "../../delegation/v1beta1/params"; +import { Params as Params2 } from "../../fees/v1beta1/fees"; +import { Params as Params4 } from "../../stakers/v1beta1/params"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** QueryParamsRequest ... */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse ... */ +export interface QueryParamsResponse { + /** bundles_params ... */ + bundles_params?: Params; + /** delegation_params ... */ + delegation_params?: Params1; + /** fees_params ... */ + fees_params?: Params2; + /** gov_params ... */ + gov_params?: QueryParamsResponse3; + /** stakers_params ... */ + stakers_params?: Params4; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + bundles_params: undefined, + delegation_params: undefined, + fees_params: undefined, + gov_params: undefined, + stakers_params: undefined, + }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bundles_params !== undefined) { + Params.encode(message.bundles_params, writer.uint32(10).fork()).ldelim(); + } + if (message.delegation_params !== undefined) { + Params1.encode(message.delegation_params, writer.uint32(18).fork()).ldelim(); + } + if (message.fees_params !== undefined) { + Params2.encode(message.fees_params, writer.uint32(26).fork()).ldelim(); + } + if (message.gov_params !== undefined) { + QueryParamsResponse3.encode(message.gov_params, writer.uint32(34).fork()).ldelim(); + } + if (message.stakers_params !== undefined) { + Params4.encode(message.stakers_params, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.bundles_params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.delegation_params = Params1.decode(reader, reader.uint32()); + break; + case 3: + message.fees_params = Params2.decode(reader, reader.uint32()); + break; + case 4: + message.gov_params = QueryParamsResponse3.decode(reader, reader.uint32()); + break; + case 5: + message.stakers_params = Params4.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + bundles_params: isSet(object.bundles_params) ? Params.fromJSON(object.bundles_params) : undefined, + delegation_params: isSet(object.delegation_params) ? Params1.fromJSON(object.delegation_params) : undefined, + fees_params: isSet(object.fees_params) ? Params2.fromJSON(object.fees_params) : undefined, + gov_params: isSet(object.gov_params) ? QueryParamsResponse3.fromJSON(object.gov_params) : undefined, + stakers_params: isSet(object.stakers_params) ? Params4.fromJSON(object.stakers_params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.bundles_params !== undefined && + (obj.bundles_params = message.bundles_params ? Params.toJSON(message.bundles_params) : undefined); + message.delegation_params !== undefined && + (obj.delegation_params = message.delegation_params ? Params1.toJSON(message.delegation_params) : undefined); + message.fees_params !== undefined && + (obj.fees_params = message.fees_params ? Params2.toJSON(message.fees_params) : undefined); + message.gov_params !== undefined && + (obj.gov_params = message.gov_params ? QueryParamsResponse3.toJSON(message.gov_params) : undefined); + message.stakers_params !== undefined && + (obj.stakers_params = message.stakers_params ? Params4.toJSON(message.stakers_params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.bundles_params = (object.bundles_params !== undefined && object.bundles_params !== null) + ? Params.fromPartial(object.bundles_params) + : undefined; + message.delegation_params = (object.delegation_params !== undefined && object.delegation_params !== null) + ? Params1.fromPartial(object.delegation_params) + : undefined; + message.fees_params = (object.fees_params !== undefined && object.fees_params !== null) + ? Params2.fromPartial(object.fees_params) + : undefined; + message.gov_params = (object.gov_params !== undefined && object.gov_params !== null) + ? QueryParamsResponse3.fromPartial(object.gov_params) + : undefined; + message.stakers_params = (object.stakers_params !== undefined && object.stakers_params !== null) + ? Params4.fromPartial(object.stakers_params) + : undefined; + return message; + }, +}; + +/** QueryPool ... */ +export interface QueryParams { + /** Pools queries for all pools. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryParamsClientImpl implements QueryParams { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryParams"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/query/v1beta1/pools.ts b/common/types/src/lcd/kyve/query/v1beta1/pools.ts new file mode 100644 index 00000000..aff95516 --- /dev/null +++ b/common/types/src/lcd/kyve/query/v1beta1/pools.ts @@ -0,0 +1,485 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { BundleProposal } from "../../bundles/v1beta1/bundles"; +import { Pool, PoolStatus, poolStatusFromJSON, poolStatusToJSON, poolStatusToNumber } from "../../pool/v1beta1/pool"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** QueryPoolsRequest is the request type for the Query/Pools RPC method. */ +export interface QueryPoolsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** search ... */ + search: string; + /** runtime ... */ + runtime: string; + /** paused ... */ + paused: boolean; + /** storage_provider_id ... */ + storage_provider_id: number; +} + +/** QueryPoolsResponse is the response type for the Query/Pools RPC method. */ +export interface QueryPoolsResponse { + /** pools ... */ + pools: PoolResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** PoolResponse ... */ +export interface PoolResponse { + /** id ... */ + id: string; + /** data ... */ + data?: Pool; + /** bundle_proposal ... */ + bundle_proposal?: BundleProposal; + /** stakers ... */ + stakers: string[]; + /** total_stake ... */ + total_self_delegation: string; + /** total_delegation ... */ + total_delegation: string; + /** status ... */ + status: PoolStatus; +} + +/** QueryPoolRequest is the request type for the Query/Pool RPC method. */ +export interface QueryPoolRequest { + /** id defines the unique ID of the pool. */ + id: string; +} + +/** QueryPoolResponse is the response type for the Query/Pool RPC method. */ +export interface QueryPoolResponse { + /** pool ... */ + pool?: PoolResponse; +} + +function createBaseQueryPoolsRequest(): QueryPoolsRequest { + return { pagination: undefined, search: "", runtime: "", paused: false, storage_provider_id: 0 }; +} + +export const QueryPoolsRequest = { + encode(message: QueryPoolsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.search !== "") { + writer.uint32(18).string(message.search); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.paused === true) { + writer.uint32(32).bool(message.paused); + } + if (message.storage_provider_id !== 0) { + writer.uint32(40).uint32(message.storage_provider_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.search = reader.string(); + break; + case 3: + message.runtime = reader.string(); + break; + case 4: + message.paused = reader.bool(); + break; + case 5: + message.storage_provider_id = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryPoolsRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + search: isSet(object.search) ? String(object.search) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + paused: isSet(object.paused) ? Boolean(object.paused) : false, + storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + }; + }, + + toJSON(message: QueryPoolsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.search !== undefined && (obj.search = message.search); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.paused !== undefined && (obj.paused = message.paused); + message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + return obj; + }, + + fromPartial, I>>(object: I): QueryPoolsRequest { + const message = createBaseQueryPoolsRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.search = object.search ?? ""; + message.runtime = object.runtime ?? ""; + message.paused = object.paused ?? false; + message.storage_provider_id = object.storage_provider_id ?? 0; + return message; + }, +}; + +function createBaseQueryPoolsResponse(): QueryPoolsResponse { + return { pools: [], pagination: undefined }; +} + +export const QueryPoolsResponse = { + encode(message: QueryPoolsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pools) { + PoolResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pools.push(PoolResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryPoolsResponse { + return { + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => PoolResponse.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryPoolsResponse): unknown { + const obj: any = {}; + if (message.pools) { + obj.pools = message.pools.map((e) => e ? PoolResponse.toJSON(e) : undefined); + } else { + obj.pools = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryPoolsResponse { + const message = createBaseQueryPoolsResponse(); + message.pools = object.pools?.map((e) => PoolResponse.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBasePoolResponse(): PoolResponse { + return { + id: "0", + data: undefined, + bundle_proposal: undefined, + stakers: [], + total_self_delegation: "0", + total_delegation: "0", + status: PoolStatus.POOL_STATUS_UNSPECIFIED, + }; +} + +export const PoolResponse = { + encode(message: PoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.data !== undefined) { + Pool.encode(message.data, writer.uint32(18).fork()).ldelim(); + } + if (message.bundle_proposal !== undefined) { + BundleProposal.encode(message.bundle_proposal, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.stakers) { + writer.uint32(34).string(v!); + } + if (message.total_self_delegation !== "0") { + writer.uint32(40).uint64(message.total_self_delegation); + } + if (message.total_delegation !== "0") { + writer.uint32(48).uint64(message.total_delegation); + } + if (message.status !== PoolStatus.POOL_STATUS_UNSPECIFIED) { + writer.uint32(56).int32(poolStatusToNumber(message.status)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.data = Pool.decode(reader, reader.uint32()); + break; + case 3: + message.bundle_proposal = BundleProposal.decode(reader, reader.uint32()); + break; + case 4: + message.stakers.push(reader.string()); + break; + case 5: + message.total_self_delegation = longToString(reader.uint64() as Long); + break; + case 6: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 7: + message.status = poolStatusFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PoolResponse { + return { + id: isSet(object.id) ? String(object.id) : "0", + data: isSet(object.data) ? Pool.fromJSON(object.data) : undefined, + bundle_proposal: isSet(object.bundle_proposal) ? BundleProposal.fromJSON(object.bundle_proposal) : undefined, + stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => String(e)) : [], + total_self_delegation: isSet(object.total_self_delegation) ? String(object.total_self_delegation) : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + status: isSet(object.status) ? poolStatusFromJSON(object.status) : PoolStatus.POOL_STATUS_UNSPECIFIED, + }; + }, + + toJSON(message: PoolResponse): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.data !== undefined && (obj.data = message.data ? Pool.toJSON(message.data) : undefined); + message.bundle_proposal !== undefined && + (obj.bundle_proposal = message.bundle_proposal ? BundleProposal.toJSON(message.bundle_proposal) : undefined); + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e); + } else { + obj.stakers = []; + } + message.total_self_delegation !== undefined && (obj.total_self_delegation = message.total_self_delegation); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.status !== undefined && (obj.status = poolStatusToJSON(message.status)); + return obj; + }, + + fromPartial, I>>(object: I): PoolResponse { + const message = createBasePoolResponse(); + message.id = object.id ?? "0"; + message.data = (object.data !== undefined && object.data !== null) ? Pool.fromPartial(object.data) : undefined; + message.bundle_proposal = (object.bundle_proposal !== undefined && object.bundle_proposal !== null) + ? BundleProposal.fromPartial(object.bundle_proposal) + : undefined; + message.stakers = object.stakers?.map((e) => e) || []; + message.total_self_delegation = object.total_self_delegation ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.status = object.status ?? PoolStatus.POOL_STATUS_UNSPECIFIED; + return message; + }, +}; + +function createBaseQueryPoolRequest(): QueryPoolRequest { + return { id: "0" }; +} + +export const QueryPoolRequest = { + encode(message: QueryPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryPoolRequest { + return { id: isSet(object.id) ? String(object.id) : "0" }; + }, + + toJSON(message: QueryPoolRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { pool: undefined }; +} + +export const QueryPoolResponse = { + encode(message: QueryPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool !== undefined) { + PoolResponse.encode(message.pool, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = PoolResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryPoolResponse { + return { pool: isSet(object.pool) ? PoolResponse.fromJSON(object.pool) : undefined }; + }, + + toJSON(message: QueryPoolResponse): unknown { + const obj: any = {}; + message.pool !== undefined && (obj.pool = message.pool ? PoolResponse.toJSON(message.pool) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryPoolResponse { + const message = createBaseQueryPoolResponse(); + message.pool = (object.pool !== undefined && object.pool !== null) + ? PoolResponse.fromPartial(object.pool) + : undefined; + return message; + }, +}; + +/** QueryPool ... */ +export interface QueryPool { + /** Pools queries for all pools. */ + Pools(request: QueryPoolsRequest): Promise; + /** Pool queries a pool by its Id. */ + Pool(request: QueryPoolRequest): Promise; +} + +export class QueryPoolClientImpl implements QueryPool { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryPool"; + this.rpc = rpc; + this.Pools = this.Pools.bind(this); + this.Pool = this.Pool.bind(this); + } + Pools(request: QueryPoolsRequest): Promise { + const data = QueryPoolsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pools", data); + return promise.then((data) => QueryPoolsResponse.decode(new _m0.Reader(data))); + } + + Pool(request: QueryPoolRequest): Promise { + const data = QueryPoolRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Pool", data); + return promise.then((data) => QueryPoolResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/query/v1beta1/query.ts b/common/types/src/lcd/kyve/query/v1beta1/query.ts new file mode 100644 index 00000000..b1543969 --- /dev/null +++ b/common/types/src/lcd/kyve/query/v1beta1/query.ts @@ -0,0 +1,668 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PoolStatus, poolStatusFromJSON, poolStatusToJSON, poolStatusToNumber } from "../../pool/v1beta1/pool"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** + * BasicPool contains the necessary properties need for a pool + * to be displayed in the UI + */ +export interface BasicPool { + /** id is the ID of the pool */ + id: string; + /** name of the pool */ + name: string; + /** + * runtime for the protocol nodes + * like evm, bitcoin, etc. + */ + runtime: string; + /** logo of the pool */ + logo: string; + /** operating_cost is the base payout for each bundle reward */ + operating_cost: string; + /** upload_interval is the interval bundles get created */ + upload_interval: string; + /** + * total_funds of the pool. If the pool runs + * out of funds no more bundles will be produced + */ + total_funds: string; + /** total_delegation of the pool */ + total_delegation: string; + /** + * status of the pool if pool is able + * to produce bundles, etc. + */ + status: PoolStatus; +} + +/** + * FullStaker aggregates information from the staker and its delegators + * as well as pending queue entries into one object. + * It contains almost all needed information for a convenient usage + */ +export interface FullStaker { + /** address of the staker */ + address: string; + /** metadata as logo, moniker, etc. */ + metadata?: StakerMetadata; + /** amount the staker has delegated to himself */ + self_delegation: string; + /** + * unbonding_amount is the amount the staker is currently unbonding + * from the self-delegation. + * This amount can be larger than `amount` when the staker + * got slashed during unbonding. However, at the end of + * the unbonding period this amount is double checked with the + * remaining amount. + */ + self_delegation_unbonding: string; + /** + * total_delegation returns the sum of all $KYVE users + * have delegated to this staker + */ + total_delegation: string; + /** + * delegator_count is the total number of individual + * delegator addresses for that user. + */ + delegator_count: string; + /** + * pools is a list of all pools the staker is currently + * participating, i.e. allowed to vote and upload data. + */ + pools: PoolMembership[]; +} + +/** StakerMetadata contains static information for a staker */ +export interface StakerMetadata { + /** + * commission is the percentage of the rewards that will + * get transferred to the staker before the remaining + * rewards are split across all delegators + */ + commission: string; + /** + * moniker is a human-readable name for displaying + * the staker in the UI + */ + moniker: string; + /** website is a https-link to the website of the staker */ + website: string; + /** logo is a link to an image file (like jpg or png) */ + logo: string; + /** + * pending_commission_change shows if the staker plans + * to change its commission. Delegators will see a warning in + * the UI. A Commission change takes some time until + * the commission is applied. Users have time to redelegate + * if they not agree with the new commission. + */ + pending_commission_change?: CommissionChangeEntry; +} + +/** + * CommissionChangeEntry shows when the old commission + * of a staker will change to the new commission + */ +export interface CommissionChangeEntry { + /** + * commission is the new commission that will + * become active once the change-time is over + */ + commission: string; + /** + * creation_date is the UNIX-timestamp (in seconds) + * of when the entry was created. + */ + creation_date: string; +} + +/** + * PoolMembership shows in which pool the staker + * is participating + */ +export interface PoolMembership { + /** pool contains useful information about the pool */ + pool?: BasicPool; + /** + * points indicates if the staker is inactive + * If the staker misses a vote, a point is added. + * After 5 points the staker is removed from + * the stakers set. + */ + points: string; + /** + * is_leaving indicates if a user has scheduled a + * a PoolLeave entry. After the leave-time is over + * the staker will no longer participate in that pool + */ + is_leaving: boolean; + /** + * Valaddress is the address which is authorized to vote + * and submit bundles. If the server gets compromised + * the staker can just change the valaddress. + */ + valaddress: string; + /** + * balance is the valaddress account balance and indicates + * whether or not the valaccount needs additional funds to + * pay for gas fees + */ + balance: string; +} + +function createBaseBasicPool(): BasicPool { + return { + id: "0", + name: "", + runtime: "", + logo: "", + operating_cost: "0", + upload_interval: "0", + total_funds: "0", + total_delegation: "0", + status: PoolStatus.POOL_STATUS_UNSPECIFIED, + }; +} + +export const BasicPool = { + encode(message: BasicPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + if (message.operating_cost !== "0") { + writer.uint32(40).uint64(message.operating_cost); + } + if (message.upload_interval !== "0") { + writer.uint32(48).uint64(message.upload_interval); + } + if (message.total_funds !== "0") { + writer.uint32(56).uint64(message.total_funds); + } + if (message.total_delegation !== "0") { + writer.uint32(64).uint64(message.total_delegation); + } + if (message.status !== PoolStatus.POOL_STATUS_UNSPECIFIED) { + writer.uint32(72).int32(poolStatusToNumber(message.status)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BasicPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBasicPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.runtime = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + case 5: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 6: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 7: + message.total_funds = longToString(reader.uint64() as Long); + break; + case 8: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 9: + message.status = poolStatusFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BasicPool { + return { + id: isSet(object.id) ? String(object.id) : "0", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + total_funds: isSet(object.total_funds) ? String(object.total_funds) : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + status: isSet(object.status) ? poolStatusFromJSON(object.status) : PoolStatus.POOL_STATUS_UNSPECIFIED, + }; + }, + + toJSON(message: BasicPool): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.total_funds !== undefined && (obj.total_funds = message.total_funds); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.status !== undefined && (obj.status = poolStatusToJSON(message.status)); + return obj; + }, + + fromPartial, I>>(object: I): BasicPool { + const message = createBaseBasicPool(); + message.id = object.id ?? "0"; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.operating_cost = object.operating_cost ?? "0"; + message.upload_interval = object.upload_interval ?? "0"; + message.total_funds = object.total_funds ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.status = object.status ?? PoolStatus.POOL_STATUS_UNSPECIFIED; + return message; + }, +}; + +function createBaseFullStaker(): FullStaker { + return { + address: "", + metadata: undefined, + self_delegation: "0", + self_delegation_unbonding: "0", + total_delegation: "0", + delegator_count: "0", + pools: [], + }; +} + +export const FullStaker = { + encode(message: FullStaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.metadata !== undefined) { + StakerMetadata.encode(message.metadata, writer.uint32(18).fork()).ldelim(); + } + if (message.self_delegation !== "0") { + writer.uint32(24).uint64(message.self_delegation); + } + if (message.self_delegation_unbonding !== "0") { + writer.uint32(32).uint64(message.self_delegation_unbonding); + } + if (message.total_delegation !== "0") { + writer.uint32(40).uint64(message.total_delegation); + } + if (message.delegator_count !== "0") { + writer.uint32(48).uint64(message.delegator_count); + } + for (const v of message.pools) { + PoolMembership.encode(v!, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FullStaker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFullStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.metadata = StakerMetadata.decode(reader, reader.uint32()); + break; + case 3: + message.self_delegation = longToString(reader.uint64() as Long); + break; + case 4: + message.self_delegation_unbonding = longToString(reader.uint64() as Long); + break; + case 5: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 6: + message.delegator_count = longToString(reader.uint64() as Long); + break; + case 7: + message.pools.push(PoolMembership.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FullStaker { + return { + address: isSet(object.address) ? String(object.address) : "", + metadata: isSet(object.metadata) ? StakerMetadata.fromJSON(object.metadata) : undefined, + self_delegation: isSet(object.self_delegation) ? String(object.self_delegation) : "0", + self_delegation_unbonding: isSet(object.self_delegation_unbonding) + ? String(object.self_delegation_unbonding) + : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + delegator_count: isSet(object.delegator_count) ? String(object.delegator_count) : "0", + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => PoolMembership.fromJSON(e)) : [], + }; + }, + + toJSON(message: FullStaker): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.metadata !== undefined && + (obj.metadata = message.metadata ? StakerMetadata.toJSON(message.metadata) : undefined); + message.self_delegation !== undefined && (obj.self_delegation = message.self_delegation); + message.self_delegation_unbonding !== undefined && + (obj.self_delegation_unbonding = message.self_delegation_unbonding); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.delegator_count !== undefined && (obj.delegator_count = message.delegator_count); + if (message.pools) { + obj.pools = message.pools.map((e) => e ? PoolMembership.toJSON(e) : undefined); + } else { + obj.pools = []; + } + return obj; + }, + + fromPartial, I>>(object: I): FullStaker { + const message = createBaseFullStaker(); + message.address = object.address ?? ""; + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? StakerMetadata.fromPartial(object.metadata) + : undefined; + message.self_delegation = object.self_delegation ?? "0"; + message.self_delegation_unbonding = object.self_delegation_unbonding ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.delegator_count = object.delegator_count ?? "0"; + message.pools = object.pools?.map((e) => PoolMembership.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStakerMetadata(): StakerMetadata { + return { commission: "", moniker: "", website: "", logo: "", pending_commission_change: undefined }; +} + +export const StakerMetadata = { + encode(message: StakerMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.commission !== "") { + writer.uint32(10).string(message.commission); + } + if (message.moniker !== "") { + writer.uint32(18).string(message.moniker); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + if (message.pending_commission_change !== undefined) { + CommissionChangeEntry.encode(message.pending_commission_change, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakerMetadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakerMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission = reader.string(); + break; + case 2: + message.moniker = reader.string(); + break; + case 3: + message.website = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + case 5: + message.pending_commission_change = CommissionChangeEntry.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StakerMetadata { + return { + commission: isSet(object.commission) ? String(object.commission) : "", + moniker: isSet(object.moniker) ? String(object.moniker) : "", + website: isSet(object.website) ? String(object.website) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + pending_commission_change: isSet(object.pending_commission_change) + ? CommissionChangeEntry.fromJSON(object.pending_commission_change) + : undefined, + }; + }, + + toJSON(message: StakerMetadata): unknown { + const obj: any = {}; + message.commission !== undefined && (obj.commission = message.commission); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.website !== undefined && (obj.website = message.website); + message.logo !== undefined && (obj.logo = message.logo); + message.pending_commission_change !== undefined && + (obj.pending_commission_change = message.pending_commission_change + ? CommissionChangeEntry.toJSON(message.pending_commission_change) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): StakerMetadata { + const message = createBaseStakerMetadata(); + message.commission = object.commission ?? ""; + message.moniker = object.moniker ?? ""; + message.website = object.website ?? ""; + message.logo = object.logo ?? ""; + message.pending_commission_change = + (object.pending_commission_change !== undefined && object.pending_commission_change !== null) + ? CommissionChangeEntry.fromPartial(object.pending_commission_change) + : undefined; + return message; + }, +}; + +function createBaseCommissionChangeEntry(): CommissionChangeEntry { + return { commission: "", creation_date: "0" }; +} + +export const CommissionChangeEntry = { + encode(message: CommissionChangeEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.commission !== "") { + writer.uint32(10).string(message.commission); + } + if (message.creation_date !== "0") { + writer.uint32(16).int64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionChangeEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission = reader.string(); + break; + case 2: + message.creation_date = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommissionChangeEntry { + return { + commission: isSet(object.commission) ? String(object.commission) : "", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: CommissionChangeEntry): unknown { + const obj: any = {}; + message.commission !== undefined && (obj.commission = message.commission); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): CommissionChangeEntry { + const message = createBaseCommissionChangeEntry(); + message.commission = object.commission ?? ""; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +function createBasePoolMembership(): PoolMembership { + return { pool: undefined, points: "0", is_leaving: false, valaddress: "", balance: "0" }; +} + +export const PoolMembership = { + encode(message: PoolMembership, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool !== undefined) { + BasicPool.encode(message.pool, writer.uint32(10).fork()).ldelim(); + } + if (message.points !== "0") { + writer.uint32(16).uint64(message.points); + } + if (message.is_leaving === true) { + writer.uint32(24).bool(message.is_leaving); + } + if (message.valaddress !== "") { + writer.uint32(34).string(message.valaddress); + } + if (message.balance !== "0") { + writer.uint32(40).uint64(message.balance); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PoolMembership { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePoolMembership(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool = BasicPool.decode(reader, reader.uint32()); + break; + case 2: + message.points = longToString(reader.uint64() as Long); + break; + case 3: + message.is_leaving = reader.bool(); + break; + case 4: + message.valaddress = reader.string(); + break; + case 5: + message.balance = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PoolMembership { + return { + pool: isSet(object.pool) ? BasicPool.fromJSON(object.pool) : undefined, + points: isSet(object.points) ? String(object.points) : "0", + is_leaving: isSet(object.is_leaving) ? Boolean(object.is_leaving) : false, + valaddress: isSet(object.valaddress) ? String(object.valaddress) : "", + balance: isSet(object.balance) ? String(object.balance) : "0", + }; + }, + + toJSON(message: PoolMembership): unknown { + const obj: any = {}; + message.pool !== undefined && (obj.pool = message.pool ? BasicPool.toJSON(message.pool) : undefined); + message.points !== undefined && (obj.points = message.points); + message.is_leaving !== undefined && (obj.is_leaving = message.is_leaving); + message.valaddress !== undefined && (obj.valaddress = message.valaddress); + message.balance !== undefined && (obj.balance = message.balance); + return obj; + }, + + fromPartial, I>>(object: I): PoolMembership { + const message = createBasePoolMembership(); + message.pool = (object.pool !== undefined && object.pool !== null) ? BasicPool.fromPartial(object.pool) : undefined; + message.points = object.points ?? "0"; + message.is_leaving = object.is_leaving ?? false; + message.valaddress = object.valaddress ?? ""; + message.balance = object.balance ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/query/v1beta1/stakers.ts b/common/types/src/lcd/kyve/query/v1beta1/stakers.ts new file mode 100644 index 00000000..c123c10f --- /dev/null +++ b/common/types/src/lcd/kyve/query/v1beta1/stakers.ts @@ -0,0 +1,721 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Valaccount } from "../../stakers/v1beta1/stakers"; +import { FullStaker } from "./query"; + +export const protobufPackage = "kyve.query.v1beta1"; + +/** StakerStatus ... */ +export enum StakerStatus { + /** STAKER_STATUS_UNSPECIFIED - STAKER_STATUS_UNSPECIFIED ... */ + STAKER_STATUS_UNSPECIFIED = "STAKER_STATUS_UNSPECIFIED", + /** STAKER_STATUS_ACTIVE - STAKER_STATUS_ACTIVE ... */ + STAKER_STATUS_ACTIVE = "STAKER_STATUS_ACTIVE", + /** STAKER_STATUS_INACTIVE - STAKER_STATUS_INACTIVE ... */ + STAKER_STATUS_INACTIVE = "STAKER_STATUS_INACTIVE", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function stakerStatusFromJSON(object: any): StakerStatus { + switch (object) { + case 0: + case "STAKER_STATUS_UNSPECIFIED": + return StakerStatus.STAKER_STATUS_UNSPECIFIED; + case 1: + case "STAKER_STATUS_ACTIVE": + return StakerStatus.STAKER_STATUS_ACTIVE; + case 2: + case "STAKER_STATUS_INACTIVE": + return StakerStatus.STAKER_STATUS_INACTIVE; + case -1: + case "UNRECOGNIZED": + default: + return StakerStatus.UNRECOGNIZED; + } +} + +export function stakerStatusToJSON(object: StakerStatus): string { + switch (object) { + case StakerStatus.STAKER_STATUS_UNSPECIFIED: + return "STAKER_STATUS_UNSPECIFIED"; + case StakerStatus.STAKER_STATUS_ACTIVE: + return "STAKER_STATUS_ACTIVE"; + case StakerStatus.STAKER_STATUS_INACTIVE: + return "STAKER_STATUS_INACTIVE"; + case StakerStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function stakerStatusToNumber(object: StakerStatus): number { + switch (object) { + case StakerStatus.STAKER_STATUS_UNSPECIFIED: + return 0; + case StakerStatus.STAKER_STATUS_ACTIVE: + return 1; + case StakerStatus.STAKER_STATUS_INACTIVE: + return 2; + case StakerStatus.UNRECOGNIZED: + default: + return -1; + } +} + +/** QueryStakersRequest is the request type for the Query/Stakers RPC method. */ +export interface QueryStakersRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** status looks whether a staker is participating in pools or not */ + status: StakerStatus; + /** search searches for moniker OR address */ + search: string; +} + +/** QueryStakersResponse is the response type for the Query/Stakers RPC method. */ +export interface QueryStakersResponse { + /** stakers ... */ + stakers: FullStaker[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +/** QueryStakerRequest is the request type for the Query/Staker RPC method. */ +export interface QueryStakerRequest { + /** address ... */ + address: string; +} + +/** QueryStakerResponse is the response type for the Query/Staker RPC method. */ +export interface QueryStakerResponse { + /** staker ... */ + staker?: FullStaker; +} + +/** QueryStakersByPoolRequest is the request type for the Query/Staker RPC method. */ +export interface QueryStakersByPoolRequest { + /** pool_id ... */ + pool_id: string; +} + +/** QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. */ +export interface QueryStakersByPoolResponse { + /** stakers ... */ + stakers: StakerPoolResponse[]; +} + +/** StakerPoolResponse ... */ +export interface StakerPoolResponse { + /** staker ... */ + staker?: FullStaker; + /** valaccount ... */ + valaccount?: Valaccount; +} + +/** QueryStakersByPoolCountRequest ... */ +export interface QueryStakersByPoolCountRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +/** QueryStakersByPoolCountResponse ... */ +export interface QueryStakersByPoolCountResponse { + /** stakers ... */ + stakers: FullStaker[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +function createBaseQueryStakersRequest(): QueryStakersRequest { + return { pagination: undefined, status: StakerStatus.STAKER_STATUS_UNSPECIFIED, search: "" }; +} + +export const QueryStakersRequest = { + encode(message: QueryStakersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.status !== StakerStatus.STAKER_STATUS_UNSPECIFIED) { + writer.uint32(16).int32(stakerStatusToNumber(message.status)); + } + if (message.search !== "") { + writer.uint32(26).string(message.search); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 2: + message.status = stakerStatusFromJSON(reader.int32()); + break; + case 3: + message.search = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersRequest { + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + status: isSet(object.status) ? stakerStatusFromJSON(object.status) : StakerStatus.STAKER_STATUS_UNSPECIFIED, + search: isSet(object.search) ? String(object.search) : "", + }; + }, + + toJSON(message: QueryStakersRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.status !== undefined && (obj.status = stakerStatusToJSON(message.status)); + message.search !== undefined && (obj.search = message.search); + return obj; + }, + + fromPartial, I>>(object: I): QueryStakersRequest { + const message = createBaseQueryStakersRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.status = object.status ?? StakerStatus.STAKER_STATUS_UNSPECIFIED; + message.search = object.search ?? ""; + return message; + }, +}; + +function createBaseQueryStakersResponse(): QueryStakersResponse { + return { stakers: [], pagination: undefined }; +} + +export const QueryStakersResponse = { + encode(message: QueryStakersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.stakers) { + FullStaker.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.stakers.push(FullStaker.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersResponse { + return { + stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => FullStaker.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryStakersResponse): unknown { + const obj: any = {}; + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e ? FullStaker.toJSON(e) : undefined); + } else { + obj.stakers = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryStakersResponse { + const message = createBaseQueryStakersResponse(); + message.stakers = object.stakers?.map((e) => FullStaker.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryStakerRequest(): QueryStakerRequest { + return { address: "" }; +} + +export const QueryStakerRequest = { + encode(message: QueryStakerRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakerRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakerRequest(); + 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; + }, + + fromJSON(object: any): QueryStakerRequest { + return { address: isSet(object.address) ? String(object.address) : "" }; + }, + + toJSON(message: QueryStakerRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + + fromPartial, I>>(object: I): QueryStakerRequest { + const message = createBaseQueryStakerRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +function createBaseQueryStakerResponse(): QueryStakerResponse { + return { staker: undefined }; +} + +export const QueryStakerResponse = { + encode(message: QueryStakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== undefined) { + FullStaker.encode(message.staker, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = FullStaker.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakerResponse { + return { staker: isSet(object.staker) ? FullStaker.fromJSON(object.staker) : undefined }; + }, + + toJSON(message: QueryStakerResponse): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker ? FullStaker.toJSON(message.staker) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryStakerResponse { + const message = createBaseQueryStakerResponse(); + message.staker = (object.staker !== undefined && object.staker !== null) + ? FullStaker.fromPartial(object.staker) + : undefined; + return message; + }, +}; + +function createBaseQueryStakersByPoolRequest(): QueryStakersByPoolRequest { + return { pool_id: "0" }; +} + +export const QueryStakersByPoolRequest = { + encode(message: QueryStakersByPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersByPoolRequest { + return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + }, + + toJSON(message: QueryStakersByPoolRequest): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>(object: I): QueryStakersByPoolRequest { + const message = createBaseQueryStakersByPoolRequest(); + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +function createBaseQueryStakersByPoolResponse(): QueryStakersByPoolResponse { + return { stakers: [] }; +} + +export const QueryStakersByPoolResponse = { + encode(message: QueryStakersByPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.stakers) { + StakerPoolResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.stakers.push(StakerPoolResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersByPoolResponse { + return { + stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => StakerPoolResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryStakersByPoolResponse): unknown { + const obj: any = {}; + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e ? StakerPoolResponse.toJSON(e) : undefined); + } else { + obj.stakers = []; + } + return obj; + }, + + fromPartial, I>>(object: I): QueryStakersByPoolResponse { + const message = createBaseQueryStakersByPoolResponse(); + message.stakers = object.stakers?.map((e) => StakerPoolResponse.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStakerPoolResponse(): StakerPoolResponse { + return { staker: undefined, valaccount: undefined }; +} + +export const StakerPoolResponse = { + encode(message: StakerPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== undefined) { + FullStaker.encode(message.staker, writer.uint32(10).fork()).ldelim(); + } + if (message.valaccount !== undefined) { + Valaccount.encode(message.valaccount, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakerPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakerPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = FullStaker.decode(reader, reader.uint32()); + break; + case 2: + message.valaccount = Valaccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StakerPoolResponse { + return { + staker: isSet(object.staker) ? FullStaker.fromJSON(object.staker) : undefined, + valaccount: isSet(object.valaccount) ? Valaccount.fromJSON(object.valaccount) : undefined, + }; + }, + + toJSON(message: StakerPoolResponse): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker ? FullStaker.toJSON(message.staker) : undefined); + message.valaccount !== undefined && + (obj.valaccount = message.valaccount ? Valaccount.toJSON(message.valaccount) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): StakerPoolResponse { + const message = createBaseStakerPoolResponse(); + message.staker = (object.staker !== undefined && object.staker !== null) + ? FullStaker.fromPartial(object.staker) + : undefined; + message.valaccount = (object.valaccount !== undefined && object.valaccount !== null) + ? Valaccount.fromPartial(object.valaccount) + : undefined; + return message; + }, +}; + +function createBaseQueryStakersByPoolCountRequest(): QueryStakersByPoolCountRequest { + return { pagination: undefined }; +} + +export const QueryStakersByPoolCountRequest = { + encode(message: QueryStakersByPoolCountRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolCountRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByPoolCountRequest(); + 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; + }, + + fromJSON(object: any): QueryStakersByPoolCountRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryStakersByPoolCountRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryStakersByPoolCountRequest { + const message = createBaseQueryStakersByPoolCountRequest(); + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +function createBaseQueryStakersByPoolCountResponse(): QueryStakersByPoolCountResponse { + return { stakers: [], pagination: undefined }; +} + +export const QueryStakersByPoolCountResponse = { + encode(message: QueryStakersByPoolCountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.stakers) { + FullStaker.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolCountResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakersByPoolCountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.stakers.push(FullStaker.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryStakersByPoolCountResponse { + return { + stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => FullStaker.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryStakersByPoolCountResponse): unknown { + const obj: any = {}; + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e ? FullStaker.toJSON(e) : undefined); + } else { + obj.stakers = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I, + ): QueryStakersByPoolCountResponse { + const message = createBaseQueryStakersByPoolCountResponse(); + message.stakers = object.stakers?.map((e) => FullStaker.fromPartial(e)) || []; + message.pagination = (object.pagination !== undefined && object.pagination !== null) + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +/** QueryStakers ... */ +export interface QueryStakers { + /** Stakers queries for all stakers. */ + Stakers(request: QueryStakersRequest): Promise; + /** Staker queries for all stakers. */ + Staker(request: QueryStakerRequest): Promise; + /** StakersByPool queries for all stakers that are currently participating in the given pool */ + StakersByPool(request: QueryStakersByPoolRequest): Promise; + /** + * StakersByPool queries for all stakers and sorted them first by number of pools participating and + * then by delegation + */ + StakersByPoolCount(request: QueryStakersByPoolCountRequest): Promise; +} + +export class QueryStakersClientImpl implements QueryStakers { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.query.v1beta1.QueryStakers"; + this.rpc = rpc; + this.Stakers = this.Stakers.bind(this); + this.Staker = this.Staker.bind(this); + this.StakersByPool = this.StakersByPool.bind(this); + this.StakersByPoolCount = this.StakersByPoolCount.bind(this); + } + Stakers(request: QueryStakersRequest): Promise { + const data = QueryStakersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Stakers", data); + return promise.then((data) => QueryStakersResponse.decode(new _m0.Reader(data))); + } + + Staker(request: QueryStakerRequest): Promise { + const data = QueryStakerRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Staker", data); + return promise.then((data) => QueryStakerResponse.decode(new _m0.Reader(data))); + } + + StakersByPool(request: QueryStakersByPoolRequest): Promise { + const data = QueryStakersByPoolRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "StakersByPool", data); + return promise.then((data) => QueryStakersByPoolResponse.decode(new _m0.Reader(data))); + } + + StakersByPoolCount(request: QueryStakersByPoolCountRequest): Promise { + const data = QueryStakersByPoolCountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "StakersByPoolCount", data); + return promise.then((data) => QueryStakersByPoolCountResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/registry/v1beta1/genesis.ts b/common/types/src/lcd/kyve/registry/v1beta1/genesis.ts new file mode 100644 index 00000000..aacc67a3 --- /dev/null +++ b/common/types/src/lcd/kyve/registry/v1beta1/genesis.ts @@ -0,0 +1,394 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { + CommissionChangeQueueEntry, + CommissionChangeQueueState, + DelegationEntries, + DelegationPoolData, + Delegator, + Funder, + Pool, + Proposal, + RedelegationCooldown, + Staker, + UnbondingDelegationQueueEntry, + UnbondingDelegationQueueState, + UnbondingStaker, + UnbondingStakingQueueEntry, + UnbondingStakingQueueState, +} from "./registry"; + +export const protobufPackage = "kyve.registry.v1beta1"; + +/** GenesisState defines the registry module's genesis state. */ +export interface GenesisState { + /** pool_list ... */ + pool_list: Pool[]; + /** pool_count ... */ + pool_count: string; + /** funder_list ... */ + funder_list: Funder[]; + /** staker_list ... */ + staker_list: Staker[]; + /** commission_change_queue_state ... */ + commission_change_queue_state?: CommissionChangeQueueState; + /** commission_change_queue_entry ... */ + commission_change_queue_entry: CommissionChangeQueueEntry[]; + /** unbonding_staker_list ... */ + unbonding_staker_list: UnbondingStaker[]; + /** unbonding_staking_queue_state ... */ + unbonding_staking_queue_state?: UnbondingStakingQueueState; + /** unbonding_staking_queue_entries ... */ + unbonding_staking_queue_entries: UnbondingStakingQueueEntry[]; + /** delegator_list ... */ + delegator_list: Delegator[]; + /** delegation_pool_data_list ... */ + delegation_pool_data_list: DelegationPoolData[]; + /** delegation_entries_list ... */ + delegation_entries_list: DelegationEntries[]; + /** proposal_list ... */ + proposal_list: Proposal[]; + /** unbonding_delegation_queue_state ... */ + unbonding_delegation_queue_state?: UnbondingDelegationQueueState; + /** unbonding_delegation_queue_entries ... */ + unbonding_delegation_queue_entries: UnbondingDelegationQueueEntry[]; + /** redelegation_cooldown_list ... */ + redelegation_cooldown_list: RedelegationCooldown[]; +} + +function createBaseGenesisState(): GenesisState { + return { + pool_list: [], + pool_count: "0", + funder_list: [], + staker_list: [], + commission_change_queue_state: undefined, + commission_change_queue_entry: [], + unbonding_staker_list: [], + unbonding_staking_queue_state: undefined, + unbonding_staking_queue_entries: [], + delegator_list: [], + delegation_pool_data_list: [], + delegation_entries_list: [], + proposal_list: [], + unbonding_delegation_queue_state: undefined, + unbonding_delegation_queue_entries: [], + redelegation_cooldown_list: [], + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pool_list) { + Pool.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pool_count !== "0") { + writer.uint32(24).uint64(message.pool_count); + } + for (const v of message.funder_list) { + Funder.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.staker_list) { + Staker.encode(v!, writer.uint32(42).fork()).ldelim(); + } + if (message.commission_change_queue_state !== undefined) { + CommissionChangeQueueState.encode(message.commission_change_queue_state, writer.uint32(130).fork()).ldelim(); + } + for (const v of message.commission_change_queue_entry) { + CommissionChangeQueueEntry.encode(v!, writer.uint32(138).fork()).ldelim(); + } + for (const v of message.unbonding_staker_list) { + UnbondingStaker.encode(v!, writer.uint32(98).fork()).ldelim(); + } + if (message.unbonding_staking_queue_state !== undefined) { + UnbondingStakingQueueState.encode(message.unbonding_staking_queue_state, writer.uint32(82).fork()).ldelim(); + } + for (const v of message.unbonding_staking_queue_entries) { + UnbondingStakingQueueEntry.encode(v!, writer.uint32(90).fork()).ldelim(); + } + for (const v of message.delegator_list) { + Delegator.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.delegation_pool_data_list) { + DelegationPoolData.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.delegation_entries_list) { + DelegationEntries.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.proposal_list) { + Proposal.encode(v!, writer.uint32(74).fork()).ldelim(); + } + if (message.unbonding_delegation_queue_state !== undefined) { + UnbondingDelegationQueueState.encode(message.unbonding_delegation_queue_state, writer.uint32(106).fork()) + .ldelim(); + } + for (const v of message.unbonding_delegation_queue_entries) { + UnbondingDelegationQueueEntry.encode(v!, writer.uint32(114).fork()).ldelim(); + } + for (const v of message.redelegation_cooldown_list) { + RedelegationCooldown.encode(v!, writer.uint32(122).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.pool_list.push(Pool.decode(reader, reader.uint32())); + break; + case 3: + message.pool_count = longToString(reader.uint64() as Long); + break; + case 4: + message.funder_list.push(Funder.decode(reader, reader.uint32())); + break; + case 5: + message.staker_list.push(Staker.decode(reader, reader.uint32())); + break; + case 16: + message.commission_change_queue_state = CommissionChangeQueueState.decode(reader, reader.uint32()); + break; + case 17: + message.commission_change_queue_entry.push(CommissionChangeQueueEntry.decode(reader, reader.uint32())); + break; + case 12: + message.unbonding_staker_list.push(UnbondingStaker.decode(reader, reader.uint32())); + break; + case 10: + message.unbonding_staking_queue_state = UnbondingStakingQueueState.decode(reader, reader.uint32()); + break; + case 11: + message.unbonding_staking_queue_entries.push(UnbondingStakingQueueEntry.decode(reader, reader.uint32())); + break; + case 6: + message.delegator_list.push(Delegator.decode(reader, reader.uint32())); + break; + case 7: + message.delegation_pool_data_list.push(DelegationPoolData.decode(reader, reader.uint32())); + break; + case 8: + message.delegation_entries_list.push(DelegationEntries.decode(reader, reader.uint32())); + break; + case 9: + message.proposal_list.push(Proposal.decode(reader, reader.uint32())); + break; + case 13: + message.unbonding_delegation_queue_state = UnbondingDelegationQueueState.decode(reader, reader.uint32()); + break; + case 14: + message.unbonding_delegation_queue_entries.push( + UnbondingDelegationQueueEntry.decode(reader, reader.uint32()), + ); + break; + case 15: + message.redelegation_cooldown_list.push(RedelegationCooldown.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + pool_list: Array.isArray(object?.pool_list) ? object.pool_list.map((e: any) => Pool.fromJSON(e)) : [], + pool_count: isSet(object.pool_count) ? String(object.pool_count) : "0", + funder_list: Array.isArray(object?.funder_list) ? object.funder_list.map((e: any) => Funder.fromJSON(e)) : [], + staker_list: Array.isArray(object?.staker_list) ? object.staker_list.map((e: any) => Staker.fromJSON(e)) : [], + commission_change_queue_state: isSet(object.commission_change_queue_state) + ? CommissionChangeQueueState.fromJSON(object.commission_change_queue_state) + : undefined, + commission_change_queue_entry: Array.isArray(object?.commission_change_queue_entry) + ? object.commission_change_queue_entry.map((e: any) => CommissionChangeQueueEntry.fromJSON(e)) + : [], + unbonding_staker_list: Array.isArray(object?.unbonding_staker_list) + ? object.unbonding_staker_list.map((e: any) => UnbondingStaker.fromJSON(e)) + : [], + unbonding_staking_queue_state: isSet(object.unbonding_staking_queue_state) + ? UnbondingStakingQueueState.fromJSON(object.unbonding_staking_queue_state) + : undefined, + unbonding_staking_queue_entries: Array.isArray(object?.unbonding_staking_queue_entries) + ? object.unbonding_staking_queue_entries.map((e: any) => UnbondingStakingQueueEntry.fromJSON(e)) + : [], + delegator_list: Array.isArray(object?.delegator_list) + ? object.delegator_list.map((e: any) => Delegator.fromJSON(e)) + : [], + delegation_pool_data_list: Array.isArray(object?.delegation_pool_data_list) + ? object.delegation_pool_data_list.map((e: any) => DelegationPoolData.fromJSON(e)) + : [], + delegation_entries_list: Array.isArray(object?.delegation_entries_list) + ? object.delegation_entries_list.map((e: any) => DelegationEntries.fromJSON(e)) + : [], + proposal_list: Array.isArray(object?.proposal_list) + ? object.proposal_list.map((e: any) => Proposal.fromJSON(e)) + : [], + unbonding_delegation_queue_state: isSet(object.unbonding_delegation_queue_state) + ? UnbondingDelegationQueueState.fromJSON(object.unbonding_delegation_queue_state) + : undefined, + unbonding_delegation_queue_entries: Array.isArray(object?.unbonding_delegation_queue_entries) + ? object.unbonding_delegation_queue_entries.map((e: any) => UnbondingDelegationQueueEntry.fromJSON(e)) + : [], + redelegation_cooldown_list: Array.isArray(object?.redelegation_cooldown_list) + ? object.redelegation_cooldown_list.map((e: any) => RedelegationCooldown.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.pool_list) { + obj.pool_list = message.pool_list.map((e) => e ? Pool.toJSON(e) : undefined); + } else { + obj.pool_list = []; + } + message.pool_count !== undefined && (obj.pool_count = message.pool_count); + if (message.funder_list) { + obj.funder_list = message.funder_list.map((e) => e ? Funder.toJSON(e) : undefined); + } else { + obj.funder_list = []; + } + if (message.staker_list) { + obj.staker_list = message.staker_list.map((e) => e ? Staker.toJSON(e) : undefined); + } else { + obj.staker_list = []; + } + message.commission_change_queue_state !== undefined && + (obj.commission_change_queue_state = message.commission_change_queue_state + ? CommissionChangeQueueState.toJSON(message.commission_change_queue_state) + : undefined); + if (message.commission_change_queue_entry) { + obj.commission_change_queue_entry = message.commission_change_queue_entry.map((e) => + e ? CommissionChangeQueueEntry.toJSON(e) : undefined + ); + } else { + obj.commission_change_queue_entry = []; + } + if (message.unbonding_staker_list) { + obj.unbonding_staker_list = message.unbonding_staker_list.map((e) => e ? UnbondingStaker.toJSON(e) : undefined); + } else { + obj.unbonding_staker_list = []; + } + message.unbonding_staking_queue_state !== undefined && + (obj.unbonding_staking_queue_state = message.unbonding_staking_queue_state + ? UnbondingStakingQueueState.toJSON(message.unbonding_staking_queue_state) + : undefined); + if (message.unbonding_staking_queue_entries) { + obj.unbonding_staking_queue_entries = message.unbonding_staking_queue_entries.map((e) => + e ? UnbondingStakingQueueEntry.toJSON(e) : undefined + ); + } else { + obj.unbonding_staking_queue_entries = []; + } + if (message.delegator_list) { + obj.delegator_list = message.delegator_list.map((e) => e ? Delegator.toJSON(e) : undefined); + } else { + obj.delegator_list = []; + } + if (message.delegation_pool_data_list) { + obj.delegation_pool_data_list = message.delegation_pool_data_list.map((e) => + e ? DelegationPoolData.toJSON(e) : undefined + ); + } else { + obj.delegation_pool_data_list = []; + } + if (message.delegation_entries_list) { + obj.delegation_entries_list = message.delegation_entries_list.map((e) => + e ? DelegationEntries.toJSON(e) : undefined + ); + } else { + obj.delegation_entries_list = []; + } + if (message.proposal_list) { + obj.proposal_list = message.proposal_list.map((e) => e ? Proposal.toJSON(e) : undefined); + } else { + obj.proposal_list = []; + } + message.unbonding_delegation_queue_state !== undefined && + (obj.unbonding_delegation_queue_state = message.unbonding_delegation_queue_state + ? UnbondingDelegationQueueState.toJSON(message.unbonding_delegation_queue_state) + : undefined); + if (message.unbonding_delegation_queue_entries) { + obj.unbonding_delegation_queue_entries = message.unbonding_delegation_queue_entries.map((e) => + e ? UnbondingDelegationQueueEntry.toJSON(e) : undefined + ); + } else { + obj.unbonding_delegation_queue_entries = []; + } + if (message.redelegation_cooldown_list) { + obj.redelegation_cooldown_list = message.redelegation_cooldown_list.map((e) => + e ? RedelegationCooldown.toJSON(e) : undefined + ); + } else { + obj.redelegation_cooldown_list = []; + } + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.pool_list = object.pool_list?.map((e) => Pool.fromPartial(e)) || []; + message.pool_count = object.pool_count ?? "0"; + message.funder_list = object.funder_list?.map((e) => Funder.fromPartial(e)) || []; + message.staker_list = object.staker_list?.map((e) => Staker.fromPartial(e)) || []; + message.commission_change_queue_state = + (object.commission_change_queue_state !== undefined && object.commission_change_queue_state !== null) + ? CommissionChangeQueueState.fromPartial(object.commission_change_queue_state) + : undefined; + message.commission_change_queue_entry = + object.commission_change_queue_entry?.map((e) => CommissionChangeQueueEntry.fromPartial(e)) || []; + message.unbonding_staker_list = object.unbonding_staker_list?.map((e) => UnbondingStaker.fromPartial(e)) || []; + message.unbonding_staking_queue_state = + (object.unbonding_staking_queue_state !== undefined && object.unbonding_staking_queue_state !== null) + ? UnbondingStakingQueueState.fromPartial(object.unbonding_staking_queue_state) + : undefined; + message.unbonding_staking_queue_entries = + object.unbonding_staking_queue_entries?.map((e) => UnbondingStakingQueueEntry.fromPartial(e)) || []; + message.delegator_list = object.delegator_list?.map((e) => Delegator.fromPartial(e)) || []; + message.delegation_pool_data_list = + object.delegation_pool_data_list?.map((e) => DelegationPoolData.fromPartial(e)) || []; + message.delegation_entries_list = object.delegation_entries_list?.map((e) => DelegationEntries.fromPartial(e)) || + []; + message.proposal_list = object.proposal_list?.map((e) => Proposal.fromPartial(e)) || []; + message.unbonding_delegation_queue_state = + (object.unbonding_delegation_queue_state !== undefined && object.unbonding_delegation_queue_state !== null) + ? UnbondingDelegationQueueState.fromPartial(object.unbonding_delegation_queue_state) + : undefined; + message.unbonding_delegation_queue_entries = + object.unbonding_delegation_queue_entries?.map((e) => UnbondingDelegationQueueEntry.fromPartial(e)) || []; + message.redelegation_cooldown_list = + object.redelegation_cooldown_list?.map((e) => RedelegationCooldown.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/registry/v1beta1/gov.ts b/common/types/src/lcd/kyve/registry/v1beta1/gov.ts new file mode 100644 index 00000000..ab1546ce --- /dev/null +++ b/common/types/src/lcd/kyve/registry/v1beta1/gov.ts @@ -0,0 +1,694 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.registry.v1beta1"; + +/** + * CreatePoolProposal is a gov Content type for creating a pool. + * + * @deprecated + */ +export interface CreatePoolProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** name ... */ + name: string; + /** runtime ... */ + runtime: string; + /** logo ... */ + logo: string; + /** config ... */ + config: string; + /** start_key ... */ + start_key: string; + /** upload_interval ... */ + upload_interval: string; + /** operating_cost ... */ + operating_cost: string; + /** min_delegation ... */ + min_delegation: string; + /** max_bundle_size ... */ + max_bundle_size: string; + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; +} + +/** + * UpdatePoolProposal is a gov Content type for updating a pool. + * + * @deprecated + */ +export interface UpdatePoolProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** id ... */ + id: string; + /** payload */ + payload: string; +} + +/** + * PausePoolProposal is a gov Content type for pausing a pool. + * + * @deprecated + */ +export interface PausePoolProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** id ... */ + id: string; +} + +/** + * UnpausePoolProposal is a gov Content type for unpausing a pool. + * + * @deprecated + */ +export interface UnpausePoolProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** id ... */ + id: string; +} + +/** + * SchedulePoolUpgradeProposal is a gov Content type for upgrading a pool by the runtime. + * + * @deprecated + */ +export interface SchedulePoolUpgradeProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** runtime ... */ + runtime: string; + /** version ... */ + version: string; + /** scheduled_at ... */ + scheduled_at: string; + /** duration ... */ + duration: string; + /** binaries ... */ + binaries: string; +} + +/** + * CancelPoolUpgradeProposal is a gov Content type for cancelling a scheduled pool upgrade by the runtime. + * + * @deprecated + */ +export interface CancelPoolUpgradeProposal { + /** title ... */ + title: string; + /** description ... */ + description: string; + /** runtime ... */ + runtime: string; +} + +function createBaseCreatePoolProposal(): CreatePoolProposal { + return { + title: "", + description: "", + name: "", + runtime: "", + logo: "", + config: "", + start_key: "", + upload_interval: "0", + operating_cost: "0", + min_delegation: "0", + max_bundle_size: "0", + version: "", + binaries: "", + }; +} + +export const CreatePoolProposal = { + encode(message: CreatePoolProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(34).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(42).string(message.logo); + } + if (message.config !== "") { + writer.uint32(50).string(message.config); + } + if (message.start_key !== "") { + writer.uint32(58).string(message.start_key); + } + if (message.upload_interval !== "0") { + writer.uint32(64).uint64(message.upload_interval); + } + if (message.operating_cost !== "0") { + writer.uint32(72).uint64(message.operating_cost); + } + if (message.min_delegation !== "0") { + writer.uint32(80).uint64(message.min_delegation); + } + if (message.max_bundle_size !== "0") { + writer.uint32(88).uint64(message.max_bundle_size); + } + if (message.version !== "") { + writer.uint32(98).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(106).string(message.binaries); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreatePoolProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreatePoolProposal(); + 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.name = reader.string(); + break; + case 4: + message.runtime = reader.string(); + break; + case 5: + message.logo = reader.string(); + break; + case 6: + message.config = reader.string(); + break; + case 7: + message.start_key = reader.string(); + break; + case 8: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 9: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 10: + message.min_delegation = longToString(reader.uint64() as Long); + break; + case 11: + message.max_bundle_size = longToString(reader.uint64() as Long); + break; + case 12: + message.version = reader.string(); + break; + case 13: + message.binaries = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CreatePoolProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + config: isSet(object.config) ? String(object.config) : "", + start_key: isSet(object.start_key) ? String(object.start_key) : "", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? String(object.max_bundle_size) : "0", + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + }; + }, + + toJSON(message: CreatePoolProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.config !== undefined && (obj.config = message.config); + message.start_key !== undefined && (obj.start_key = message.start_key); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.min_delegation !== undefined && (obj.min_delegation = message.min_delegation); + message.max_bundle_size !== undefined && (obj.max_bundle_size = message.max_bundle_size); + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + return obj; + }, + + fromPartial, I>>(object: I): CreatePoolProposal { + const message = createBaseCreatePoolProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.config = object.config ?? ""; + message.start_key = object.start_key ?? ""; + message.upload_interval = object.upload_interval ?? "0"; + message.operating_cost = object.operating_cost ?? "0"; + message.min_delegation = object.min_delegation ?? "0"; + message.max_bundle_size = object.max_bundle_size ?? "0"; + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + return message; + }, +}; + +function createBaseUpdatePoolProposal(): UpdatePoolProposal { + return { title: "", description: "", id: "0", payload: "" }; +} + +export const UpdatePoolProposal = { + encode(message: UpdatePoolProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.id !== "0") { + writer.uint32(24).uint64(message.id); + } + if (message.payload !== "") { + writer.uint32(34).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdatePoolProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdatePoolProposal(); + 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.id = longToString(reader.uint64() as Long); + break; + case 4: + message.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UpdatePoolProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + id: isSet(object.id) ? String(object.id) : "0", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: UpdatePoolProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.id !== undefined && (obj.id = message.id); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): UpdatePoolProposal { + const message = createBaseUpdatePoolProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.id = object.id ?? "0"; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBasePausePoolProposal(): PausePoolProposal { + return { title: "", description: "", id: "0" }; +} + +export const PausePoolProposal = { + encode(message: PausePoolProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.id !== "0") { + writer.uint32(24).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PausePoolProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePausePoolProposal(); + 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.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PausePoolProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + id: isSet(object.id) ? String(object.id) : "0", + }; + }, + + toJSON(message: PausePoolProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): PausePoolProposal { + const message = createBasePausePoolProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseUnpausePoolProposal(): UnpausePoolProposal { + return { title: "", description: "", id: "0" }; +} + +export const UnpausePoolProposal = { + encode(message: UnpausePoolProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.id !== "0") { + writer.uint32(24).uint64(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnpausePoolProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnpausePoolProposal(); + 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.id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnpausePoolProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + id: isSet(object.id) ? String(object.id) : "0", + }; + }, + + toJSON(message: UnpausePoolProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.id !== undefined && (obj.id = message.id); + return obj; + }, + + fromPartial, I>>(object: I): UnpausePoolProposal { + const message = createBaseUnpausePoolProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.id = object.id ?? "0"; + return message; + }, +}; + +function createBaseSchedulePoolUpgradeProposal(): SchedulePoolUpgradeProposal { + return { title: "", description: "", runtime: "", version: "", scheduled_at: "0", duration: "0", binaries: "" }; +} + +export const SchedulePoolUpgradeProposal = { + encode(message: SchedulePoolUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + if (message.version !== "") { + writer.uint32(34).string(message.version); + } + if (message.scheduled_at !== "0") { + writer.uint32(40).uint64(message.scheduled_at); + } + if (message.duration !== "0") { + writer.uint32(48).uint64(message.duration); + } + if (message.binaries !== "") { + writer.uint32(58).string(message.binaries); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SchedulePoolUpgradeProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSchedulePoolUpgradeProposal(); + 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.runtime = reader.string(); + break; + case 4: + message.version = reader.string(); + break; + case 5: + message.scheduled_at = longToString(reader.uint64() as Long); + break; + case 6: + message.duration = longToString(reader.uint64() as Long); + break; + case 7: + message.binaries = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SchedulePoolUpgradeProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + version: isSet(object.version) ? String(object.version) : "", + scheduled_at: isSet(object.scheduled_at) ? String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? String(object.duration) : "0", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + }; + }, + + toJSON(message: SchedulePoolUpgradeProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.version !== undefined && (obj.version = message.version); + message.scheduled_at !== undefined && (obj.scheduled_at = message.scheduled_at); + message.duration !== undefined && (obj.duration = message.duration); + message.binaries !== undefined && (obj.binaries = message.binaries); + return obj; + }, + + fromPartial, I>>(object: I): SchedulePoolUpgradeProposal { + const message = createBaseSchedulePoolUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runtime = object.runtime ?? ""; + message.version = object.version ?? ""; + message.scheduled_at = object.scheduled_at ?? "0"; + message.duration = object.duration ?? "0"; + message.binaries = object.binaries ?? ""; + return message; + }, +}; + +function createBaseCancelPoolUpgradeProposal(): CancelPoolUpgradeProposal { + return { title: "", description: "", runtime: "" }; +} + +export const CancelPoolUpgradeProposal = { + encode(message: CancelPoolUpgradeProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runtime !== "") { + writer.uint32(26).string(message.runtime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CancelPoolUpgradeProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelPoolUpgradeProposal(); + 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.runtime = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CancelPoolUpgradeProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + }; + }, + + toJSON(message: CancelPoolUpgradeProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.runtime !== undefined && (obj.runtime = message.runtime); + return obj; + }, + + fromPartial, I>>(object: I): CancelPoolUpgradeProposal { + const message = createBaseCancelPoolUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runtime = object.runtime ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/registry/v1beta1/registry.ts b/common/types/src/lcd/kyve/registry/v1beta1/registry.ts new file mode 100644 index 00000000..a22dfe9a --- /dev/null +++ b/common/types/src/lcd/kyve/registry/v1beta1/registry.ts @@ -0,0 +1,2434 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.registry.v1beta1"; + +/** PoolStatus ... */ +export enum PoolStatus { + /** POOL_STATUS_UNSPECIFIED - POOL_STATUS_UNSPECIFIED ... */ + POOL_STATUS_UNSPECIFIED = "POOL_STATUS_UNSPECIFIED", + /** POOL_STATUS_ACTIVE - POOL_STATUS_ACTIVE ... */ + POOL_STATUS_ACTIVE = "POOL_STATUS_ACTIVE", + /** POOL_STATUS_PAUSED - POOL_STATUS_PAUSED ... */ + POOL_STATUS_PAUSED = "POOL_STATUS_PAUSED", + /** POOL_STATUS_NO_FUNDS - POOL_STATUS_NO_FUNDS ... */ + POOL_STATUS_NO_FUNDS = "POOL_STATUS_NO_FUNDS", + /** POOL_STATUS_NOT_ENOUGH_VALIDATORS - POOL_STATUS_NOT_ENOUGH_VALIDATORS ... */ + POOL_STATUS_NOT_ENOUGH_VALIDATORS = "POOL_STATUS_NOT_ENOUGH_VALIDATORS", + /** POOL_STATUS_NOT_ENOUGH_STAKE - POOL_STATUS_NOT_ENOUGH_STAKE ... */ + POOL_STATUS_NOT_ENOUGH_STAKE = "POOL_STATUS_NOT_ENOUGH_STAKE", + /** POOL_STATUS_UPGRADING - POOL_STATUS_UPGRADING ... */ + POOL_STATUS_UPGRADING = "POOL_STATUS_UPGRADING", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function poolStatusFromJSON(object: any): PoolStatus { + switch (object) { + case 0: + case "POOL_STATUS_UNSPECIFIED": + return PoolStatus.POOL_STATUS_UNSPECIFIED; + case 1: + case "POOL_STATUS_ACTIVE": + return PoolStatus.POOL_STATUS_ACTIVE; + case 2: + case "POOL_STATUS_PAUSED": + return PoolStatus.POOL_STATUS_PAUSED; + case 3: + case "POOL_STATUS_NO_FUNDS": + return PoolStatus.POOL_STATUS_NO_FUNDS; + case 4: + case "POOL_STATUS_NOT_ENOUGH_VALIDATORS": + return PoolStatus.POOL_STATUS_NOT_ENOUGH_VALIDATORS; + case 5: + case "POOL_STATUS_NOT_ENOUGH_STAKE": + return PoolStatus.POOL_STATUS_NOT_ENOUGH_STAKE; + case 6: + case "POOL_STATUS_UPGRADING": + return PoolStatus.POOL_STATUS_UPGRADING; + case -1: + case "UNRECOGNIZED": + default: + return PoolStatus.UNRECOGNIZED; + } +} + +export function poolStatusToJSON(object: PoolStatus): string { + switch (object) { + case PoolStatus.POOL_STATUS_UNSPECIFIED: + return "POOL_STATUS_UNSPECIFIED"; + case PoolStatus.POOL_STATUS_ACTIVE: + return "POOL_STATUS_ACTIVE"; + case PoolStatus.POOL_STATUS_PAUSED: + return "POOL_STATUS_PAUSED"; + case PoolStatus.POOL_STATUS_NO_FUNDS: + return "POOL_STATUS_NO_FUNDS"; + case PoolStatus.POOL_STATUS_NOT_ENOUGH_VALIDATORS: + return "POOL_STATUS_NOT_ENOUGH_VALIDATORS"; + case PoolStatus.POOL_STATUS_NOT_ENOUGH_STAKE: + return "POOL_STATUS_NOT_ENOUGH_STAKE"; + case PoolStatus.POOL_STATUS_UPGRADING: + return "POOL_STATUS_UPGRADING"; + case PoolStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function poolStatusToNumber(object: PoolStatus): number { + switch (object) { + case PoolStatus.POOL_STATUS_UNSPECIFIED: + return 0; + case PoolStatus.POOL_STATUS_ACTIVE: + return 1; + case PoolStatus.POOL_STATUS_PAUSED: + return 2; + case PoolStatus.POOL_STATUS_NO_FUNDS: + return 3; + case PoolStatus.POOL_STATUS_NOT_ENOUGH_VALIDATORS: + return 4; + case PoolStatus.POOL_STATUS_NOT_ENOUGH_STAKE: + return 5; + case PoolStatus.POOL_STATUS_UPGRADING: + return 6; + case PoolStatus.UNRECOGNIZED: + default: + return -1; + } +} + +/** StakerStatus ... */ +export enum StakerStatus { + /** STAKER_STATUS_UNSPECIFIED - STAKER_STATUS_UNSPECIFIED ... */ + STAKER_STATUS_UNSPECIFIED = "STAKER_STATUS_UNSPECIFIED", + /** STAKER_STATUS_ACTIVE - STAKER_STATUS_ACTIVE ... */ + STAKER_STATUS_ACTIVE = "STAKER_STATUS_ACTIVE", + /** STAKER_STATUS_INACTIVE - STAKER_STATUS_INACTIVE ... */ + STAKER_STATUS_INACTIVE = "STAKER_STATUS_INACTIVE", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function stakerStatusFromJSON(object: any): StakerStatus { + switch (object) { + case 0: + case "STAKER_STATUS_UNSPECIFIED": + return StakerStatus.STAKER_STATUS_UNSPECIFIED; + case 1: + case "STAKER_STATUS_ACTIVE": + return StakerStatus.STAKER_STATUS_ACTIVE; + case 2: + case "STAKER_STATUS_INACTIVE": + return StakerStatus.STAKER_STATUS_INACTIVE; + case -1: + case "UNRECOGNIZED": + default: + return StakerStatus.UNRECOGNIZED; + } +} + +export function stakerStatusToJSON(object: StakerStatus): string { + switch (object) { + case StakerStatus.STAKER_STATUS_UNSPECIFIED: + return "STAKER_STATUS_UNSPECIFIED"; + case StakerStatus.STAKER_STATUS_ACTIVE: + return "STAKER_STATUS_ACTIVE"; + case StakerStatus.STAKER_STATUS_INACTIVE: + return "STAKER_STATUS_INACTIVE"; + case StakerStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function stakerStatusToNumber(object: StakerStatus): number { + switch (object) { + case StakerStatus.STAKER_STATUS_UNSPECIFIED: + return 0; + case StakerStatus.STAKER_STATUS_ACTIVE: + return 1; + case StakerStatus.STAKER_STATUS_INACTIVE: + return 2; + case StakerStatus.UNRECOGNIZED: + default: + return -1; + } +} + +/** BundleProposal ... */ +export interface BundleProposal { + /** uploader ... */ + uploader: string; + /** next_uploader ... */ + next_uploader: string; + /** storage_id ... */ + storage_id: string; + /** byte_size ... */ + byte_size: string; + /** + * from_height ... + * + * @deprecated + */ + from_height: string; + /** to_height ... */ + to_height: string; + /** created_at ... */ + created_at: string; + /** voters_valid ... */ + voters_valid: string[]; + /** voters_invalid ... */ + voters_invalid: string[]; + /** voters_abstain ... */ + voters_abstain: string[]; + /** to_key ... */ + to_key: string; + /** to_value ... */ + to_value: string; + /** bundle_hash ... */ + bundle_hash: string; +} + +/** Protocol ... */ +export interface Protocol { + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** last_upgrade ... */ + last_upgrade: string; + /** test */ + test: string; +} + +/** Upgrade ... */ +export interface UpgradePlan { + /** version ... */ + version: string; + /** binaries ... */ + binaries: string; + /** scheduled_at ... */ + scheduled_at: string; + /** duration ... */ + duration: string; +} + +/** DelegationEntries ... */ +export interface DelegationEntries { + /** id ... */ + id: string; + /** balance ... */ + balance: string; + /** staker ... */ + staker: string; + /** k_index ... */ + k_index: string; +} + +/** DelegationPoolData ... */ +export interface DelegationPoolData { + /** id ... */ + id: string; + /** staker ... */ + staker: string; + /** current_rewards ... */ + current_rewards: string; + /** total_delegation ... */ + total_delegation: string; + /** latest_index_k ... */ + latest_index_k: string; + /** delegator_count ... */ + delegator_count: string; + /** latest_index_was_undelegation ... */ + latest_index_was_undelegation: boolean; +} + +/** Delegator ... */ +export interface Delegator { + /** id ... */ + id: string; + /** k_index ... */ + k_index: string; + /** delegation_amount ... */ + delegation_amount: string; + /** staker ... */ + staker: string; + /** delegator ... */ + delegator: string; +} + +/** Funder ... */ +export interface Funder { + /** account ... */ + account: string; + /** fund_id ... */ + pool_id: string; + /** amount ... */ + amount: string; +} + +/** Pool ... */ +export interface Pool { + /** id ... */ + id: string; + /** creator ... */ + creator: string; + /** name ... */ + name: string; + /** runtime ... */ + runtime: string; + /** logo ... */ + logo: string; + /** + * versions ... + * + * @deprecated + */ + versions: string; + /** config ... */ + config: string; + /** current_height ... */ + current_height: string; + /** total_bytes ... */ + total_bytes: string; + /** total_bundles ... */ + total_bundles: string; + /** total_bundle_rewards ... */ + total_bundle_rewards: string; + /** + * start_height ... + * + * @deprecated + */ + start_height: string; + /** upload_interval ... */ + upload_interval: string; + /** operating_cost ... */ + operating_cost: string; + /** paused ... */ + paused: boolean; + /** funders ... */ + funders: string[]; + /** lowest_funder ... */ + lowest_funder: string; + /** total_funds ... */ + total_funds: string; + /** stakers ... */ + stakers: string[]; + /** lowest_staker ... */ + lowest_staker: string; + /** total_stake ... */ + total_stake: string; + /** total_delegation ... */ + total_delegation: string; + /** bundle_proposal ... */ + bundle_proposal?: BundleProposal; + /** max_bundle_size ... */ + max_bundle_size: string; + /** protocol ... */ + protocol?: Protocol; + /** upgrade_plan ... */ + upgrade_plan?: UpgradePlan; + /** start_key ... */ + start_key: string; + /** current_key ... */ + current_key: string; + /** current_value ... */ + current_value: string; + /** inactive_stakers ... */ + inactive_stakers: string[]; + /** total_inactive_stake ... */ + total_inactive_stake: string; + /** min_stake ... */ + min_stake: string; + /** status ... */ + status: PoolStatus; +} + +/** Proposal ... */ +export interface Proposal { + /** storage_id ... */ + storage_id: string; + /** pool_id ... */ + pool_id: string; + /** uploader ... */ + uploader: string; + /** from_height ... */ + from_height: string; + /** to_height ... */ + to_height: string; + /** finalized_at ... */ + finalized_at: string; + /** id ... */ + id: string; + /** key ... */ + key: string; + /** value ... */ + value: string; + /** bundle_hash ... */ + bundle_hash: string; +} + +/** Staker ... */ +export interface Staker { + /** staker ... */ + account: string; + /** pool_id ... */ + pool_id: string; + /** amount ... */ + amount: string; + /** unbonding_amount ... */ + unbonding_amount: string; + /** commission ... */ + commission: string; + /** moniker ... */ + moniker: string; + /** website ... */ + website: string; + /** logo */ + logo: string; + /** points */ + points: string; + /** status */ + status: StakerStatus; +} + +/** + * UnbondingStakingEntry + * Creates an entry for an upcoming unbonding of a staker which is put in the unbonding fifo queue and + * executed after the unbonding time is over. + */ +export interface UnbondingStakingQueueEntry { + /** index is a monotonically increasing integer to order the entries */ + index: string; + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** amount ... */ + amount: string; + /** creation_time ... */ + creation_time: string; +} + +/** + * UnbondingStakingEntry + * Creates an entry for an upcoming unbonding of a staker which is put in the unbonding fifo queue and + * executed after the unbonding time is over. + */ +export interface UnbondingStaker { + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** amount ... */ + unbonding_amount: string; +} + +/** UnbondingState stores the state for the unbonding of stakes and delegations. */ +export interface UnbondingStakingQueueState { + /** low_index ... */ + low_index: string; + /** high_index ... */ + high_index: string; +} + +/** + * UnbondingStakingEntry + * Creates an entry for an upcoming unbonding of a staker which is put in the unbonding fifo queue and + * executed after the unbonding time is over. + */ +export interface UnbondingDelegationQueueEntry { + /** index is a monotonically increasing integer to order the entries */ + index: string; + /** staker ... */ + staker: string; + /** delegator ... */ + delegator: string; + /** pool_id ... */ + pool_id: string; + /** amount ... */ + amount: string; + /** creation_time ... */ + creation_time: string; +} + +/** UnbondingState stores the state for the unbonding of stakes and delegations. */ +export interface UnbondingDelegationQueueState { + /** low_index ... */ + low_index: string; + /** high_index ... */ + high_index: string; +} + +/** RedelegationCooldown ... */ +export interface RedelegationCooldown { + /** low_index ... */ + address: string; + /** high_index ... */ + creation_date: string; +} + +/** CommissionChangeQueueEntry ... */ +export interface CommissionChangeQueueEntry { + /** index is a monotonically increasing integer to order the entries */ + index: string; + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** commission ... */ + commission: string; + /** commission ... */ + creation_date: string; +} + +/** CommissionChangeQueueState ... */ +export interface CommissionChangeQueueState { + /** low_index ... */ + low_index: string; + /** high_index ... */ + high_index: string; +} + +function createBaseBundleProposal(): BundleProposal { + return { + uploader: "", + next_uploader: "", + storage_id: "", + byte_size: "0", + from_height: "0", + to_height: "0", + created_at: "0", + voters_valid: [], + voters_invalid: [], + voters_abstain: [], + to_key: "", + to_value: "", + bundle_hash: "", + }; +} + +export const BundleProposal = { + encode(message: BundleProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.uploader !== "") { + writer.uint32(10).string(message.uploader); + } + if (message.next_uploader !== "") { + writer.uint32(18).string(message.next_uploader); + } + if (message.storage_id !== "") { + writer.uint32(26).string(message.storage_id); + } + if (message.byte_size !== "0") { + writer.uint32(32).uint64(message.byte_size); + } + if (message.from_height !== "0") { + writer.uint32(40).uint64(message.from_height); + } + if (message.to_height !== "0") { + writer.uint32(48).uint64(message.to_height); + } + if (message.created_at !== "0") { + writer.uint32(56).uint64(message.created_at); + } + for (const v of message.voters_valid) { + writer.uint32(66).string(v!); + } + for (const v of message.voters_invalid) { + writer.uint32(74).string(v!); + } + for (const v of message.voters_abstain) { + writer.uint32(82).string(v!); + } + if (message.to_key !== "") { + writer.uint32(90).string(message.to_key); + } + if (message.to_value !== "") { + writer.uint32(98).string(message.to_value); + } + if (message.bundle_hash !== "") { + writer.uint32(106).string(message.bundle_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BundleProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBundleProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uploader = reader.string(); + break; + case 2: + message.next_uploader = reader.string(); + break; + case 3: + message.storage_id = reader.string(); + break; + case 4: + message.byte_size = longToString(reader.uint64() as Long); + break; + case 5: + message.from_height = longToString(reader.uint64() as Long); + break; + case 6: + message.to_height = longToString(reader.uint64() as Long); + break; + case 7: + message.created_at = longToString(reader.uint64() as Long); + break; + case 8: + message.voters_valid.push(reader.string()); + break; + case 9: + message.voters_invalid.push(reader.string()); + break; + case 10: + message.voters_abstain.push(reader.string()); + break; + case 11: + message.to_key = reader.string(); + break; + case 12: + message.to_value = reader.string(); + break; + case 13: + message.bundle_hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BundleProposal { + return { + uploader: isSet(object.uploader) ? String(object.uploader) : "", + next_uploader: isSet(object.next_uploader) ? String(object.next_uploader) : "", + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + byte_size: isSet(object.byte_size) ? String(object.byte_size) : "0", + from_height: isSet(object.from_height) ? String(object.from_height) : "0", + to_height: isSet(object.to_height) ? String(object.to_height) : "0", + created_at: isSet(object.created_at) ? String(object.created_at) : "0", + voters_valid: Array.isArray(object?.voters_valid) ? object.voters_valid.map((e: any) => String(e)) : [], + voters_invalid: Array.isArray(object?.voters_invalid) ? object.voters_invalid.map((e: any) => String(e)) : [], + voters_abstain: Array.isArray(object?.voters_abstain) ? object.voters_abstain.map((e: any) => String(e)) : [], + to_key: isSet(object.to_key) ? String(object.to_key) : "", + to_value: isSet(object.to_value) ? String(object.to_value) : "", + bundle_hash: isSet(object.bundle_hash) ? String(object.bundle_hash) : "", + }; + }, + + toJSON(message: BundleProposal): unknown { + const obj: any = {}; + message.uploader !== undefined && (obj.uploader = message.uploader); + message.next_uploader !== undefined && (obj.next_uploader = message.next_uploader); + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.byte_size !== undefined && (obj.byte_size = message.byte_size); + message.from_height !== undefined && (obj.from_height = message.from_height); + message.to_height !== undefined && (obj.to_height = message.to_height); + message.created_at !== undefined && (obj.created_at = message.created_at); + if (message.voters_valid) { + obj.voters_valid = message.voters_valid.map((e) => e); + } else { + obj.voters_valid = []; + } + if (message.voters_invalid) { + obj.voters_invalid = message.voters_invalid.map((e) => e); + } else { + obj.voters_invalid = []; + } + if (message.voters_abstain) { + obj.voters_abstain = message.voters_abstain.map((e) => e); + } else { + obj.voters_abstain = []; + } + message.to_key !== undefined && (obj.to_key = message.to_key); + message.to_value !== undefined && (obj.to_value = message.to_value); + message.bundle_hash !== undefined && (obj.bundle_hash = message.bundle_hash); + return obj; + }, + + fromPartial, I>>(object: I): BundleProposal { + const message = createBaseBundleProposal(); + message.uploader = object.uploader ?? ""; + message.next_uploader = object.next_uploader ?? ""; + message.storage_id = object.storage_id ?? ""; + message.byte_size = object.byte_size ?? "0"; + message.from_height = object.from_height ?? "0"; + message.to_height = object.to_height ?? "0"; + message.created_at = object.created_at ?? "0"; + message.voters_valid = object.voters_valid?.map((e) => e) || []; + message.voters_invalid = object.voters_invalid?.map((e) => e) || []; + message.voters_abstain = object.voters_abstain?.map((e) => e) || []; + message.to_key = object.to_key ?? ""; + message.to_value = object.to_value ?? ""; + message.bundle_hash = object.bundle_hash ?? ""; + return message; + }, +}; + +function createBaseProtocol(): Protocol { + return { version: "", binaries: "", last_upgrade: "0", test: "" }; +} + +export const Protocol = { + encode(message: Protocol, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(18).string(message.binaries); + } + if (message.last_upgrade !== "0") { + writer.uint32(24).uint64(message.last_upgrade); + } + if (message.test !== "") { + writer.uint32(34).string(message.test); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Protocol { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProtocol(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.binaries = reader.string(); + break; + case 3: + message.last_upgrade = longToString(reader.uint64() as Long); + break; + case 4: + message.test = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Protocol { + return { + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + last_upgrade: isSet(object.last_upgrade) ? String(object.last_upgrade) : "0", + test: isSet(object.test) ? String(object.test) : "", + }; + }, + + toJSON(message: Protocol): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.last_upgrade !== undefined && (obj.last_upgrade = message.last_upgrade); + message.test !== undefined && (obj.test = message.test); + return obj; + }, + + fromPartial, I>>(object: I): Protocol { + const message = createBaseProtocol(); + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.last_upgrade = object.last_upgrade ?? "0"; + message.test = object.test ?? ""; + return message; + }, +}; + +function createBaseUpgradePlan(): UpgradePlan { + return { version: "", binaries: "", scheduled_at: "0", duration: "0" }; +} + +export const UpgradePlan = { + encode(message: UpgradePlan, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.binaries !== "") { + writer.uint32(18).string(message.binaries); + } + if (message.scheduled_at !== "0") { + writer.uint32(24).uint64(message.scheduled_at); + } + if (message.duration !== "0") { + writer.uint32(32).uint64(message.duration); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpgradePlan { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpgradePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.binaries = reader.string(); + break; + case 3: + message.scheduled_at = longToString(reader.uint64() as Long); + break; + case 4: + message.duration = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UpgradePlan { + return { + version: isSet(object.version) ? String(object.version) : "", + binaries: isSet(object.binaries) ? String(object.binaries) : "", + scheduled_at: isSet(object.scheduled_at) ? String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? String(object.duration) : "0", + }; + }, + + toJSON(message: UpgradePlan): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.binaries !== undefined && (obj.binaries = message.binaries); + message.scheduled_at !== undefined && (obj.scheduled_at = message.scheduled_at); + message.duration !== undefined && (obj.duration = message.duration); + return obj; + }, + + fromPartial, I>>(object: I): UpgradePlan { + const message = createBaseUpgradePlan(); + message.version = object.version ?? ""; + message.binaries = object.binaries ?? ""; + message.scheduled_at = object.scheduled_at ?? "0"; + message.duration = object.duration ?? "0"; + return message; + }, +}; + +function createBaseDelegationEntries(): DelegationEntries { + return { id: "0", balance: "", staker: "", k_index: "0" }; +} + +export const DelegationEntries = { + encode(message: DelegationEntries, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.balance !== "") { + writer.uint32(18).string(message.balance); + } + if (message.staker !== "") { + writer.uint32(26).string(message.staker); + } + if (message.k_index !== "0") { + writer.uint32(32).uint64(message.k_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationEntries { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationEntries(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.balance = reader.string(); + break; + case 3: + message.staker = reader.string(); + break; + case 4: + message.k_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationEntries { + return { + id: isSet(object.id) ? String(object.id) : "0", + balance: isSet(object.balance) ? String(object.balance) : "", + staker: isSet(object.staker) ? String(object.staker) : "", + k_index: isSet(object.k_index) ? String(object.k_index) : "0", + }; + }, + + toJSON(message: DelegationEntries): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.balance !== undefined && (obj.balance = message.balance); + message.staker !== undefined && (obj.staker = message.staker); + message.k_index !== undefined && (obj.k_index = message.k_index); + return obj; + }, + + fromPartial, I>>(object: I): DelegationEntries { + const message = createBaseDelegationEntries(); + message.id = object.id ?? "0"; + message.balance = object.balance ?? ""; + message.staker = object.staker ?? ""; + message.k_index = object.k_index ?? "0"; + return message; + }, +}; + +function createBaseDelegationPoolData(): DelegationPoolData { + return { + id: "0", + staker: "", + current_rewards: "0", + total_delegation: "0", + latest_index_k: "0", + delegator_count: "0", + latest_index_was_undelegation: false, + }; +} + +export const DelegationPoolData = { + encode(message: DelegationPoolData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.current_rewards !== "0") { + writer.uint32(24).uint64(message.current_rewards); + } + if (message.total_delegation !== "0") { + writer.uint32(32).uint64(message.total_delegation); + } + if (message.latest_index_k !== "0") { + writer.uint32(40).uint64(message.latest_index_k); + } + if (message.delegator_count !== "0") { + writer.uint32(48).uint64(message.delegator_count); + } + if (message.latest_index_was_undelegation === true) { + writer.uint32(56).bool(message.latest_index_was_undelegation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DelegationPoolData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationPoolData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.current_rewards = longToString(reader.uint64() as Long); + break; + case 4: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 5: + message.latest_index_k = longToString(reader.uint64() as Long); + break; + case 6: + message.delegator_count = longToString(reader.uint64() as Long); + break; + case 7: + message.latest_index_was_undelegation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DelegationPoolData { + return { + id: isSet(object.id) ? String(object.id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + current_rewards: isSet(object.current_rewards) ? String(object.current_rewards) : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + latest_index_k: isSet(object.latest_index_k) ? String(object.latest_index_k) : "0", + delegator_count: isSet(object.delegator_count) ? String(object.delegator_count) : "0", + latest_index_was_undelegation: isSet(object.latest_index_was_undelegation) + ? Boolean(object.latest_index_was_undelegation) + : false, + }; + }, + + toJSON(message: DelegationPoolData): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.staker !== undefined && (obj.staker = message.staker); + message.current_rewards !== undefined && (obj.current_rewards = message.current_rewards); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.latest_index_k !== undefined && (obj.latest_index_k = message.latest_index_k); + message.delegator_count !== undefined && (obj.delegator_count = message.delegator_count); + message.latest_index_was_undelegation !== undefined && + (obj.latest_index_was_undelegation = message.latest_index_was_undelegation); + return obj; + }, + + fromPartial, I>>(object: I): DelegationPoolData { + const message = createBaseDelegationPoolData(); + message.id = object.id ?? "0"; + message.staker = object.staker ?? ""; + message.current_rewards = object.current_rewards ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.latest_index_k = object.latest_index_k ?? "0"; + message.delegator_count = object.delegator_count ?? "0"; + message.latest_index_was_undelegation = object.latest_index_was_undelegation ?? false; + return message; + }, +}; + +function createBaseDelegator(): Delegator { + return { id: "0", k_index: "0", delegation_amount: "0", staker: "", delegator: "" }; +} + +export const Delegator = { + encode(message: Delegator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.k_index !== "0") { + writer.uint32(16).uint64(message.k_index); + } + if (message.delegation_amount !== "0") { + writer.uint32(24).uint64(message.delegation_amount); + } + if (message.staker !== "") { + writer.uint32(34).string(message.staker); + } + if (message.delegator !== "") { + writer.uint32(42).string(message.delegator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Delegator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = longToString(reader.uint64() as Long); + break; + case 2: + message.k_index = longToString(reader.uint64() as Long); + break; + case 3: + message.delegation_amount = longToString(reader.uint64() as Long); + break; + case 4: + message.staker = reader.string(); + break; + case 5: + message.delegator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Delegator { + return { + id: isSet(object.id) ? String(object.id) : "0", + k_index: isSet(object.k_index) ? String(object.k_index) : "0", + delegation_amount: isSet(object.delegation_amount) ? String(object.delegation_amount) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + delegator: isSet(object.delegator) ? String(object.delegator) : "", + }; + }, + + toJSON(message: Delegator): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.k_index !== undefined && (obj.k_index = message.k_index); + message.delegation_amount !== undefined && (obj.delegation_amount = message.delegation_amount); + message.staker !== undefined && (obj.staker = message.staker); + message.delegator !== undefined && (obj.delegator = message.delegator); + return obj; + }, + + fromPartial, I>>(object: I): Delegator { + const message = createBaseDelegator(); + message.id = object.id ?? "0"; + message.k_index = object.k_index ?? "0"; + message.delegation_amount = object.delegation_amount ?? "0"; + message.staker = object.staker ?? ""; + message.delegator = object.delegator ?? ""; + return message; + }, +}; + +function createBaseFunder(): Funder { + return { account: "", pool_id: "0", amount: "0" }; +} + +export const Funder = { + encode(message: Funder, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Funder { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.account = reader.string(); + break; + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Funder { + return { + account: isSet(object.account) ? String(object.account) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: Funder): unknown { + const obj: any = {}; + message.account !== undefined && (obj.account = message.account); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): Funder { + const message = createBaseFunder(); + message.account = object.account ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBasePool(): Pool { + return { + id: "0", + creator: "", + name: "", + runtime: "", + logo: "", + versions: "", + config: "", + current_height: "0", + total_bytes: "0", + total_bundles: "0", + total_bundle_rewards: "0", + start_height: "0", + upload_interval: "0", + operating_cost: "0", + paused: false, + funders: [], + lowest_funder: "", + total_funds: "0", + stakers: [], + lowest_staker: "", + total_stake: "0", + total_delegation: "0", + bundle_proposal: undefined, + max_bundle_size: "0", + protocol: undefined, + upgrade_plan: undefined, + start_key: "", + current_key: "", + current_value: "", + inactive_stakers: [], + total_inactive_stake: "0", + min_stake: "0", + status: PoolStatus.POOL_STATUS_UNSPECIFIED, + }; +} + +export const Pool = { + encode(message: Pool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "0") { + writer.uint32(8).uint64(message.id); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.runtime !== "") { + writer.uint32(34).string(message.runtime); + } + if (message.logo !== "") { + writer.uint32(42).string(message.logo); + } + if (message.versions !== "") { + writer.uint32(50).string(message.versions); + } + if (message.config !== "") { + writer.uint32(58).string(message.config); + } + if (message.current_height !== "0") { + writer.uint32(64).uint64(message.current_height); + } + if (message.total_bytes !== "0") { + writer.uint32(72).uint64(message.total_bytes); + } + if (message.total_bundles !== "0") { + writer.uint32(80).uint64(message.total_bundles); + } + if (message.total_bundle_rewards !== "0") { + writer.uint32(88).uint64(message.total_bundle_rewards); + } + if (message.start_height !== "0") { + writer.uint32(96).uint64(message.start_height); + } + if (message.upload_interval !== "0") { + writer.uint32(104).uint64(message.upload_interval); + } + if (message.operating_cost !== "0") { + writer.uint32(112).uint64(message.operating_cost); + } + if (message.paused === true) { + writer.uint32(120).bool(message.paused); + } + for (const v of message.funders) { + writer.uint32(130).string(v!); + } + if (message.lowest_funder !== "") { + writer.uint32(138).string(message.lowest_funder); + } + if (message.total_funds !== "0") { + writer.uint32(144).uint64(message.total_funds); + } + for (const v of message.stakers) { + writer.uint32(154).string(v!); + } + if (message.lowest_staker !== "") { + writer.uint32(162).string(message.lowest_staker); + } + if (message.total_stake !== "0") { + writer.uint32(168).uint64(message.total_stake); + } + if (message.total_delegation !== "0") { + writer.uint32(176).uint64(message.total_delegation); + } + if (message.bundle_proposal !== undefined) { + BundleProposal.encode(message.bundle_proposal, writer.uint32(186).fork()).ldelim(); + } + if (message.max_bundle_size !== "0") { + writer.uint32(192).uint64(message.max_bundle_size); + } + if (message.protocol !== undefined) { + Protocol.encode(message.protocol, writer.uint32(202).fork()).ldelim(); + } + if (message.upgrade_plan !== undefined) { + UpgradePlan.encode(message.upgrade_plan, writer.uint32(210).fork()).ldelim(); + } + if (message.start_key !== "") { + writer.uint32(218).string(message.start_key); + } + if (message.current_key !== "") { + writer.uint32(226).string(message.current_key); + } + if (message.current_value !== "") { + writer.uint32(234).string(message.current_value); + } + for (const v of message.inactive_stakers) { + writer.uint32(242).string(v!); + } + if (message.total_inactive_stake !== "0") { + writer.uint32(248).uint64(message.total_inactive_stake); + } + if (message.min_stake !== "0") { + writer.uint32(256).uint64(message.min_stake); + } + if (message.status !== PoolStatus.POOL_STATUS_UNSPECIFIED) { + writer.uint32(264).int32(poolStatusToNumber(message.status)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Pool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.id = longToString(reader.uint64() as Long); + break; + case 2: + message.creator = reader.string(); + break; + case 3: + message.name = reader.string(); + break; + case 4: + message.runtime = reader.string(); + break; + case 5: + message.logo = reader.string(); + break; + case 6: + message.versions = reader.string(); + break; + case 7: + message.config = reader.string(); + break; + case 8: + message.current_height = longToString(reader.uint64() as Long); + break; + case 9: + message.total_bytes = longToString(reader.uint64() as Long); + break; + case 10: + message.total_bundles = longToString(reader.uint64() as Long); + break; + case 11: + message.total_bundle_rewards = longToString(reader.uint64() as Long); + break; + case 12: + message.start_height = longToString(reader.uint64() as Long); + break; + case 13: + message.upload_interval = longToString(reader.uint64() as Long); + break; + case 14: + message.operating_cost = longToString(reader.uint64() as Long); + break; + case 15: + message.paused = reader.bool(); + break; + case 16: + message.funders.push(reader.string()); + break; + case 17: + message.lowest_funder = reader.string(); + break; + case 18: + message.total_funds = longToString(reader.uint64() as Long); + break; + case 19: + message.stakers.push(reader.string()); + break; + case 20: + message.lowest_staker = reader.string(); + break; + case 21: + message.total_stake = longToString(reader.uint64() as Long); + break; + case 22: + message.total_delegation = longToString(reader.uint64() as Long); + break; + case 23: + message.bundle_proposal = BundleProposal.decode(reader, reader.uint32()); + break; + case 24: + message.max_bundle_size = longToString(reader.uint64() as Long); + break; + case 25: + message.protocol = Protocol.decode(reader, reader.uint32()); + break; + case 26: + message.upgrade_plan = UpgradePlan.decode(reader, reader.uint32()); + break; + case 27: + message.start_key = reader.string(); + break; + case 28: + message.current_key = reader.string(); + break; + case 29: + message.current_value = reader.string(); + break; + case 30: + message.inactive_stakers.push(reader.string()); + break; + case 31: + message.total_inactive_stake = longToString(reader.uint64() as Long); + break; + case 32: + message.min_stake = longToString(reader.uint64() as Long); + break; + case 33: + message.status = poolStatusFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Pool { + return { + id: isSet(object.id) ? String(object.id) : "0", + creator: isSet(object.creator) ? String(object.creator) : "", + name: isSet(object.name) ? String(object.name) : "", + runtime: isSet(object.runtime) ? String(object.runtime) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + versions: isSet(object.versions) ? String(object.versions) : "", + config: isSet(object.config) ? String(object.config) : "", + current_height: isSet(object.current_height) ? String(object.current_height) : "0", + total_bytes: isSet(object.total_bytes) ? String(object.total_bytes) : "0", + total_bundles: isSet(object.total_bundles) ? String(object.total_bundles) : "0", + total_bundle_rewards: isSet(object.total_bundle_rewards) ? String(object.total_bundle_rewards) : "0", + start_height: isSet(object.start_height) ? String(object.start_height) : "0", + upload_interval: isSet(object.upload_interval) ? String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? String(object.operating_cost) : "0", + paused: isSet(object.paused) ? Boolean(object.paused) : false, + funders: Array.isArray(object?.funders) ? object.funders.map((e: any) => String(e)) : [], + lowest_funder: isSet(object.lowest_funder) ? String(object.lowest_funder) : "", + total_funds: isSet(object.total_funds) ? String(object.total_funds) : "0", + stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => String(e)) : [], + lowest_staker: isSet(object.lowest_staker) ? String(object.lowest_staker) : "", + total_stake: isSet(object.total_stake) ? String(object.total_stake) : "0", + total_delegation: isSet(object.total_delegation) ? String(object.total_delegation) : "0", + bundle_proposal: isSet(object.bundle_proposal) ? BundleProposal.fromJSON(object.bundle_proposal) : undefined, + max_bundle_size: isSet(object.max_bundle_size) ? String(object.max_bundle_size) : "0", + protocol: isSet(object.protocol) ? Protocol.fromJSON(object.protocol) : undefined, + upgrade_plan: isSet(object.upgrade_plan) ? UpgradePlan.fromJSON(object.upgrade_plan) : undefined, + start_key: isSet(object.start_key) ? String(object.start_key) : "", + current_key: isSet(object.current_key) ? String(object.current_key) : "", + current_value: isSet(object.current_value) ? String(object.current_value) : "", + inactive_stakers: Array.isArray(object?.inactive_stakers) + ? object.inactive_stakers.map((e: any) => String(e)) + : [], + total_inactive_stake: isSet(object.total_inactive_stake) ? String(object.total_inactive_stake) : "0", + min_stake: isSet(object.min_stake) ? String(object.min_stake) : "0", + status: isSet(object.status) ? poolStatusFromJSON(object.status) : PoolStatus.POOL_STATUS_UNSPECIFIED, + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.creator !== undefined && (obj.creator = message.creator); + message.name !== undefined && (obj.name = message.name); + message.runtime !== undefined && (obj.runtime = message.runtime); + message.logo !== undefined && (obj.logo = message.logo); + message.versions !== undefined && (obj.versions = message.versions); + message.config !== undefined && (obj.config = message.config); + message.current_height !== undefined && (obj.current_height = message.current_height); + message.total_bytes !== undefined && (obj.total_bytes = message.total_bytes); + message.total_bundles !== undefined && (obj.total_bundles = message.total_bundles); + message.total_bundle_rewards !== undefined && (obj.total_bundle_rewards = message.total_bundle_rewards); + message.start_height !== undefined && (obj.start_height = message.start_height); + message.upload_interval !== undefined && (obj.upload_interval = message.upload_interval); + message.operating_cost !== undefined && (obj.operating_cost = message.operating_cost); + message.paused !== undefined && (obj.paused = message.paused); + if (message.funders) { + obj.funders = message.funders.map((e) => e); + } else { + obj.funders = []; + } + message.lowest_funder !== undefined && (obj.lowest_funder = message.lowest_funder); + message.total_funds !== undefined && (obj.total_funds = message.total_funds); + if (message.stakers) { + obj.stakers = message.stakers.map((e) => e); + } else { + obj.stakers = []; + } + message.lowest_staker !== undefined && (obj.lowest_staker = message.lowest_staker); + message.total_stake !== undefined && (obj.total_stake = message.total_stake); + message.total_delegation !== undefined && (obj.total_delegation = message.total_delegation); + message.bundle_proposal !== undefined && + (obj.bundle_proposal = message.bundle_proposal ? BundleProposal.toJSON(message.bundle_proposal) : undefined); + message.max_bundle_size !== undefined && (obj.max_bundle_size = message.max_bundle_size); + message.protocol !== undefined && (obj.protocol = message.protocol ? Protocol.toJSON(message.protocol) : undefined); + message.upgrade_plan !== undefined && + (obj.upgrade_plan = message.upgrade_plan ? UpgradePlan.toJSON(message.upgrade_plan) : undefined); + message.start_key !== undefined && (obj.start_key = message.start_key); + message.current_key !== undefined && (obj.current_key = message.current_key); + message.current_value !== undefined && (obj.current_value = message.current_value); + if (message.inactive_stakers) { + obj.inactive_stakers = message.inactive_stakers.map((e) => e); + } else { + obj.inactive_stakers = []; + } + message.total_inactive_stake !== undefined && (obj.total_inactive_stake = message.total_inactive_stake); + message.min_stake !== undefined && (obj.min_stake = message.min_stake); + message.status !== undefined && (obj.status = poolStatusToJSON(message.status)); + return obj; + }, + + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.id = object.id ?? "0"; + message.creator = object.creator ?? ""; + message.name = object.name ?? ""; + message.runtime = object.runtime ?? ""; + message.logo = object.logo ?? ""; + message.versions = object.versions ?? ""; + message.config = object.config ?? ""; + message.current_height = object.current_height ?? "0"; + message.total_bytes = object.total_bytes ?? "0"; + message.total_bundles = object.total_bundles ?? "0"; + message.total_bundle_rewards = object.total_bundle_rewards ?? "0"; + message.start_height = object.start_height ?? "0"; + message.upload_interval = object.upload_interval ?? "0"; + message.operating_cost = object.operating_cost ?? "0"; + message.paused = object.paused ?? false; + message.funders = object.funders?.map((e) => e) || []; + message.lowest_funder = object.lowest_funder ?? ""; + message.total_funds = object.total_funds ?? "0"; + message.stakers = object.stakers?.map((e) => e) || []; + message.lowest_staker = object.lowest_staker ?? ""; + message.total_stake = object.total_stake ?? "0"; + message.total_delegation = object.total_delegation ?? "0"; + message.bundle_proposal = (object.bundle_proposal !== undefined && object.bundle_proposal !== null) + ? BundleProposal.fromPartial(object.bundle_proposal) + : undefined; + message.max_bundle_size = object.max_bundle_size ?? "0"; + message.protocol = (object.protocol !== undefined && object.protocol !== null) + ? Protocol.fromPartial(object.protocol) + : undefined; + message.upgrade_plan = (object.upgrade_plan !== undefined && object.upgrade_plan !== null) + ? UpgradePlan.fromPartial(object.upgrade_plan) + : undefined; + message.start_key = object.start_key ?? ""; + message.current_key = object.current_key ?? ""; + message.current_value = object.current_value ?? ""; + message.inactive_stakers = object.inactive_stakers?.map((e) => e) || []; + message.total_inactive_stake = object.total_inactive_stake ?? "0"; + message.min_stake = object.min_stake ?? "0"; + message.status = object.status ?? PoolStatus.POOL_STATUS_UNSPECIFIED; + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + storage_id: "", + pool_id: "0", + uploader: "", + from_height: "0", + to_height: "0", + finalized_at: "0", + id: "0", + key: "", + value: "", + bundle_hash: "", + }; +} + +export const Proposal = { + encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.storage_id !== "") { + writer.uint32(10).string(message.storage_id); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + if (message.uploader !== "") { + writer.uint32(26).string(message.uploader); + } + if (message.from_height !== "0") { + writer.uint32(32).uint64(message.from_height); + } + if (message.to_height !== "0") { + writer.uint32(40).uint64(message.to_height); + } + if (message.finalized_at !== "0") { + writer.uint32(48).uint64(message.finalized_at); + } + if (message.id !== "0") { + writer.uint32(56).uint64(message.id); + } + if (message.key !== "") { + writer.uint32(66).string(message.key); + } + if (message.value !== "") { + writer.uint32(74).string(message.value); + } + if (message.bundle_hash !== "") { + writer.uint32(82).string(message.bundle_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.storage_id = reader.string(); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 3: + message.uploader = reader.string(); + break; + case 4: + message.from_height = longToString(reader.uint64() as Long); + break; + case 5: + message.to_height = longToString(reader.uint64() as Long); + break; + case 6: + message.finalized_at = longToString(reader.uint64() as Long); + break; + case 7: + message.id = longToString(reader.uint64() as Long); + break; + case 8: + message.key = reader.string(); + break; + case 9: + message.value = reader.string(); + break; + case 10: + message.bundle_hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + storage_id: isSet(object.storage_id) ? String(object.storage_id) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + uploader: isSet(object.uploader) ? String(object.uploader) : "", + from_height: isSet(object.from_height) ? String(object.from_height) : "0", + to_height: isSet(object.to_height) ? String(object.to_height) : "0", + finalized_at: isSet(object.finalized_at) ? String(object.finalized_at) : "0", + id: isSet(object.id) ? String(object.id) : "0", + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "", + bundle_hash: isSet(object.bundle_hash) ? String(object.bundle_hash) : "", + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.storage_id !== undefined && (obj.storage_id = message.storage_id); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.uploader !== undefined && (obj.uploader = message.uploader); + message.from_height !== undefined && (obj.from_height = message.from_height); + message.to_height !== undefined && (obj.to_height = message.to_height); + message.finalized_at !== undefined && (obj.finalized_at = message.finalized_at); + message.id !== undefined && (obj.id = message.id); + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + message.bundle_hash !== undefined && (obj.bundle_hash = message.bundle_hash); + return obj; + }, + + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.storage_id = object.storage_id ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.uploader = object.uploader ?? ""; + message.from_height = object.from_height ?? "0"; + message.to_height = object.to_height ?? "0"; + message.finalized_at = object.finalized_at ?? "0"; + message.id = object.id ?? "0"; + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.bundle_hash = object.bundle_hash ?? ""; + return message; + }, +}; + +function createBaseStaker(): Staker { + return { + account: "", + pool_id: "0", + amount: "0", + unbonding_amount: "0", + commission: "", + moniker: "", + website: "", + logo: "", + points: "0", + status: StakerStatus.STAKER_STATUS_UNSPECIFIED, + }; +} + +export const Staker = { + encode(message: Staker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + if (message.amount !== "0") { + writer.uint32(24).uint64(message.amount); + } + if (message.unbonding_amount !== "0") { + writer.uint32(32).uint64(message.unbonding_amount); + } + if (message.commission !== "") { + writer.uint32(42).string(message.commission); + } + if (message.moniker !== "") { + writer.uint32(50).string(message.moniker); + } + if (message.website !== "") { + writer.uint32(58).string(message.website); + } + if (message.logo !== "") { + writer.uint32(66).string(message.logo); + } + if (message.points !== "0") { + writer.uint32(72).uint64(message.points); + } + if (message.status !== StakerStatus.STAKER_STATUS_UNSPECIFIED) { + writer.uint32(80).int32(stakerStatusToNumber(message.status)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Staker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 3: + message.amount = longToString(reader.uint64() as Long); + break; + case 4: + message.unbonding_amount = longToString(reader.uint64() as Long); + break; + case 5: + message.commission = reader.string(); + break; + case 6: + message.moniker = reader.string(); + break; + case 7: + message.website = reader.string(); + break; + case 8: + message.logo = reader.string(); + break; + case 9: + message.points = longToString(reader.uint64() as Long); + break; + case 10: + message.status = stakerStatusFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Staker { + return { + account: isSet(object.account) ? String(object.account) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + unbonding_amount: isSet(object.unbonding_amount) ? String(object.unbonding_amount) : "0", + commission: isSet(object.commission) ? String(object.commission) : "", + moniker: isSet(object.moniker) ? String(object.moniker) : "", + website: isSet(object.website) ? String(object.website) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + points: isSet(object.points) ? String(object.points) : "0", + status: isSet(object.status) ? stakerStatusFromJSON(object.status) : StakerStatus.STAKER_STATUS_UNSPECIFIED, + }; + }, + + toJSON(message: Staker): unknown { + const obj: any = {}; + message.account !== undefined && (obj.account = message.account); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.amount !== undefined && (obj.amount = message.amount); + message.unbonding_amount !== undefined && (obj.unbonding_amount = message.unbonding_amount); + message.commission !== undefined && (obj.commission = message.commission); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.website !== undefined && (obj.website = message.website); + message.logo !== undefined && (obj.logo = message.logo); + message.points !== undefined && (obj.points = message.points); + message.status !== undefined && (obj.status = stakerStatusToJSON(message.status)); + return obj; + }, + + fromPartial, I>>(object: I): Staker { + const message = createBaseStaker(); + message.account = object.account ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.amount = object.amount ?? "0"; + message.unbonding_amount = object.unbonding_amount ?? "0"; + message.commission = object.commission ?? ""; + message.moniker = object.moniker ?? ""; + message.website = object.website ?? ""; + message.logo = object.logo ?? ""; + message.points = object.points ?? "0"; + message.status = object.status ?? StakerStatus.STAKER_STATUS_UNSPECIFIED; + return message; + }, +}; + +function createBaseUnbondingStakingQueueEntry(): UnbondingStakingQueueEntry { + return { index: "0", staker: "", pool_id: "0", amount: "0", creation_time: "0" }; +} + +export const UnbondingStakingQueueEntry = { + encode(message: UnbondingStakingQueueEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + if (message.creation_time !== "0") { + writer.uint32(40).uint64(message.creation_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingStakingQueueEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingStakingQueueEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + case 5: + message.creation_time = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingStakingQueueEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? String(object.creation_time) : "0", + }; + }, + + toJSON(message: UnbondingStakingQueueEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.amount !== undefined && (obj.amount = message.amount); + message.creation_time !== undefined && (obj.creation_time = message.creation_time); + return obj; + }, + + fromPartial, I>>(object: I): UnbondingStakingQueueEntry { + const message = createBaseUnbondingStakingQueueEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.amount = object.amount ?? "0"; + message.creation_time = object.creation_time ?? "0"; + return message; + }, +}; + +function createBaseUnbondingStaker(): UnbondingStaker { + return { staker: "", pool_id: "0", unbonding_amount: "0" }; +} + +export const UnbondingStaker = { + encode(message: UnbondingStaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + if (message.unbonding_amount !== "0") { + writer.uint32(24).uint64(message.unbonding_amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingStaker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 3: + message.unbonding_amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingStaker { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + unbonding_amount: isSet(object.unbonding_amount) ? String(object.unbonding_amount) : "0", + }; + }, + + toJSON(message: UnbondingStaker): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.unbonding_amount !== undefined && (obj.unbonding_amount = message.unbonding_amount); + return obj; + }, + + fromPartial, I>>(object: I): UnbondingStaker { + const message = createBaseUnbondingStaker(); + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.unbonding_amount = object.unbonding_amount ?? "0"; + return message; + }, +}; + +function createBaseUnbondingStakingQueueState(): UnbondingStakingQueueState { + return { low_index: "0", high_index: "0" }; +} + +export const UnbondingStakingQueueState = { + encode(message: UnbondingStakingQueueState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.low_index !== "0") { + writer.uint32(8).uint64(message.low_index); + } + if (message.high_index !== "0") { + writer.uint32(16).uint64(message.high_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingStakingQueueState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingStakingQueueState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.low_index = longToString(reader.uint64() as Long); + break; + case 2: + message.high_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingStakingQueueState { + return { + low_index: isSet(object.low_index) ? String(object.low_index) : "0", + high_index: isSet(object.high_index) ? String(object.high_index) : "0", + }; + }, + + toJSON(message: UnbondingStakingQueueState): unknown { + const obj: any = {}; + message.low_index !== undefined && (obj.low_index = message.low_index); + message.high_index !== undefined && (obj.high_index = message.high_index); + return obj; + }, + + fromPartial, I>>(object: I): UnbondingStakingQueueState { + const message = createBaseUnbondingStakingQueueState(); + message.low_index = object.low_index ?? "0"; + message.high_index = object.high_index ?? "0"; + return message; + }, +}; + +function createBaseUnbondingDelegationQueueEntry(): UnbondingDelegationQueueEntry { + return { index: "0", staker: "", delegator: "", pool_id: "0", amount: "0", creation_time: "0" }; +} + +export const UnbondingDelegationQueueEntry = { + encode(message: UnbondingDelegationQueueEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.delegator !== "") { + writer.uint32(26).string(message.delegator); + } + if (message.pool_id !== "0") { + writer.uint32(32).uint64(message.pool_id); + } + if (message.amount !== "0") { + writer.uint32(40).uint64(message.amount); + } + if (message.creation_time !== "0") { + writer.uint32(48).uint64(message.creation_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegationQueueEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationQueueEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.delegator = reader.string(); + break; + case 4: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 5: + message.amount = longToString(reader.uint64() as Long); + break; + case 6: + message.creation_time = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationQueueEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + delegator: isSet(object.delegator) ? String(object.delegator) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + amount: isSet(object.amount) ? String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? String(object.creation_time) : "0", + }; + }, + + toJSON(message: UnbondingDelegationQueueEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.delegator !== undefined && (obj.delegator = message.delegator); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.amount !== undefined && (obj.amount = message.amount); + message.creation_time !== undefined && (obj.creation_time = message.creation_time); + return obj; + }, + + fromPartial, I>>( + object: I, + ): UnbondingDelegationQueueEntry { + const message = createBaseUnbondingDelegationQueueEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.delegator = object.delegator ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.amount = object.amount ?? "0"; + message.creation_time = object.creation_time ?? "0"; + return message; + }, +}; + +function createBaseUnbondingDelegationQueueState(): UnbondingDelegationQueueState { + return { low_index: "0", high_index: "0" }; +} + +export const UnbondingDelegationQueueState = { + encode(message: UnbondingDelegationQueueState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.low_index !== "0") { + writer.uint32(8).uint64(message.low_index); + } + if (message.high_index !== "0") { + writer.uint32(16).uint64(message.high_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegationQueueState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationQueueState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.low_index = longToString(reader.uint64() as Long); + break; + case 2: + message.high_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationQueueState { + return { + low_index: isSet(object.low_index) ? String(object.low_index) : "0", + high_index: isSet(object.high_index) ? String(object.high_index) : "0", + }; + }, + + toJSON(message: UnbondingDelegationQueueState): unknown { + const obj: any = {}; + message.low_index !== undefined && (obj.low_index = message.low_index); + message.high_index !== undefined && (obj.high_index = message.high_index); + return obj; + }, + + fromPartial, I>>( + object: I, + ): UnbondingDelegationQueueState { + const message = createBaseUnbondingDelegationQueueState(); + message.low_index = object.low_index ?? "0"; + message.high_index = object.high_index ?? "0"; + return message; + }, +}; + +function createBaseRedelegationCooldown(): RedelegationCooldown { + return { address: "", creation_date: "0" }; +} + +export const RedelegationCooldown = { + encode(message: RedelegationCooldown, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.creation_date !== "0") { + writer.uint32(16).uint64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationCooldown { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationCooldown(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.creation_date = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RedelegationCooldown { + return { + address: isSet(object.address) ? String(object.address) : "", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: RedelegationCooldown): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): RedelegationCooldown { + const message = createBaseRedelegationCooldown(); + message.address = object.address ?? ""; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +function createBaseCommissionChangeQueueEntry(): CommissionChangeQueueEntry { + return { index: "0", staker: "", pool_id: "0", commission: "", creation_date: "0" }; +} + +export const CommissionChangeQueueEntry = { + encode(message: CommissionChangeQueueEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.commission !== "") { + writer.uint32(34).string(message.commission); + } + if (message.creation_date !== "0") { + writer.uint32(40).int64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeQueueEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionChangeQueueEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.commission = reader.string(); + break; + case 5: + message.creation_date = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommissionChangeQueueEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + commission: isSet(object.commission) ? String(object.commission) : "", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: CommissionChangeQueueEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.commission !== undefined && (obj.commission = message.commission); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): CommissionChangeQueueEntry { + const message = createBaseCommissionChangeQueueEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.commission = object.commission ?? ""; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +function createBaseCommissionChangeQueueState(): CommissionChangeQueueState { + return { low_index: "0", high_index: "0" }; +} + +export const CommissionChangeQueueState = { + encode(message: CommissionChangeQueueState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.low_index !== "0") { + writer.uint32(8).uint64(message.low_index); + } + if (message.high_index !== "0") { + writer.uint32(16).uint64(message.high_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeQueueState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionChangeQueueState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.low_index = longToString(reader.uint64() as Long); + break; + case 2: + message.high_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommissionChangeQueueState { + return { + low_index: isSet(object.low_index) ? String(object.low_index) : "0", + high_index: isSet(object.high_index) ? String(object.high_index) : "0", + }; + }, + + toJSON(message: CommissionChangeQueueState): unknown { + const obj: any = {}; + message.low_index !== undefined && (obj.low_index = message.low_index); + message.high_index !== undefined && (obj.high_index = message.high_index); + return obj; + }, + + fromPartial, I>>(object: I): CommissionChangeQueueState { + const message = createBaseCommissionChangeQueueState(); + message.low_index = object.low_index ?? "0"; + message.high_index = object.high_index ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/events.ts b/common/types/src/lcd/kyve/stakers/v1beta1/events.ts new file mode 100644 index 00000000..a780e91b --- /dev/null +++ b/common/types/src/lcd/kyve/stakers/v1beta1/events.ts @@ -0,0 +1,418 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** + * EventCreateStaker is an event emitted when a protocol node stakes in a pool. + * emitted_by: MsgCreateStaker + */ +export interface EventCreateStaker { + /** staker is the account address of the protocol node. */ + staker: string; + /** amount ... */ + amount: string; +} + +/** + * EventUpdateMetadata is an event emitted when a protocol node updates their metadata. + * emitted_by: MsgUpdateMetadata + */ +export interface EventUpdateMetadata { + /** staker is the account address of the protocol node. */ + staker: string; + /** moniker ... */ + moniker: string; + /** website ... */ + website: string; + /** logo ... */ + logo: string; +} + +/** + * EventUpdateCommission ... + * emitted_by: EndBlock + */ +export interface EventUpdateCommission { + /** staker is the account address of the protocol node. */ + staker: string; + /** commission ... */ + commission: string; +} + +/** + * EventJoinPool ... + * emitted_by: MsgJoinPool + */ +export interface EventJoinPool { + /** pool_id ... */ + pool_id: string; + /** staker ... */ + staker: string; + /** valaddress ... */ + valaddress: string; + /** amount ... */ + amount: string; +} + +/** + * EventLeavePool ... + * emitted_by: EndBlock + */ +export interface EventLeavePool { + /** pool_id ... */ + pool_id: string; + /** staker ... */ + staker: string; +} + +function createBaseEventCreateStaker(): EventCreateStaker { + return { staker: "", amount: "0" }; +} + +export const EventCreateStaker = { + encode(message: EventCreateStaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.amount !== "0") { + writer.uint32(16).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateStaker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreateStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventCreateStaker { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventCreateStaker): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventCreateStaker { + const message = createBaseEventCreateStaker(); + message.staker = object.staker ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventUpdateMetadata(): EventUpdateMetadata { + return { staker: "", moniker: "", website: "", logo: "" }; +} + +export const EventUpdateMetadata = { + encode(message: EventUpdateMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.moniker !== "") { + writer.uint32(18).string(message.moniker); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateMetadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.moniker = reader.string(); + break; + case 3: + message.website = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventUpdateMetadata { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + moniker: isSet(object.moniker) ? String(object.moniker) : "", + website: isSet(object.website) ? String(object.website) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + }; + }, + + toJSON(message: EventUpdateMetadata): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.website !== undefined && (obj.website = message.website); + message.logo !== undefined && (obj.logo = message.logo); + return obj; + }, + + fromPartial, I>>(object: I): EventUpdateMetadata { + const message = createBaseEventUpdateMetadata(); + message.staker = object.staker ?? ""; + message.moniker = object.moniker ?? ""; + message.website = object.website ?? ""; + message.logo = object.logo ?? ""; + return message; + }, +}; + +function createBaseEventUpdateCommission(): EventUpdateCommission { + return { staker: "", commission: "" }; +} + +export const EventUpdateCommission = { + encode(message: EventUpdateCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.staker !== "") { + writer.uint32(10).string(message.staker); + } + if (message.commission !== "") { + writer.uint32(18).string(message.commission); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateCommission { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.staker = reader.string(); + break; + case 2: + message.commission = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventUpdateCommission { + return { + staker: isSet(object.staker) ? String(object.staker) : "", + commission: isSet(object.commission) ? String(object.commission) : "", + }; + }, + + toJSON(message: EventUpdateCommission): unknown { + const obj: any = {}; + message.staker !== undefined && (obj.staker = message.staker); + message.commission !== undefined && (obj.commission = message.commission); + return obj; + }, + + fromPartial, I>>(object: I): EventUpdateCommission { + const message = createBaseEventUpdateCommission(); + message.staker = object.staker ?? ""; + message.commission = object.commission ?? ""; + return message; + }, +}; + +function createBaseEventJoinPool(): EventJoinPool { + return { pool_id: "0", staker: "", valaddress: "", amount: "0" }; +} + +export const EventJoinPool = { + encode(message: EventJoinPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.valaddress !== "") { + writer.uint32(26).string(message.valaddress); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventJoinPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventJoinPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.valaddress = reader.string(); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventJoinPool { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + valaddress: isSet(object.valaddress) ? String(object.valaddress) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: EventJoinPool): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.valaddress !== undefined && (obj.valaddress = message.valaddress); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): EventJoinPool { + const message = createBaseEventJoinPool(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.valaddress = object.valaddress ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseEventLeavePool(): EventLeavePool { + return { pool_id: "0", staker: "" }; +} + +export const EventLeavePool = { + encode(message: EventLeavePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventLeavePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventLeavePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventLeavePool { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + }; + }, + + toJSON(message: EventLeavePool): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + return obj; + }, + + fromPartial, I>>(object: I): EventLeavePool { + const message = createBaseEventLeavePool(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/genesis.ts b/common/types/src/lcd/kyve/stakers/v1beta1/genesis.ts new file mode 100644 index 00000000..792284ab --- /dev/null +++ b/common/types/src/lcd/kyve/stakers/v1beta1/genesis.ts @@ -0,0 +1,187 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./params"; +import { CommissionChangeEntry, LeavePoolEntry, QueueState, Staker, Valaccount } from "./stakers"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** GenesisState defines the stakers module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params?: Params; + /** staker_list ... */ + staker_list: Staker[]; + /** valaccount_list ... */ + valaccount_list: Valaccount[]; + /** commission_change_entries ... */ + commission_change_entries: CommissionChangeEntry[]; + /** queue_state_commission ... */ + queue_state_commission?: QueueState; + /** leave_pool_entries ... */ + leave_pool_entries: LeavePoolEntry[]; + /** queue_state_leave ... */ + queue_state_leave?: QueueState; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + staker_list: [], + valaccount_list: [], + commission_change_entries: [], + queue_state_commission: undefined, + leave_pool_entries: [], + queue_state_leave: undefined, + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.staker_list) { + Staker.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.valaccount_list) { + Valaccount.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.commission_change_entries) { + CommissionChangeEntry.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.queue_state_commission !== undefined) { + QueueState.encode(message.queue_state_commission, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.leave_pool_entries) { + LeavePoolEntry.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.queue_state_leave !== undefined) { + QueueState.encode(message.queue_state_leave, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.staker_list.push(Staker.decode(reader, reader.uint32())); + break; + case 3: + message.valaccount_list.push(Valaccount.decode(reader, reader.uint32())); + break; + case 4: + message.commission_change_entries.push(CommissionChangeEntry.decode(reader, reader.uint32())); + break; + case 5: + message.queue_state_commission = QueueState.decode(reader, reader.uint32()); + break; + case 6: + message.leave_pool_entries.push(LeavePoolEntry.decode(reader, reader.uint32())); + break; + case 7: + message.queue_state_leave = QueueState.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + staker_list: Array.isArray(object?.staker_list) ? object.staker_list.map((e: any) => Staker.fromJSON(e)) : [], + valaccount_list: Array.isArray(object?.valaccount_list) + ? object.valaccount_list.map((e: any) => Valaccount.fromJSON(e)) + : [], + commission_change_entries: Array.isArray(object?.commission_change_entries) + ? object.commission_change_entries.map((e: any) => CommissionChangeEntry.fromJSON(e)) + : [], + queue_state_commission: isSet(object.queue_state_commission) + ? QueueState.fromJSON(object.queue_state_commission) + : undefined, + leave_pool_entries: Array.isArray(object?.leave_pool_entries) + ? object.leave_pool_entries.map((e: any) => LeavePoolEntry.fromJSON(e)) + : [], + queue_state_leave: isSet(object.queue_state_leave) ? QueueState.fromJSON(object.queue_state_leave) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.staker_list) { + obj.staker_list = message.staker_list.map((e) => e ? Staker.toJSON(e) : undefined); + } else { + obj.staker_list = []; + } + if (message.valaccount_list) { + obj.valaccount_list = message.valaccount_list.map((e) => e ? Valaccount.toJSON(e) : undefined); + } else { + obj.valaccount_list = []; + } + if (message.commission_change_entries) { + obj.commission_change_entries = message.commission_change_entries.map((e) => + e ? CommissionChangeEntry.toJSON(e) : undefined + ); + } else { + obj.commission_change_entries = []; + } + message.queue_state_commission !== undefined && (obj.queue_state_commission = message.queue_state_commission + ? QueueState.toJSON(message.queue_state_commission) + : undefined); + if (message.leave_pool_entries) { + obj.leave_pool_entries = message.leave_pool_entries.map((e) => e ? LeavePoolEntry.toJSON(e) : undefined); + } else { + obj.leave_pool_entries = []; + } + message.queue_state_leave !== undefined && + (obj.queue_state_leave = message.queue_state_leave ? QueueState.toJSON(message.queue_state_leave) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + message.staker_list = object.staker_list?.map((e) => Staker.fromPartial(e)) || []; + message.valaccount_list = object.valaccount_list?.map((e) => Valaccount.fromPartial(e)) || []; + message.commission_change_entries = + object.commission_change_entries?.map((e) => CommissionChangeEntry.fromPartial(e)) || []; + message.queue_state_commission = + (object.queue_state_commission !== undefined && object.queue_state_commission !== null) + ? QueueState.fromPartial(object.queue_state_commission) + : undefined; + message.leave_pool_entries = object.leave_pool_entries?.map((e) => LeavePoolEntry.fromPartial(e)) || []; + message.queue_state_leave = (object.queue_state_leave !== undefined && object.queue_state_leave !== null) + ? QueueState.fromPartial(object.queue_state_leave) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/params.ts b/common/types/src/lcd/kyve/stakers/v1beta1/params.ts new file mode 100644 index 00000000..a7917aaa --- /dev/null +++ b/common/types/src/lcd/kyve/stakers/v1beta1/params.ts @@ -0,0 +1,95 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** Params defines the stakers module parameters. */ +export interface Params { + /** commission_change_time ... */ + commission_change_time: string; + /** commission_change_time ... */ + leave_pool_time: string; +} + +function createBaseParams(): Params { + return { commission_change_time: "0", leave_pool_time: "0" }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.commission_change_time !== "0") { + writer.uint32(8).uint64(message.commission_change_time); + } + if (message.leave_pool_time !== "0") { + writer.uint32(16).uint64(message.leave_pool_time); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.commission_change_time = longToString(reader.uint64() as Long); + break; + case 2: + message.leave_pool_time = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + commission_change_time: isSet(object.commission_change_time) ? String(object.commission_change_time) : "0", + leave_pool_time: isSet(object.leave_pool_time) ? String(object.leave_pool_time) : "0", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.commission_change_time !== undefined && (obj.commission_change_time = message.commission_change_time); + message.leave_pool_time !== undefined && (obj.leave_pool_time = message.leave_pool_time); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.commission_change_time = object.commission_change_time ?? "0"; + message.leave_pool_time = object.leave_pool_time ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/query.ts b/common/types/src/lcd/kyve/stakers/v1beta1/query.ts new file mode 100644 index 00000000..cea644b1 --- /dev/null +++ b/common/types/src/lcd/kyve/stakers/v1beta1/query.ts @@ -0,0 +1,143 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Params } from "./params"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.stakers.v1beta1.Query"; + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/stakers.ts b/common/types/src/lcd/kyve/stakers/v1beta1/stakers.ts new file mode 100644 index 00000000..e4c1401c --- /dev/null +++ b/common/types/src/lcd/kyve/stakers/v1beta1/stakers.ts @@ -0,0 +1,512 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** + * Staker contains all metadata for a staker + * Every address can only create one staker (itself) + */ +export interface Staker { + /** address ... */ + address: string; + /** commission ... */ + commission: string; + /** moniker ... */ + moniker: string; + /** website ... */ + website: string; + /** logo ... */ + logo: string; +} + +/** + * Valaccount gets authorized by a staker to + * vote in a given pool by favor of the staker. + */ +export interface Valaccount { + /** + * pool_id defines the pool in which the address + * is allowed to vote in. + */ + pool_id: string; + /** staker is the address the valaccount is voting for. */ + staker: string; + /** + * valaddress is the account stored on the protocol + * node which votes for the staker in the given pool + */ + valaddress: string; + /** + * When a node is inactive (does not vote at all) + * A point is added, after a certain amount of points + * is reached the node gets kicked out. + */ + points: string; + /** isLeaving indicates if a staker is leaving the given pool. */ + is_leaving: boolean; +} + +/** + * CommissionChangeEntry stores the information for an + * upcoming commission change. A commission change is never + * instant, so delegators have time to redelegate in case + * they don't agree with the new commission. + */ +export interface CommissionChangeEntry { + /** + * index is needed for the queue-algorithm which + * processes the commission changes + */ + index: string; + /** staker is the address of the affected staker */ + staker: string; + /** + * commission is the new commission which will + * be applied after the waiting time is over. + */ + commission: string; + /** + * creation_date is the UNIX-timestamp in seconds + * when the entry was created. + */ + creation_date: string; +} + +/** + * LeavePoolEntry stores the information for an upcoming + * pool leave. A staker can't leave a pool instantly. + * Instead a the `LeaveTime` needs to be awaited. + * If a staker start to leave a pool, it will be shown + * in the UI to the delegators. + */ +export interface LeavePoolEntry { + /** index ... */ + index: string; + /** staker ... */ + staker: string; + /** pool_id ... */ + pool_id: string; + /** creation_date ... */ + creation_date: string; +} + +/** UnbondingState stores the state for the unbonding of stakes and delegations. */ +export interface QueueState { + /** + * low_index is the tail of the queue. It is the + * oldest entry in the queue. If this entry isn't + * due, non of the other entries is. + */ + low_index: string; + /** + * high_index is the head of the queue. New entries + * are added to the top. + */ + high_index: string; +} + +function createBaseStaker(): Staker { + return { address: "", commission: "", moniker: "", website: "", logo: "" }; +} + +export const Staker = { + encode(message: Staker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.commission !== "") { + writer.uint32(18).string(message.commission); + } + if (message.moniker !== "") { + writer.uint32(26).string(message.moniker); + } + if (message.website !== "") { + writer.uint32(34).string(message.website); + } + if (message.logo !== "") { + writer.uint32(42).string(message.logo); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Staker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.commission = reader.string(); + break; + case 3: + message.moniker = reader.string(); + break; + case 4: + message.website = reader.string(); + break; + case 5: + message.logo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Staker { + return { + address: isSet(object.address) ? String(object.address) : "", + commission: isSet(object.commission) ? String(object.commission) : "", + moniker: isSet(object.moniker) ? String(object.moniker) : "", + website: isSet(object.website) ? String(object.website) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + }; + }, + + toJSON(message: Staker): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.commission !== undefined && (obj.commission = message.commission); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.website !== undefined && (obj.website = message.website); + message.logo !== undefined && (obj.logo = message.logo); + return obj; + }, + + fromPartial, I>>(object: I): Staker { + const message = createBaseStaker(); + message.address = object.address ?? ""; + message.commission = object.commission ?? ""; + message.moniker = object.moniker ?? ""; + message.website = object.website ?? ""; + message.logo = object.logo ?? ""; + return message; + }, +}; + +function createBaseValaccount(): Valaccount { + return { pool_id: "0", staker: "", valaddress: "", points: "0", is_leaving: false }; +} + +export const Valaccount = { + encode(message: Valaccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.valaddress !== "") { + writer.uint32(26).string(message.valaddress); + } + if (message.points !== "0") { + writer.uint32(32).uint64(message.points); + } + if (message.is_leaving === true) { + writer.uint32(40).bool(message.is_leaving); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Valaccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValaccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.valaddress = reader.string(); + break; + case 4: + message.points = longToString(reader.uint64() as Long); + break; + case 5: + message.is_leaving = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Valaccount { + return { + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + valaddress: isSet(object.valaddress) ? String(object.valaddress) : "", + points: isSet(object.points) ? String(object.points) : "0", + is_leaving: isSet(object.is_leaving) ? Boolean(object.is_leaving) : false, + }; + }, + + toJSON(message: Valaccount): unknown { + const obj: any = {}; + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.staker !== undefined && (obj.staker = message.staker); + message.valaddress !== undefined && (obj.valaddress = message.valaddress); + message.points !== undefined && (obj.points = message.points); + message.is_leaving !== undefined && (obj.is_leaving = message.is_leaving); + return obj; + }, + + fromPartial, I>>(object: I): Valaccount { + const message = createBaseValaccount(); + message.pool_id = object.pool_id ?? "0"; + message.staker = object.staker ?? ""; + message.valaddress = object.valaddress ?? ""; + message.points = object.points ?? "0"; + message.is_leaving = object.is_leaving ?? false; + return message; + }, +}; + +function createBaseCommissionChangeEntry(): CommissionChangeEntry { + return { index: "0", staker: "", commission: "", creation_date: "0" }; +} + +export const CommissionChangeEntry = { + encode(message: CommissionChangeEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.commission !== "") { + writer.uint32(26).string(message.commission); + } + if (message.creation_date !== "0") { + writer.uint32(32).int64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionChangeEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.commission = reader.string(); + break; + case 4: + message.creation_date = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CommissionChangeEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + commission: isSet(object.commission) ? String(object.commission) : "", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: CommissionChangeEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.commission !== undefined && (obj.commission = message.commission); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): CommissionChangeEntry { + const message = createBaseCommissionChangeEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.commission = object.commission ?? ""; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +function createBaseLeavePoolEntry(): LeavePoolEntry { + return { index: "0", staker: "", pool_id: "0", creation_date: "0" }; +} + +export const LeavePoolEntry = { + encode(message: LeavePoolEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.index !== "0") { + writer.uint32(8).uint64(message.index); + } + if (message.staker !== "") { + writer.uint32(18).string(message.staker); + } + if (message.pool_id !== "0") { + writer.uint32(24).uint64(message.pool_id); + } + if (message.creation_date !== "0") { + writer.uint32(32).int64(message.creation_date); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LeavePoolEntry { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeavePoolEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = longToString(reader.uint64() as Long); + break; + case 2: + message.staker = reader.string(); + break; + case 3: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 4: + message.creation_date = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LeavePoolEntry { + return { + index: isSet(object.index) ? String(object.index) : "0", + staker: isSet(object.staker) ? String(object.staker) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + creation_date: isSet(object.creation_date) ? String(object.creation_date) : "0", + }; + }, + + toJSON(message: LeavePoolEntry): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.staker !== undefined && (obj.staker = message.staker); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.creation_date !== undefined && (obj.creation_date = message.creation_date); + return obj; + }, + + fromPartial, I>>(object: I): LeavePoolEntry { + const message = createBaseLeavePoolEntry(); + message.index = object.index ?? "0"; + message.staker = object.staker ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.creation_date = object.creation_date ?? "0"; + return message; + }, +}; + +function createBaseQueueState(): QueueState { + return { low_index: "0", high_index: "0" }; +} + +export const QueueState = { + encode(message: QueueState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.low_index !== "0") { + writer.uint32(8).uint64(message.low_index); + } + if (message.high_index !== "0") { + writer.uint32(16).uint64(message.high_index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueueState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.low_index = longToString(reader.uint64() as Long); + break; + case 2: + message.high_index = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueueState { + return { + low_index: isSet(object.low_index) ? String(object.low_index) : "0", + high_index: isSet(object.high_index) ? String(object.high_index) : "0", + }; + }, + + toJSON(message: QueueState): unknown { + const obj: any = {}; + message.low_index !== undefined && (obj.low_index = message.low_index); + message.high_index !== undefined && (obj.high_index = message.high_index); + return obj; + }, + + fromPartial, I>>(object: I): QueueState { + const message = createBaseQueueState(); + message.low_index = object.low_index ?? "0"; + message.high_index = object.high_index ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/tx.ts b/common/types/src/lcd/kyve/stakers/v1beta1/tx.ts new file mode 100644 index 00000000..4b8624ef --- /dev/null +++ b/common/types/src/lcd/kyve/stakers/v1beta1/tx.ts @@ -0,0 +1,800 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "kyve.stakers.v1beta1"; + +/** MsgStakePool defines a SDK message for staking in a pool. */ +export interface MsgCreateStaker { + /** creator ... */ + creator: string; + /** amount ... */ + amount: string; +} + +/** MsgStakePoolResponse defines the Msg/StakePool response type. */ +export interface MsgCreateStakerResponse { +} + +/** MsgUpdateMetadata defines a SDK message for claiming the uploader role. */ +export interface MsgUpdateMetadata { + /** creator ... */ + creator: string; + /** moniker ... */ + moniker: string; + /** website ... */ + website: string; + /** logo */ + logo: string; +} + +/** MsgUpdateMetadataResponse defines the Msg/MsgUpdateMetadata response type. */ +export interface MsgUpdateMetadataResponse { +} + +/** MsgUpdateCommission ... */ +export interface MsgUpdateCommission { + /** creator ... */ + creator: string; + /** commission ... */ + commission: string; +} + +/** MsgUpdateCommissionResponse ... */ +export interface MsgUpdateCommissionResponse { +} + +/** MsgJoinPool ... */ +export interface MsgJoinPool { + /** creator ... */ + creator: string; + /** pool_id ... */ + pool_id: string; + /** valaddress ... */ + valaddress: string; + /** amount ... */ + amount: string; +} + +/** MsgJoinPoolResponse ... */ +export interface MsgJoinPoolResponse { +} + +/** MsgLeavePool ... */ +export interface MsgLeavePool { + /** creator ... */ + creator: string; + /** pool_id ... */ + pool_id: string; +} + +/** MsgReactivateStakerResponse ... */ +export interface MsgLeavePoolResponse { +} + +/** MsgUpdateParams defines a SDK message for updating the module parameters. */ +export interface MsgUpdateParams { + /** authority is the address of the governance account. */ + authority: string; + /** payload defines the x/stakers parameters to update. */ + payload: string; +} + +/** MsgUpdateParamsResponse defines the Msg/UpdateParams response type. */ +export interface MsgUpdateParamsResponse { +} + +function createBaseMsgCreateStaker(): MsgCreateStaker { + return { creator: "", amount: "0" }; +} + +export const MsgCreateStaker = { + encode(message: MsgCreateStaker, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.amount !== "0") { + writer.uint32(16).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateStaker { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateStaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateStaker { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgCreateStaker): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgCreateStaker { + const message = createBaseMsgCreateStaker(); + message.creator = object.creator ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgCreateStakerResponse(): MsgCreateStakerResponse { + return {}; +} + +export const MsgCreateStakerResponse = { + encode(_: MsgCreateStakerResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateStakerResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateStakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCreateStakerResponse { + return {}; + }, + + toJSON(_: MsgCreateStakerResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgCreateStakerResponse { + const message = createBaseMsgCreateStakerResponse(); + return message; + }, +}; + +function createBaseMsgUpdateMetadata(): MsgUpdateMetadata { + return { creator: "", moniker: "", website: "", logo: "" }; +} + +export const MsgUpdateMetadata = { + encode(message: MsgUpdateMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.moniker !== "") { + writer.uint32(18).string(message.moniker); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.logo !== "") { + writer.uint32(34).string(message.logo); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateMetadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.moniker = reader.string(); + break; + case 3: + message.website = reader.string(); + break; + case 4: + message.logo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateMetadata { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + moniker: isSet(object.moniker) ? String(object.moniker) : "", + website: isSet(object.website) ? String(object.website) : "", + logo: isSet(object.logo) ? String(object.logo) : "", + }; + }, + + toJSON(message: MsgUpdateMetadata): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.website !== undefined && (obj.website = message.website); + message.logo !== undefined && (obj.logo = message.logo); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateMetadata { + const message = createBaseMsgUpdateMetadata(); + message.creator = object.creator ?? ""; + message.moniker = object.moniker ?? ""; + message.website = object.website ?? ""; + message.logo = object.logo ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateMetadataResponse(): MsgUpdateMetadataResponse { + return {}; +} + +export const MsgUpdateMetadataResponse = { + encode(_: MsgUpdateMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateMetadataResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUpdateMetadataResponse { + return {}; + }, + + toJSON(_: MsgUpdateMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateMetadataResponse { + const message = createBaseMsgUpdateMetadataResponse(); + return message; + }, +}; + +function createBaseMsgUpdateCommission(): MsgUpdateCommission { + return { creator: "", commission: "" }; +} + +export const MsgUpdateCommission = { + encode(message: MsgUpdateCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.commission !== "") { + writer.uint32(18).string(message.commission); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateCommission { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.commission = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateCommission { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + commission: isSet(object.commission) ? String(object.commission) : "", + }; + }, + + toJSON(message: MsgUpdateCommission): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.commission !== undefined && (obj.commission = message.commission); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateCommission { + const message = createBaseMsgUpdateCommission(); + message.creator = object.creator ?? ""; + message.commission = object.commission ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateCommissionResponse(): MsgUpdateCommissionResponse { + return {}; +} + +export const MsgUpdateCommissionResponse = { + encode(_: MsgUpdateCommissionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateCommissionResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgUpdateCommissionResponse { + return {}; + }, + + toJSON(_: MsgUpdateCommissionResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateCommissionResponse { + const message = createBaseMsgUpdateCommissionResponse(); + return message; + }, +}; + +function createBaseMsgJoinPool(): MsgJoinPool { + return { creator: "", pool_id: "0", valaddress: "", amount: "0" }; +} + +export const MsgJoinPool = { + encode(message: MsgJoinPool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + if (message.valaddress !== "") { + writer.uint32(26).string(message.valaddress); + } + if (message.amount !== "0") { + writer.uint32(32).uint64(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgJoinPool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgJoinPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + case 3: + message.valaddress = reader.string(); + break; + case 4: + message.amount = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgJoinPool { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + valaddress: isSet(object.valaddress) ? String(object.valaddress) : "", + amount: isSet(object.amount) ? String(object.amount) : "0", + }; + }, + + toJSON(message: MsgJoinPool): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + message.valaddress !== undefined && (obj.valaddress = message.valaddress); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + + fromPartial, I>>(object: I): MsgJoinPool { + const message = createBaseMsgJoinPool(); + message.creator = object.creator ?? ""; + message.pool_id = object.pool_id ?? "0"; + message.valaddress = object.valaddress ?? ""; + message.amount = object.amount ?? "0"; + return message; + }, +}; + +function createBaseMsgJoinPoolResponse(): MsgJoinPoolResponse { + return {}; +} + +export const MsgJoinPoolResponse = { + encode(_: MsgJoinPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgJoinPoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgJoinPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgJoinPoolResponse { + return {}; + }, + + toJSON(_: MsgJoinPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgJoinPoolResponse { + const message = createBaseMsgJoinPoolResponse(); + return message; + }, +}; + +function createBaseMsgLeavePool(): MsgLeavePool { + return { creator: "", pool_id: "0" }; +} + +export const MsgLeavePool = { + encode(message: MsgLeavePool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.pool_id !== "0") { + writer.uint32(16).uint64(message.pool_id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeavePool { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeavePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + case 2: + message.pool_id = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgLeavePool { + return { + creator: isSet(object.creator) ? String(object.creator) : "", + pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0", + }; + }, + + toJSON(message: MsgLeavePool): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + message.pool_id !== undefined && (obj.pool_id = message.pool_id); + return obj; + }, + + fromPartial, I>>(object: I): MsgLeavePool { + const message = createBaseMsgLeavePool(); + message.creator = object.creator ?? ""; + message.pool_id = object.pool_id ?? "0"; + return message; + }, +}; + +function createBaseMsgLeavePoolResponse(): MsgLeavePoolResponse { + return {}; +} + +export const MsgLeavePoolResponse = { + encode(_: MsgLeavePoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeavePoolResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeavePoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgLeavePoolResponse { + return {}; + }, + + toJSON(_: MsgLeavePoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgLeavePoolResponse { + const message = createBaseMsgLeavePoolResponse(); + return message; + }, +}; + +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { authority: "", payload: "" }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.payload !== "") { + writer.uint32(18).string(message.payload); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.payload = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + payload: isSet(object.payload) ? String(object.payload) : "", + }; + }, + + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.payload !== undefined && (obj.payload = message.payload); + return obj; + }, + + fromPartial, I>>(object: I): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.payload = object.payload ?? ""; + return message; + }, +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; + +/** Msg defines the Msg service. */ +export interface Msg { + /** CreateStaker ... */ + CreateStaker(request: MsgCreateStaker): Promise; + /** UpdateMetadata ... */ + UpdateMetadata(request: MsgUpdateMetadata): Promise; + /** UpdateCommission ... */ + UpdateCommission(request: MsgUpdateCommission): Promise; + /** JoinPool ... */ + JoinPool(request: MsgJoinPool): Promise; + /** LeavePool ... */ + LeavePool(request: MsgLeavePool): Promise; + /** + * UpdateParams defines a governance operation for updating the x/stakers module + * parameters. The authority is hard-coded to the x/gov module account. + */ + UpdateParams(request: MsgUpdateParams): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "kyve.stakers.v1beta1.Msg"; + this.rpc = rpc; + this.CreateStaker = this.CreateStaker.bind(this); + this.UpdateMetadata = this.UpdateMetadata.bind(this); + this.UpdateCommission = this.UpdateCommission.bind(this); + this.JoinPool = this.JoinPool.bind(this); + this.LeavePool = this.LeavePool.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + } + CreateStaker(request: MsgCreateStaker): Promise { + const data = MsgCreateStaker.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateStaker", data); + return promise.then((data) => MsgCreateStakerResponse.decode(new _m0.Reader(data))); + } + + UpdateMetadata(request: MsgUpdateMetadata): Promise { + const data = MsgUpdateMetadata.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateMetadata", data); + return promise.then((data) => MsgUpdateMetadataResponse.decode(new _m0.Reader(data))); + } + + UpdateCommission(request: MsgUpdateCommission): Promise { + const data = MsgUpdateCommission.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateCommission", data); + return promise.then((data) => MsgUpdateCommissionResponse.decode(new _m0.Reader(data))); + } + + JoinPool(request: MsgJoinPool): Promise { + const data = MsgJoinPool.encode(request).finish(); + const promise = this.rpc.request(this.service, "JoinPool", data); + return promise.then((data) => MsgJoinPoolResponse.decode(new _m0.Reader(data))); + } + + LeavePool(request: MsgLeavePool): Promise { + const data = MsgLeavePool.encode(request).finish(); + const promise = this.rpc.request(this.service, "LeavePool", data); + return promise.then((data) => MsgLeavePoolResponse.decode(new _m0.Reader(data))); + } + + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/abci/types.ts b/common/types/src/lcd/tendermint/abci/types.ts new file mode 100644 index 00000000..2e4eb345 --- /dev/null +++ b/common/types/src/lcd/tendermint/abci/types.ts @@ -0,0 +1,4193 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { PublicKey } from "../crypto/keys"; +import { ProofOps } from "../crypto/proof"; +import { EvidenceParams, ValidatorParams, VersionParams } from "../types/params"; +import { Header } from "../types/types"; + +export const protobufPackage = "tendermint.abci"; + +export enum CheckTxType { + NEW = "NEW", + RECHECK = "RECHECK", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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 function checkTxTypeToNumber(object: CheckTxType): number { + switch (object) { + case CheckTxType.NEW: + return 0; + case CheckTxType.RECHECK: + return 1; + case CheckTxType.UNRECOGNIZED: + default: + return -1; + } +} + +export enum EvidenceType { + UNKNOWN = "UNKNOWN", + DUPLICATE_VOTE = "DUPLICATE_VOTE", + LIGHT_CLIENT_ATTACK = "LIGHT_CLIENT_ATTACK", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function evidenceTypeFromJSON(object: any): EvidenceType { + switch (object) { + case 0: + case "UNKNOWN": + return EvidenceType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return EvidenceType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return EvidenceType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return EvidenceType.UNRECOGNIZED; + } +} + +export function evidenceTypeToJSON(object: EvidenceType): string { + switch (object) { + case EvidenceType.UNKNOWN: + return "UNKNOWN"; + case EvidenceType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case EvidenceType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case EvidenceType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function evidenceTypeToNumber(object: EvidenceType): number { + switch (object) { + case EvidenceType.UNKNOWN: + return 0; + case EvidenceType.DUPLICATE_VOTE: + return 1; + case EvidenceType.LIGHT_CLIENT_ATTACK: + return 2; + case EvidenceType.UNRECOGNIZED: + default: + return -1; + } +} + +export interface Request { + echo?: RequestEcho | undefined; + flush?: RequestFlush | undefined; + info?: RequestInfo | undefined; + set_option?: RequestSetOption | undefined; + init_chain?: RequestInitChain | undefined; + query?: RequestQuery | undefined; + begin_block?: RequestBeginBlock | undefined; + check_tx?: RequestCheckTx | undefined; + deliver_tx?: RequestDeliverTx | undefined; + end_block?: RequestEndBlock | undefined; + commit?: RequestCommit | undefined; + list_snapshots?: RequestListSnapshots | undefined; + offer_snapshot?: RequestOfferSnapshot | undefined; + load_snapshot_chunk?: RequestLoadSnapshotChunk | undefined; + apply_snapshot_chunk?: RequestApplySnapshotChunk | undefined; +} + +export interface RequestEcho { + message: string; +} + +export interface RequestFlush { +} + +export interface RequestInfo { + version: string; + block_version: string; + p2p_version: string; +} + +/** nondeterministic */ +export interface RequestSetOption { + key: string; + value: string; +} + +export interface RequestInitChain { + time?: Date; + chain_id: string; + consensus_params?: ConsensusParams; + validators: ValidatorUpdate[]; + app_state_bytes: Uint8Array; + initial_height: string; +} + +export interface RequestQuery { + data: Uint8Array; + path: string; + height: string; + prove: boolean; +} + +export interface RequestBeginBlock { + hash: Uint8Array; + header?: Header; + last_commit_info?: LastCommitInfo; + byzantine_validators: Evidence[]; +} + +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} + +export interface RequestDeliverTx { + tx: Uint8Array; +} + +export interface RequestEndBlock { + height: string; +} + +export interface RequestCommit { +} + +/** lists available snapshots */ +export interface RequestListSnapshots { +} + +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot?: Snapshot; + /** light client-verified app hash for snapshot height */ + app_hash: Uint8Array; +} + +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: string; + format: number; + chunk: number; +} + +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} + +export interface Response { + exception?: ResponseException | undefined; + echo?: ResponseEcho | undefined; + flush?: ResponseFlush | undefined; + info?: ResponseInfo | undefined; + set_option?: ResponseSetOption | undefined; + init_chain?: ResponseInitChain | undefined; + query?: ResponseQuery | undefined; + begin_block?: ResponseBeginBlock | undefined; + check_tx?: ResponseCheckTx | undefined; + deliver_tx?: ResponseDeliverTx | undefined; + end_block?: ResponseEndBlock | undefined; + commit?: ResponseCommit | undefined; + list_snapshots?: ResponseListSnapshots | undefined; + offer_snapshot?: ResponseOfferSnapshot | undefined; + load_snapshot_chunk?: ResponseLoadSnapshotChunk | undefined; + apply_snapshot_chunk?: ResponseApplySnapshotChunk | undefined; +} + +/** nondeterministic */ +export interface ResponseException { + error: string; +} + +export interface ResponseEcho { + message: string; +} + +export interface ResponseFlush { +} + +export interface ResponseInfo { + data: string; + version: string; + app_version: string; + last_block_height: string; + last_block_app_hash: Uint8Array; +} + +/** nondeterministic */ +export interface ResponseSetOption { + code: number; + /** bytes data = 2; */ + log: string; + info: string; +} + +export interface ResponseInitChain { + consensus_params?: ConsensusParams; + validators: ValidatorUpdate[]; + app_hash: Uint8Array; +} + +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: string; + key: Uint8Array; + value: Uint8Array; + proof_ops?: ProofOps; + height: string; + codespace: string; +} + +export interface ResponseBeginBlock { + events: Event[]; +} + +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gas_wanted: string; + gas_used: string; + events: Event[]; + codespace: string; +} + +export interface ResponseDeliverTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gas_wanted: string; + gas_used: string; + events: Event[]; + codespace: string; +} + +export interface ResponseEndBlock { + validator_updates: ValidatorUpdate[]; + consensus_param_updates?: ConsensusParams; + events: Event[]; +} + +export interface ResponseCommit { + /** reserve 1 */ + data: Uint8Array; + retain_height: string; +} + +export interface ResponseListSnapshots { + snapshots: Snapshot[]; +} + +export interface ResponseOfferSnapshot { + result: ResponseOfferSnapshot_Result; +} + +export enum ResponseOfferSnapshot_Result { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = "UNKNOWN", + /** ACCEPT - Snapshot accepted, apply chunks */ + ACCEPT = "ACCEPT", + /** ABORT - Abort all snapshot restoration */ + ABORT = "ABORT", + /** REJECT - Reject this specific snapshot, try others */ + REJECT = "REJECT", + /** REJECT_FORMAT - Reject all snapshots of this format, try others */ + REJECT_FORMAT = "REJECT_FORMAT", + /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ + REJECT_SENDER = "REJECT_SENDER", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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 function responseOfferSnapshot_ResultToNumber(object: ResponseOfferSnapshot_Result): number { + switch (object) { + case ResponseOfferSnapshot_Result.UNKNOWN: + return 0; + case ResponseOfferSnapshot_Result.ACCEPT: + return 1; + case ResponseOfferSnapshot_Result.ABORT: + return 2; + case ResponseOfferSnapshot_Result.REJECT: + return 3; + case ResponseOfferSnapshot_Result.REJECT_FORMAT: + return 4; + case ResponseOfferSnapshot_Result.REJECT_SENDER: + return 5; + case ResponseOfferSnapshot_Result.UNRECOGNIZED: + default: + return -1; + } +} + +export interface ResponseLoadSnapshotChunk { + chunk: Uint8Array; +} + +export interface ResponseApplySnapshotChunk { + result: ResponseApplySnapshotChunk_Result; + /** Chunks to refetch and reapply */ + refetch_chunks: number[]; + /** Chunk senders to reject and ban */ + reject_senders: string[]; +} + +export enum ResponseApplySnapshotChunk_Result { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = "UNKNOWN", + /** ACCEPT - Chunk successfully accepted */ + ACCEPT = "ACCEPT", + /** ABORT - Abort all snapshot restoration */ + ABORT = "ABORT", + /** RETRY - Retry chunk (combine with refetch and reject) */ + RETRY = "RETRY", + /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ + RETRY_SNAPSHOT = "RETRY_SNAPSHOT", + /** REJECT_SNAPSHOT - Reject this snapshot, try others */ + REJECT_SNAPSHOT = "REJECT_SNAPSHOT", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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 function responseApplySnapshotChunk_ResultToNumber(object: ResponseApplySnapshotChunk_Result): number { + switch (object) { + case ResponseApplySnapshotChunk_Result.UNKNOWN: + return 0; + case ResponseApplySnapshotChunk_Result.ACCEPT: + return 1; + case ResponseApplySnapshotChunk_Result.ABORT: + return 2; + case ResponseApplySnapshotChunk_Result.RETRY: + return 3; + case ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT: + return 4; + case ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT: + return 5; + case ResponseApplySnapshotChunk_Result.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * ConsensusParams contains all consensus-relevant parameters + * that can be adjusted by the abci app + */ +export interface ConsensusParams { + block?: BlockParams; + evidence?: EvidenceParams; + validator?: ValidatorParams; + version?: VersionParams; +} + +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** Note: must be greater than 0 */ + max_bytes: string; + /** Note: must be greater or equal to -1 */ + max_gas: string; +} + +export interface LastCommitInfo { + round: number; + votes: VoteInfo[]; +} + +/** + * Event allows application developers to attach additional information to + * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} + +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: Uint8Array; + value: Uint8Array; + /** nondeterministic */ + index: boolean; +} + +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: string; + index: number; + tx: Uint8Array; + result?: ResponseDeliverTx; +} + +/** Validator */ +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: string; +} + +/** ValidatorUpdate */ +export interface ValidatorUpdate { + pub_key?: PublicKey; + power: string; +} + +/** VoteInfo */ +export interface VoteInfo { + validator?: Validator; + signed_last_block: boolean; +} + +export interface Evidence { + type: EvidenceType; + /** The offending validator */ + validator?: Validator; + /** The height when the offense occurred */ + height: string; + /** 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 + */ + total_voting_power: string; +} + +export interface Snapshot { + /** 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: Uint8Array; + /** Arbitrary application metadata */ + metadata: Uint8Array; +} + +function createBaseRequest(): Request { + return { + echo: undefined, + flush: undefined, + info: undefined, + set_option: undefined, + init_chain: undefined, + query: undefined, + begin_block: undefined, + check_tx: undefined, + deliver_tx: undefined, + end_block: undefined, + commit: undefined, + list_snapshots: undefined, + offer_snapshot: undefined, + load_snapshot_chunk: undefined, + apply_snapshot_chunk: undefined, + }; +} + +export const Request = { + encode(message: Request, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.set_option !== undefined) { + RequestSetOption.encode(message.set_option, writer.uint32(34).fork()).ldelim(); + } + if (message.init_chain !== undefined) { + RequestInitChain.encode(message.init_chain, writer.uint32(42).fork()).ldelim(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim(); + } + if (message.begin_block !== undefined) { + RequestBeginBlock.encode(message.begin_block, writer.uint32(58).fork()).ldelim(); + } + if (message.check_tx !== undefined) { + RequestCheckTx.encode(message.check_tx, writer.uint32(66).fork()).ldelim(); + } + if (message.deliver_tx !== undefined) { + RequestDeliverTx.encode(message.deliver_tx, writer.uint32(74).fork()).ldelim(); + } + if (message.end_block !== undefined) { + RequestEndBlock.encode(message.end_block, writer.uint32(82).fork()).ldelim(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim(); + } + if (message.list_snapshots !== undefined) { + RequestListSnapshots.encode(message.list_snapshots, writer.uint32(98).fork()).ldelim(); + } + if (message.offer_snapshot !== undefined) { + RequestOfferSnapshot.encode(message.offer_snapshot, writer.uint32(106).fork()).ldelim(); + } + if (message.load_snapshot_chunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.load_snapshot_chunk, writer.uint32(114).fork()).ldelim(); + } + if (message.apply_snapshot_chunk !== undefined) { + RequestApplySnapshotChunk.encode(message.apply_snapshot_chunk, writer.uint32(122).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Request { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 4: + message.set_option = RequestSetOption.decode(reader, reader.uint32()); + break; + case 5: + message.init_chain = RequestInitChain.decode(reader, reader.uint32()); + break; + case 6: + message.query = RequestQuery.decode(reader, reader.uint32()); + break; + case 7: + message.begin_block = RequestBeginBlock.decode(reader, reader.uint32()); + break; + case 8: + message.check_tx = RequestCheckTx.decode(reader, reader.uint32()); + break; + case 9: + message.deliver_tx = RequestDeliverTx.decode(reader, reader.uint32()); + break; + case 10: + message.end_block = RequestEndBlock.decode(reader, reader.uint32()); + break; + case 11: + message.commit = RequestCommit.decode(reader, reader.uint32()); + break; + case 12: + message.list_snapshots = RequestListSnapshots.decode(reader, reader.uint32()); + break; + case 13: + message.offer_snapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + break; + case 14: + message.load_snapshot_chunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 15: + message.apply_snapshot_chunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Request { + return { + echo: isSet(object.echo) ? RequestEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) ? RequestFlush.fromJSON(object.flush) : undefined, + info: isSet(object.info) ? RequestInfo.fromJSON(object.info) : undefined, + set_option: isSet(object.set_option) ? RequestSetOption.fromJSON(object.set_option) : undefined, + init_chain: isSet(object.init_chain) ? RequestInitChain.fromJSON(object.init_chain) : undefined, + query: isSet(object.query) ? RequestQuery.fromJSON(object.query) : undefined, + begin_block: isSet(object.begin_block) ? RequestBeginBlock.fromJSON(object.begin_block) : undefined, + check_tx: isSet(object.check_tx) ? RequestCheckTx.fromJSON(object.check_tx) : undefined, + deliver_tx: isSet(object.deliver_tx) ? RequestDeliverTx.fromJSON(object.deliver_tx) : undefined, + end_block: isSet(object.end_block) ? RequestEndBlock.fromJSON(object.end_block) : undefined, + commit: isSet(object.commit) ? RequestCommit.fromJSON(object.commit) : undefined, + list_snapshots: isSet(object.list_snapshots) ? RequestListSnapshots.fromJSON(object.list_snapshots) : undefined, + offer_snapshot: isSet(object.offer_snapshot) ? RequestOfferSnapshot.fromJSON(object.offer_snapshot) : undefined, + load_snapshot_chunk: isSet(object.load_snapshot_chunk) + ? RequestLoadSnapshotChunk.fromJSON(object.load_snapshot_chunk) + : undefined, + apply_snapshot_chunk: isSet(object.apply_snapshot_chunk) + ? RequestApplySnapshotChunk.fromJSON(object.apply_snapshot_chunk) + : undefined, + }; + }, + + toJSON(message: Request): unknown { + const obj: any = {}; + message.echo !== undefined && (obj.echo = message.echo ? RequestEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && (obj.flush = message.flush ? RequestFlush.toJSON(message.flush) : undefined); + message.info !== undefined && (obj.info = message.info ? RequestInfo.toJSON(message.info) : undefined); + message.set_option !== undefined && + (obj.set_option = message.set_option ? RequestSetOption.toJSON(message.set_option) : undefined); + message.init_chain !== undefined && + (obj.init_chain = message.init_chain ? RequestInitChain.toJSON(message.init_chain) : undefined); + message.query !== undefined && (obj.query = message.query ? RequestQuery.toJSON(message.query) : undefined); + message.begin_block !== undefined && + (obj.begin_block = message.begin_block ? RequestBeginBlock.toJSON(message.begin_block) : undefined); + message.check_tx !== undefined && + (obj.check_tx = message.check_tx ? RequestCheckTx.toJSON(message.check_tx) : undefined); + message.deliver_tx !== undefined && + (obj.deliver_tx = message.deliver_tx ? RequestDeliverTx.toJSON(message.deliver_tx) : undefined); + message.end_block !== undefined && + (obj.end_block = message.end_block ? RequestEndBlock.toJSON(message.end_block) : undefined); + message.commit !== undefined && (obj.commit = message.commit ? RequestCommit.toJSON(message.commit) : undefined); + message.list_snapshots !== undefined && + (obj.list_snapshots = message.list_snapshots ? RequestListSnapshots.toJSON(message.list_snapshots) : undefined); + message.offer_snapshot !== undefined && + (obj.offer_snapshot = message.offer_snapshot ? RequestOfferSnapshot.toJSON(message.offer_snapshot) : undefined); + message.load_snapshot_chunk !== undefined && (obj.load_snapshot_chunk = message.load_snapshot_chunk + ? RequestLoadSnapshotChunk.toJSON(message.load_snapshot_chunk) + : undefined); + message.apply_snapshot_chunk !== undefined && (obj.apply_snapshot_chunk = message.apply_snapshot_chunk + ? RequestApplySnapshotChunk.toJSON(message.apply_snapshot_chunk) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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.set_option = (object.set_option !== undefined && object.set_option !== null) + ? RequestSetOption.fromPartial(object.set_option) + : undefined; + message.init_chain = (object.init_chain !== undefined && object.init_chain !== null) + ? RequestInitChain.fromPartial(object.init_chain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? RequestQuery.fromPartial(object.query) + : undefined; + message.begin_block = (object.begin_block !== undefined && object.begin_block !== null) + ? RequestBeginBlock.fromPartial(object.begin_block) + : undefined; + message.check_tx = (object.check_tx !== undefined && object.check_tx !== null) + ? RequestCheckTx.fromPartial(object.check_tx) + : undefined; + message.deliver_tx = (object.deliver_tx !== undefined && object.deliver_tx !== null) + ? RequestDeliverTx.fromPartial(object.deliver_tx) + : undefined; + message.end_block = (object.end_block !== undefined && object.end_block !== null) + ? RequestEndBlock.fromPartial(object.end_block) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? RequestCommit.fromPartial(object.commit) + : undefined; + message.list_snapshots = (object.list_snapshots !== undefined && object.list_snapshots !== null) + ? RequestListSnapshots.fromPartial(object.list_snapshots) + : undefined; + message.offer_snapshot = (object.offer_snapshot !== undefined && object.offer_snapshot !== null) + ? RequestOfferSnapshot.fromPartial(object.offer_snapshot) + : undefined; + message.load_snapshot_chunk = (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) + ? RequestLoadSnapshotChunk.fromPartial(object.load_snapshot_chunk) + : undefined; + message.apply_snapshot_chunk = (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) + ? RequestApplySnapshotChunk.fromPartial(object.apply_snapshot_chunk) + : undefined; + return message; + }, +}; + +function createBaseRequestEcho(): RequestEcho { + return { message: "" }; +} + +export const RequestEcho = { + encode(message: RequestEcho, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): RequestEcho { + return { message: isSet(object.message) ? String(object.message) : "" }; + }, + + toJSON(message: RequestEcho): unknown { + const obj: any = {}; + message.message !== undefined && (obj.message = message.message); + return obj; + }, + + fromPartial, I>>(object: I): RequestEcho { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseRequestFlush(): RequestFlush { + return {}; +} + +export const RequestFlush = { + encode(_: RequestFlush, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): RequestFlush { + return {}; + }, + + toJSON(_: RequestFlush): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, +}; + +function createBaseRequestInfo(): RequestInfo { + return { version: "", block_version: "0", p2p_version: "0" }; +} + +export const RequestInfo = { + encode(message: RequestInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.block_version !== "0") { + writer.uint32(16).uint64(message.block_version); + } + if (message.p2p_version !== "0") { + writer.uint32(24).uint64(message.p2p_version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.block_version = longToString(reader.uint64() as Long); + break; + case 3: + message.p2p_version = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestInfo { + return { + version: isSet(object.version) ? String(object.version) : "", + block_version: isSet(object.block_version) ? String(object.block_version) : "0", + p2p_version: isSet(object.p2p_version) ? String(object.p2p_version) : "0", + }; + }, + + toJSON(message: RequestInfo): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.block_version !== undefined && (obj.block_version = message.block_version); + message.p2p_version !== undefined && (obj.p2p_version = message.p2p_version); + return obj; + }, + + fromPartial, I>>(object: I): RequestInfo { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.block_version = object.block_version ?? "0"; + message.p2p_version = object.p2p_version ?? "0"; + return message; + }, +}; + +function createBaseRequestSetOption(): RequestSetOption { + return { key: "", value: "" }; +} + +export const RequestSetOption = { + encode(message: RequestSetOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestSetOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestSetOption(); + 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; + }, + + fromJSON(object: any): RequestSetOption { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: RequestSetOption): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + fromPartial, I>>(object: I): RequestSetOption { + const message = createBaseRequestSetOption(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseRequestInitChain(): RequestInitChain { + return { + time: undefined, + chain_id: "", + consensus_params: undefined, + validators: [], + app_state_bytes: new Uint8Array(), + initial_height: "0", + }; +} + +export const RequestInitChain = { + encode(message: RequestInitChain, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); + } + if (message.chain_id !== "") { + writer.uint32(18).string(message.chain_id); + } + if (message.consensus_params !== undefined) { + ConsensusParams.encode(message.consensus_params, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.app_state_bytes.length !== 0) { + writer.uint32(42).bytes(message.app_state_bytes); + } + if (message.initial_height !== "0") { + writer.uint32(48).int64(message.initial_height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.chain_id = reader.string(); + break; + case 3: + message.consensus_params = ConsensusParams.decode(reader, reader.uint32()); + break; + case 4: + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 5: + message.app_state_bytes = reader.bytes(); + break; + case 6: + message.initial_height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestInitChain { + return { + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + chain_id: isSet(object.chain_id) ? String(object.chain_id) : "", + consensus_params: isSet(object.consensus_params) ? ConsensusParams.fromJSON(object.consensus_params) : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + app_state_bytes: isSet(object.app_state_bytes) ? bytesFromBase64(object.app_state_bytes) : new Uint8Array(), + initial_height: isSet(object.initial_height) ? String(object.initial_height) : "0", + }; + }, + + toJSON(message: RequestInitChain): unknown { + const obj: any = {}; + message.time !== undefined && (obj.time = message.time.toISOString()); + message.chain_id !== undefined && (obj.chain_id = message.chain_id); + message.consensus_params !== undefined && + (obj.consensus_params = message.consensus_params ? ConsensusParams.toJSON(message.consensus_params) : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? ValidatorUpdate.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.app_state_bytes !== undefined && + (obj.app_state_bytes = base64FromBytes( + message.app_state_bytes !== undefined ? message.app_state_bytes : new Uint8Array(), + )); + message.initial_height !== undefined && (obj.initial_height = message.initial_height); + return obj; + }, + + fromPartial, I>>(object: I): RequestInitChain { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chain_id = object.chain_id ?? ""; + message.consensus_params = (object.consensus_params !== undefined && object.consensus_params !== null) + ? ConsensusParams.fromPartial(object.consensus_params) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.app_state_bytes = object.app_state_bytes ?? new Uint8Array(); + message.initial_height = object.initial_height ?? "0"; + return message; + }, +}; + +function createBaseRequestQuery(): RequestQuery { + return { data: new Uint8Array(), path: "", height: "0", prove: false }; +} + +export const RequestQuery = { + encode(message: RequestQuery, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.height !== "0") { + writer.uint32(24).int64(message.height); + } + if (message.prove === true) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 4: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestQuery { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + path: isSet(object.path) ? String(object.path) : "", + height: isSet(object.height) ? String(object.height) : "0", + prove: isSet(object.prove) ? Boolean(object.prove) : false, + }; + }, + + toJSON(message: RequestQuery): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.path !== undefined && (obj.path = message.path); + message.height !== undefined && (obj.height = message.height); + message.prove !== undefined && (obj.prove = message.prove); + return obj; + }, + + fromPartial, I>>(object: I): RequestQuery { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(); + message.path = object.path ?? ""; + message.height = object.height ?? "0"; + message.prove = object.prove ?? false; + return message; + }, +}; + +function createBaseRequestBeginBlock(): RequestBeginBlock { + return { hash: new Uint8Array(), header: undefined, last_commit_info: undefined, byzantine_validators: [] }; +} + +export const RequestBeginBlock = { + encode(message: RequestBeginBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(18).fork()).ldelim(); + } + if (message.last_commit_info !== undefined) { + LastCommitInfo.encode(message.last_commit_info, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.byzantine_validators) { + Evidence.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestBeginBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.header = Header.decode(reader, reader.uint32()); + break; + case 3: + message.last_commit_info = LastCommitInfo.decode(reader, reader.uint32()); + break; + case 4: + message.byzantine_validators.push(Evidence.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestBeginBlock { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + last_commit_info: isSet(object.last_commit_info) ? LastCommitInfo.fromJSON(object.last_commit_info) : undefined, + byzantine_validators: Array.isArray(object?.byzantine_validators) + ? object.byzantine_validators.map((e: any) => Evidence.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RequestBeginBlock): unknown { + const obj: any = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.last_commit_info !== undefined && + (obj.last_commit_info = message.last_commit_info ? LastCommitInfo.toJSON(message.last_commit_info) : undefined); + if (message.byzantine_validators) { + obj.byzantine_validators = message.byzantine_validators.map((e) => e ? Evidence.toJSON(e) : undefined); + } else { + obj.byzantine_validators = []; + } + return obj; + }, + + fromPartial, I>>(object: I): RequestBeginBlock { + const message = createBaseRequestBeginBlock(); + message.hash = object.hash ?? new Uint8Array(); + message.header = (object.header !== undefined && object.header !== null) + ? Header.fromPartial(object.header) + : undefined; + message.last_commit_info = (object.last_commit_info !== undefined && object.last_commit_info !== null) + ? LastCommitInfo.fromPartial(object.last_commit_info) + : undefined; + message.byzantine_validators = object.byzantine_validators?.map((e) => Evidence.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRequestCheckTx(): RequestCheckTx { + return { tx: new Uint8Array(), type: CheckTxType.NEW }; +} + +export const RequestCheckTx = { + encode(message: RequestCheckTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== CheckTxType.NEW) { + writer.uint32(16).int32(checkTxTypeToNumber(message.type)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = checkTxTypeFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestCheckTx { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : CheckTxType.NEW, + }; + }, + + toJSON(message: RequestCheckTx): unknown { + const obj: any = {}; + message.tx !== undefined && (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + message.type !== undefined && (obj.type = checkTxTypeToJSON(message.type)); + return obj; + }, + + fromPartial, I>>(object: I): RequestCheckTx { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(); + message.type = object.type ?? CheckTxType.NEW; + return message; + }, +}; + +function createBaseRequestDeliverTx(): RequestDeliverTx { + return { tx: new Uint8Array() }; +} + +export const RequestDeliverTx = { + encode(message: RequestDeliverTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestDeliverTx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestDeliverTx { + return { tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array() }; + }, + + toJSON(message: RequestDeliverTx): unknown { + const obj: any = {}; + message.tx !== undefined && (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): RequestDeliverTx { + const message = createBaseRequestDeliverTx(); + message.tx = object.tx ?? new Uint8Array(); + return message; + }, +}; + +function createBaseRequestEndBlock(): RequestEndBlock { + return { height: "0" }; +} + +export const RequestEndBlock = { + encode(message: RequestEndBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestEndBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestEndBlock { + return { height: isSet(object.height) ? String(object.height) : "0" }; + }, + + toJSON(message: RequestEndBlock): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + return obj; + }, + + fromPartial, I>>(object: I): RequestEndBlock { + const message = createBaseRequestEndBlock(); + message.height = object.height ?? "0"; + return message; + }, +}; + +function createBaseRequestCommit(): RequestCommit { + return {}; +} + +export const RequestCommit = { + encode(_: RequestCommit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): RequestCommit { + return {}; + }, + + toJSON(_: RequestCommit): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, +}; + +function createBaseRequestListSnapshots(): RequestListSnapshots { + return {}; +} + +export const RequestListSnapshots = { + encode(_: RequestListSnapshots, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): RequestListSnapshots { + return {}; + }, + + toJSON(_: RequestListSnapshots): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; + +function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { + return { snapshot: undefined, app_hash: new Uint8Array() }; +} + +export const RequestOfferSnapshot = { + encode(message: RequestOfferSnapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); + } + if (message.app_hash.length !== 0) { + writer.uint32(18).bytes(message.app_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.app_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestOfferSnapshot { + return { + snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined, + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(), + }; + }, + + toJSON(message: RequestOfferSnapshot): unknown { + const obj: any = {}; + message.snapshot !== undefined && (obj.snapshot = message.snapshot ? Snapshot.toJSON(message.snapshot) : undefined); + message.app_hash !== undefined && + (obj.app_hash = base64FromBytes(message.app_hash !== undefined ? message.app_hash : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) + ? Snapshot.fromPartial(object.snapshot) + : undefined; + message.app_hash = object.app_hash ?? new Uint8Array(); + return message; + }, +}; + +function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { + return { height: "0", format: 0, chunk: 0 }; +} + +export const RequestLoadSnapshotChunk = { + encode(message: RequestLoadSnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "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: _m0.Reader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunk = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RequestLoadSnapshotChunk { + return { + height: isSet(object.height) ? String(object.height) : "0", + format: isSet(object.format) ? Number(object.format) : 0, + chunk: isSet(object.chunk) ? Number(object.chunk) : 0, + }; + }, + + toJSON(message: RequestLoadSnapshotChunk): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunk !== undefined && (obj.chunk = Math.round(message.chunk)); + return obj; + }, + + fromPartial, I>>(object: I): RequestLoadSnapshotChunk { + const message = createBaseRequestLoadSnapshotChunk(); + message.height = object.height ?? "0"; + message.format = object.format ?? 0; + message.chunk = object.chunk ?? 0; + return message; + }, +}; + +function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { + return { index: 0, chunk: new Uint8Array(), sender: "" }; +} + +export const RequestApplySnapshotChunk = { + encode(message: RequestApplySnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): RequestApplySnapshotChunk { + return { + index: isSet(object.index) ? Number(object.index) : 0, + chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(), + sender: isSet(object.sender) ? String(object.sender) : "", + }; + }, + + toJSON(message: RequestApplySnapshotChunk): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = Math.round(message.index)); + message.chunk !== undefined && + (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); + message.sender !== undefined && (obj.sender = message.sender); + return obj; + }, + + fromPartial, I>>(object: I): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(); + message.sender = object.sender ?? ""; + return message; + }, +}; + +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + set_option: undefined, + init_chain: undefined, + query: undefined, + begin_block: undefined, + check_tx: undefined, + deliver_tx: undefined, + end_block: undefined, + commit: undefined, + list_snapshots: undefined, + offer_snapshot: undefined, + load_snapshot_chunk: undefined, + apply_snapshot_chunk: undefined, + }; +} + +export const Response = { + encode(message: Response, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.set_option !== undefined) { + ResponseSetOption.encode(message.set_option, writer.uint32(42).fork()).ldelim(); + } + if (message.init_chain !== undefined) { + ResponseInitChain.encode(message.init_chain, writer.uint32(50).fork()).ldelim(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(58).fork()).ldelim(); + } + if (message.begin_block !== undefined) { + ResponseBeginBlock.encode(message.begin_block, writer.uint32(66).fork()).ldelim(); + } + if (message.check_tx !== undefined) { + ResponseCheckTx.encode(message.check_tx, writer.uint32(74).fork()).ldelim(); + } + if (message.deliver_tx !== undefined) { + ResponseDeliverTx.encode(message.deliver_tx, writer.uint32(82).fork()).ldelim(); + } + if (message.end_block !== undefined) { + ResponseEndBlock.encode(message.end_block, writer.uint32(90).fork()).ldelim(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(98).fork()).ldelim(); + } + if (message.list_snapshots !== undefined) { + ResponseListSnapshots.encode(message.list_snapshots, writer.uint32(106).fork()).ldelim(); + } + if (message.offer_snapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offer_snapshot, writer.uint32(114).fork()).ldelim(); + } + if (message.load_snapshot_chunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.load_snapshot_chunk, writer.uint32(122).fork()).ldelim(); + } + if (message.apply_snapshot_chunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.apply_snapshot_chunk, writer.uint32(130).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Response { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 5: + message.set_option = ResponseSetOption.decode(reader, reader.uint32()); + break; + case 6: + message.init_chain = ResponseInitChain.decode(reader, reader.uint32()); + break; + case 7: + message.query = ResponseQuery.decode(reader, reader.uint32()); + break; + case 8: + message.begin_block = ResponseBeginBlock.decode(reader, reader.uint32()); + break; + case 9: + message.check_tx = ResponseCheckTx.decode(reader, reader.uint32()); + break; + case 10: + message.deliver_tx = ResponseDeliverTx.decode(reader, reader.uint32()); + break; + case 11: + message.end_block = ResponseEndBlock.decode(reader, reader.uint32()); + break; + case 12: + message.commit = ResponseCommit.decode(reader, reader.uint32()); + break; + case 13: + message.list_snapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + break; + case 14: + message.offer_snapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + break; + case 15: + message.load_snapshot_chunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 16: + message.apply_snapshot_chunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Response { + return { + exception: isSet(object.exception) ? ResponseException.fromJSON(object.exception) : undefined, + echo: isSet(object.echo) ? ResponseEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) ? ResponseFlush.fromJSON(object.flush) : undefined, + info: isSet(object.info) ? ResponseInfo.fromJSON(object.info) : undefined, + set_option: isSet(object.set_option) ? ResponseSetOption.fromJSON(object.set_option) : undefined, + init_chain: isSet(object.init_chain) ? ResponseInitChain.fromJSON(object.init_chain) : undefined, + query: isSet(object.query) ? ResponseQuery.fromJSON(object.query) : undefined, + begin_block: isSet(object.begin_block) ? ResponseBeginBlock.fromJSON(object.begin_block) : undefined, + check_tx: isSet(object.check_tx) ? ResponseCheckTx.fromJSON(object.check_tx) : undefined, + deliver_tx: isSet(object.deliver_tx) ? ResponseDeliverTx.fromJSON(object.deliver_tx) : undefined, + end_block: isSet(object.end_block) ? ResponseEndBlock.fromJSON(object.end_block) : undefined, + commit: isSet(object.commit) ? ResponseCommit.fromJSON(object.commit) : undefined, + list_snapshots: isSet(object.list_snapshots) ? ResponseListSnapshots.fromJSON(object.list_snapshots) : undefined, + offer_snapshot: isSet(object.offer_snapshot) ? ResponseOfferSnapshot.fromJSON(object.offer_snapshot) : undefined, + load_snapshot_chunk: isSet(object.load_snapshot_chunk) + ? ResponseLoadSnapshotChunk.fromJSON(object.load_snapshot_chunk) + : undefined, + apply_snapshot_chunk: isSet(object.apply_snapshot_chunk) + ? ResponseApplySnapshotChunk.fromJSON(object.apply_snapshot_chunk) + : undefined, + }; + }, + + toJSON(message: Response): unknown { + const obj: any = {}; + message.exception !== undefined && + (obj.exception = message.exception ? ResponseException.toJSON(message.exception) : undefined); + message.echo !== undefined && (obj.echo = message.echo ? ResponseEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && (obj.flush = message.flush ? ResponseFlush.toJSON(message.flush) : undefined); + message.info !== undefined && (obj.info = message.info ? ResponseInfo.toJSON(message.info) : undefined); + message.set_option !== undefined && + (obj.set_option = message.set_option ? ResponseSetOption.toJSON(message.set_option) : undefined); + message.init_chain !== undefined && + (obj.init_chain = message.init_chain ? ResponseInitChain.toJSON(message.init_chain) : undefined); + message.query !== undefined && (obj.query = message.query ? ResponseQuery.toJSON(message.query) : undefined); + message.begin_block !== undefined && + (obj.begin_block = message.begin_block ? ResponseBeginBlock.toJSON(message.begin_block) : undefined); + message.check_tx !== undefined && + (obj.check_tx = message.check_tx ? ResponseCheckTx.toJSON(message.check_tx) : undefined); + message.deliver_tx !== undefined && + (obj.deliver_tx = message.deliver_tx ? ResponseDeliverTx.toJSON(message.deliver_tx) : undefined); + message.end_block !== undefined && + (obj.end_block = message.end_block ? ResponseEndBlock.toJSON(message.end_block) : undefined); + message.commit !== undefined && (obj.commit = message.commit ? ResponseCommit.toJSON(message.commit) : undefined); + message.list_snapshots !== undefined && + (obj.list_snapshots = message.list_snapshots ? ResponseListSnapshots.toJSON(message.list_snapshots) : undefined); + message.offer_snapshot !== undefined && + (obj.offer_snapshot = message.offer_snapshot ? ResponseOfferSnapshot.toJSON(message.offer_snapshot) : undefined); + message.load_snapshot_chunk !== undefined && (obj.load_snapshot_chunk = message.load_snapshot_chunk + ? ResponseLoadSnapshotChunk.toJSON(message.load_snapshot_chunk) + : undefined); + message.apply_snapshot_chunk !== undefined && (obj.apply_snapshot_chunk = message.apply_snapshot_chunk + ? ResponseApplySnapshotChunk.toJSON(message.apply_snapshot_chunk) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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.set_option = (object.set_option !== undefined && object.set_option !== null) + ? ResponseSetOption.fromPartial(object.set_option) + : undefined; + message.init_chain = (object.init_chain !== undefined && object.init_chain !== null) + ? ResponseInitChain.fromPartial(object.init_chain) + : undefined; + message.query = (object.query !== undefined && object.query !== null) + ? ResponseQuery.fromPartial(object.query) + : undefined; + message.begin_block = (object.begin_block !== undefined && object.begin_block !== null) + ? ResponseBeginBlock.fromPartial(object.begin_block) + : undefined; + message.check_tx = (object.check_tx !== undefined && object.check_tx !== null) + ? ResponseCheckTx.fromPartial(object.check_tx) + : undefined; + message.deliver_tx = (object.deliver_tx !== undefined && object.deliver_tx !== null) + ? ResponseDeliverTx.fromPartial(object.deliver_tx) + : undefined; + message.end_block = (object.end_block !== undefined && object.end_block !== null) + ? ResponseEndBlock.fromPartial(object.end_block) + : undefined; + message.commit = (object.commit !== undefined && object.commit !== null) + ? ResponseCommit.fromPartial(object.commit) + : undefined; + message.list_snapshots = (object.list_snapshots !== undefined && object.list_snapshots !== null) + ? ResponseListSnapshots.fromPartial(object.list_snapshots) + : undefined; + message.offer_snapshot = (object.offer_snapshot !== undefined && object.offer_snapshot !== null) + ? ResponseOfferSnapshot.fromPartial(object.offer_snapshot) + : undefined; + message.load_snapshot_chunk = (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) + ? ResponseLoadSnapshotChunk.fromPartial(object.load_snapshot_chunk) + : undefined; + message.apply_snapshot_chunk = (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) + ? ResponseApplySnapshotChunk.fromPartial(object.apply_snapshot_chunk) + : undefined; + return message; + }, +}; + +function createBaseResponseException(): ResponseException { + return { error: "" }; +} + +export const ResponseException = { + encode(message: ResponseException, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ResponseException { + return { error: isSet(object.error) ? String(object.error) : "" }; + }, + + toJSON(message: ResponseException): unknown { + const obj: any = {}; + message.error !== undefined && (obj.error = message.error); + return obj; + }, + + fromPartial, I>>(object: I): ResponseException { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; + +function createBaseResponseEcho(): ResponseEcho { + return { message: "" }; +} + +export const ResponseEcho = { + encode(message: ResponseEcho, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ResponseEcho { + return { message: isSet(object.message) ? String(object.message) : "" }; + }, + + toJSON(message: ResponseEcho): unknown { + const obj: any = {}; + message.message !== undefined && (obj.message = message.message); + return obj; + }, + + fromPartial, I>>(object: I): ResponseEcho { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseResponseFlush(): ResponseFlush { + return {}; +} + +export const ResponseFlush = { + encode(_: ResponseFlush, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(_: any): ResponseFlush { + return {}; + }, + + toJSON(_: ResponseFlush): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, +}; + +function createBaseResponseInfo(): ResponseInfo { + return { data: "", version: "", app_version: "0", last_block_height: "0", last_block_app_hash: new Uint8Array() }; +} + +export const ResponseInfo = { + encode(message: ResponseInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.app_version !== "0") { + writer.uint32(24).uint64(message.app_version); + } + if (message.last_block_height !== "0") { + writer.uint32(32).int64(message.last_block_height); + } + if (message.last_block_app_hash.length !== 0) { + writer.uint32(42).bytes(message.last_block_app_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.app_version = longToString(reader.uint64() as Long); + break; + case 4: + message.last_block_height = longToString(reader.int64() as Long); + break; + case 5: + message.last_block_app_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseInfo { + return { + data: isSet(object.data) ? String(object.data) : "", + version: isSet(object.version) ? String(object.version) : "", + app_version: isSet(object.app_version) ? String(object.app_version) : "0", + last_block_height: isSet(object.last_block_height) ? String(object.last_block_height) : "0", + last_block_app_hash: isSet(object.last_block_app_hash) + ? bytesFromBase64(object.last_block_app_hash) + : new Uint8Array(), + }; + }, + + toJSON(message: ResponseInfo): unknown { + const obj: any = {}; + message.data !== undefined && (obj.data = message.data); + message.version !== undefined && (obj.version = message.version); + message.app_version !== undefined && (obj.app_version = message.app_version); + message.last_block_height !== undefined && (obj.last_block_height = message.last_block_height); + message.last_block_app_hash !== undefined && + (obj.last_block_app_hash = base64FromBytes( + message.last_block_app_hash !== undefined ? message.last_block_app_hash : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): ResponseInfo { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.app_version = object.app_version ?? "0"; + message.last_block_height = object.last_block_height ?? "0"; + message.last_block_app_hash = object.last_block_app_hash ?? new Uint8Array(); + return message; + }, +}; + +function createBaseResponseSetOption(): ResponseSetOption { + return { code: 0, log: "", info: "" }; +} + +export const ResponseSetOption = { + encode(message: ResponseSetOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseSetOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseSetOption(); + 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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseSetOption { + return { + code: isSet(object.code) ? Number(object.code) : 0, + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + }; + }, + + toJSON(message: ResponseSetOption): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + return obj; + }, + + fromPartial, I>>(object: I): ResponseSetOption { + const message = createBaseResponseSetOption(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + return message; + }, +}; + +function createBaseResponseInitChain(): ResponseInitChain { + return { consensus_params: undefined, validators: [], app_hash: new Uint8Array() }; +} + +export const ResponseInitChain = { + encode(message: ResponseInitChain, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.consensus_params !== undefined) { + ConsensusParams.encode(message.consensus_params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.app_hash.length !== 0) { + writer.uint32(26).bytes(message.app_hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.consensus_params = ConsensusParams.decode(reader, reader.uint32()); + break; + case 2: + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 3: + message.app_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseInitChain { + return { + consensus_params: isSet(object.consensus_params) ? ConsensusParams.fromJSON(object.consensus_params) : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(), + }; + }, + + toJSON(message: ResponseInitChain): unknown { + const obj: any = {}; + message.consensus_params !== undefined && + (obj.consensus_params = message.consensus_params ? ConsensusParams.toJSON(message.consensus_params) : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? ValidatorUpdate.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.app_hash !== undefined && + (obj.app_hash = base64FromBytes(message.app_hash !== undefined ? message.app_hash : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): ResponseInitChain { + const message = createBaseResponseInitChain(); + message.consensus_params = (object.consensus_params !== undefined && object.consensus_params !== null) + ? ConsensusParams.fromPartial(object.consensus_params) + : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.app_hash = object.app_hash ?? new Uint8Array(); + return message; + }, +}; + +function createBaseResponseQuery(): ResponseQuery { + return { + code: 0, + log: "", + info: "", + index: "0", + key: new Uint8Array(), + value: new Uint8Array(), + proof_ops: undefined, + height: "0", + codespace: "", + }; +} + +export const ResponseQuery = { + encode(message: ResponseQuery, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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 !== "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.proof_ops !== undefined) { + ProofOps.encode(message.proof_ops, writer.uint32(66).fork()).ldelim(); + } + if (message.height !== "0") { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 6: + message.key = reader.bytes(); + break; + case 7: + message.value = reader.bytes(); + break; + case 8: + message.proof_ops = ProofOps.decode(reader, reader.uint32()); + break; + case 9: + message.height = longToString(reader.int64() as Long); + break; + case 10: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseQuery { + return { + code: isSet(object.code) ? Number(object.code) : 0, + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + index: isSet(object.index) ? String(object.index) : "0", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + proof_ops: isSet(object.proof_ops) ? ProofOps.fromJSON(object.proof_ops) : undefined, + height: isSet(object.height) ? String(object.height) : "0", + codespace: isSet(object.codespace) ? String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseQuery): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.index !== undefined && (obj.index = message.index); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.proof_ops !== undefined && + (obj.proof_ops = message.proof_ops ? ProofOps.toJSON(message.proof_ops) : undefined); + message.height !== undefined && (obj.height = message.height); + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + + fromPartial, I>>(object: I): ResponseQuery { + const message = createBaseResponseQuery(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index ?? "0"; + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.proof_ops = (object.proof_ops !== undefined && object.proof_ops !== null) + ? ProofOps.fromPartial(object.proof_ops) + : undefined; + message.height = object.height ?? "0"; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseBeginBlock(): ResponseBeginBlock { + return { events: [] }; +} + +export const ResponseBeginBlock = { + encode(message: ResponseBeginBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseBeginBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.events.push(Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseBeginBlock { + return { events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [] }; + }, + + toJSON(message: ResponseBeginBlock): unknown { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ResponseBeginBlock { + const message = createBaseResponseBeginBlock(); + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseResponseCheckTx(): ResponseCheckTx { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gas_wanted: "0", + gas_used: "0", + events: [], + codespace: "", + }; +} + +export const ResponseCheckTx = { + encode(message: ResponseCheckTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.gas_wanted !== "0") { + writer.uint32(40).int64(message.gas_wanted); + } + if (message.gas_used !== "0") { + writer.uint32(48).int64(message.gas_used); + } + 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: _m0.Reader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.gas_wanted = longToString(reader.int64() as Long); + break; + case 6: + message.gas_used = longToString(reader.int64() as Long); + 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; + }, + + fromJSON(object: any): ResponseCheckTx { + return { + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + gas_wanted: isSet(object.gas_wanted) ? String(object.gas_wanted) : "0", + gas_used: isSet(object.gas_used) ? String(object.gas_used) : "0", + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseCheckTx): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gas_wanted !== undefined && (obj.gas_wanted = message.gas_wanted); + message.gas_used !== undefined && (obj.gas_used = message.gas_used); + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + + fromPartial, I>>(object: I): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gas_wanted = object.gas_wanted ?? "0"; + message.gas_used = object.gas_used ?? "0"; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseDeliverTx(): ResponseDeliverTx { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gas_wanted: "0", + gas_used: "0", + events: [], + codespace: "", + }; +} + +export const ResponseDeliverTx = { + encode(message: ResponseDeliverTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.gas_wanted !== "0") { + writer.uint32(40).int64(message.gas_wanted); + } + if (message.gas_used !== "0") { + writer.uint32(48).int64(message.gas_used); + } + 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: _m0.Reader | Uint8Array, length?: number): ResponseDeliverTx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseDeliverTx(); + 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.gas_wanted = longToString(reader.int64() as Long); + break; + case 6: + message.gas_used = longToString(reader.int64() as Long); + 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; + }, + + fromJSON(object: any): ResponseDeliverTx { + return { + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + gas_wanted: isSet(object.gas_wanted) ? String(object.gas_wanted) : "0", + gas_used: isSet(object.gas_used) ? String(object.gas_used) : "0", + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseDeliverTx): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gas_wanted !== undefined && (obj.gas_wanted = message.gas_wanted); + message.gas_used !== undefined && (obj.gas_used = message.gas_used); + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + + fromPartial, I>>(object: I): ResponseDeliverTx { + const message = createBaseResponseDeliverTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gas_wanted = object.gas_wanted ?? "0"; + message.gas_used = object.gas_used ?? "0"; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +function createBaseResponseEndBlock(): ResponseEndBlock { + return { validator_updates: [], consensus_param_updates: undefined, events: [] }; +} + +export const ResponseEndBlock = { + encode(message: ResponseEndBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.validator_updates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.consensus_param_updates !== undefined) { + ConsensusParams.encode(message.consensus_param_updates, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEndBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 2: + message.consensus_param_updates = ConsensusParams.decode(reader, reader.uint32()); + break; + case 3: + message.events.push(Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseEndBlock { + return { + validator_updates: Array.isArray(object?.validator_updates) + ? object.validator_updates.map((e: any) => ValidatorUpdate.fromJSON(e)) + : [], + consensus_param_updates: isSet(object.consensus_param_updates) + ? ConsensusParams.fromJSON(object.consensus_param_updates) + : undefined, + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + }; + }, + + toJSON(message: ResponseEndBlock): unknown { + const obj: any = {}; + if (message.validator_updates) { + obj.validator_updates = message.validator_updates.map((e) => e ? ValidatorUpdate.toJSON(e) : undefined); + } else { + obj.validator_updates = []; + } + message.consensus_param_updates !== undefined && (obj.consensus_param_updates = message.consensus_param_updates + ? ConsensusParams.toJSON(message.consensus_param_updates) + : undefined); + if (message.events) { + obj.events = message.events.map((e) => e ? Event.toJSON(e) : undefined); + } else { + obj.events = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ResponseEndBlock { + const message = createBaseResponseEndBlock(); + message.validator_updates = object.validator_updates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensus_param_updates = + (object.consensus_param_updates !== undefined && object.consensus_param_updates !== null) + ? ConsensusParams.fromPartial(object.consensus_param_updates) + : undefined; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseResponseCommit(): ResponseCommit { + return { data: new Uint8Array(), retain_height: "0" }; +} + +export const ResponseCommit = { + encode(message: ResponseCommit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.retain_height !== "0") { + writer.uint32(24).int64(message.retain_height); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCommit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 2: + message.data = reader.bytes(); + break; + case 3: + message.retain_height = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseCommit { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + retain_height: isSet(object.retain_height) ? String(object.retain_height) : "0", + }; + }, + + toJSON(message: ResponseCommit): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.retain_height !== undefined && (obj.retain_height = message.retain_height); + return obj; + }, + + fromPartial, I>>(object: I): ResponseCommit { + const message = createBaseResponseCommit(); + message.data = object.data ?? new Uint8Array(); + message.retain_height = object.retain_height ?? "0"; + return message; + }, +}; + +function createBaseResponseListSnapshots(): ResponseListSnapshots { + return { snapshots: [] }; +} + +export const ResponseListSnapshots = { + encode(message: ResponseListSnapshots, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.snapshots) { + Snapshot.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ResponseListSnapshots { + return { + snapshots: Array.isArray(object?.snapshots) ? object.snapshots.map((e: any) => Snapshot.fromJSON(e)) : [], + }; + }, + + toJSON(message: ResponseListSnapshots): unknown { + const obj: any = {}; + if (message.snapshots) { + obj.snapshots = message.snapshots.map((e) => e ? Snapshot.toJSON(e) : undefined); + } else { + obj.snapshots = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ResponseListSnapshots { + const message = createBaseResponseListSnapshots(); + message.snapshots = object.snapshots?.map((e) => Snapshot.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { + return { result: ResponseOfferSnapshot_Result.UNKNOWN }; +} + +export const ResponseOfferSnapshot = { + encode(message: ResponseOfferSnapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.result !== ResponseOfferSnapshot_Result.UNKNOWN) { + writer.uint32(8).int32(responseOfferSnapshot_ResultToNumber(message.result)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = responseOfferSnapshot_ResultFromJSON(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseOfferSnapshot { + return { + result: isSet(object.result) + ? responseOfferSnapshot_ResultFromJSON(object.result) + : ResponseOfferSnapshot_Result.UNKNOWN, + }; + }, + + toJSON(message: ResponseOfferSnapshot): unknown { + const obj: any = {}; + message.result !== undefined && (obj.result = responseOfferSnapshot_ResultToJSON(message.result)); + return obj; + }, + + fromPartial, I>>(object: I): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? ResponseOfferSnapshot_Result.UNKNOWN; + return message; + }, +}; + +function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { + return { chunk: new Uint8Array() }; +} + +export const ResponseLoadSnapshotChunk = { + encode(message: ResponseLoadSnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ResponseLoadSnapshotChunk { + return { chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array() }; + }, + + toJSON(message: ResponseLoadSnapshotChunk): unknown { + const obj: any = {}; + message.chunk !== undefined && + (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(); + return message; + }, +}; + +function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { + return { result: ResponseApplySnapshotChunk_Result.UNKNOWN, refetch_chunks: [], reject_senders: [] }; +} + +export const ResponseApplySnapshotChunk = { + encode(message: ResponseApplySnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.result !== ResponseApplySnapshotChunk_Result.UNKNOWN) { + writer.uint32(8).int32(responseApplySnapshotChunk_ResultToNumber(message.result)); + } + writer.uint32(18).fork(); + for (const v of message.refetch_chunks) { + writer.uint32(v); + } + writer.ldelim(); + for (const v of message.reject_senders) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = responseApplySnapshotChunk_ResultFromJSON(reader.int32()); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetch_chunks.push(reader.uint32()); + } + } else { + message.refetch_chunks.push(reader.uint32()); + } + break; + case 3: + message.reject_senders.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResponseApplySnapshotChunk { + return { + result: isSet(object.result) + ? responseApplySnapshotChunk_ResultFromJSON(object.result) + : ResponseApplySnapshotChunk_Result.UNKNOWN, + refetch_chunks: Array.isArray(object?.refetch_chunks) ? object.refetch_chunks.map((e: any) => Number(e)) : [], + reject_senders: Array.isArray(object?.reject_senders) ? object.reject_senders.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: ResponseApplySnapshotChunk): unknown { + const obj: any = {}; + message.result !== undefined && (obj.result = responseApplySnapshotChunk_ResultToJSON(message.result)); + if (message.refetch_chunks) { + obj.refetch_chunks = message.refetch_chunks.map((e) => Math.round(e)); + } else { + obj.refetch_chunks = []; + } + if (message.reject_senders) { + obj.reject_senders = message.reject_senders.map((e) => e); + } else { + obj.reject_senders = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? ResponseApplySnapshotChunk_Result.UNKNOWN; + message.refetch_chunks = object.refetch_chunks?.map((e) => e) || []; + message.reject_senders = object.reject_senders?.map((e) => e) || []; + return message; + }, +}; + +function createBaseConsensusParams(): ConsensusParams { + return { block: undefined, evidence: undefined, validator: undefined, version: undefined }; +} + +export const ConsensusParams = { + encode(message: ConsensusParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ConsensusParams { + return { + block: isSet(object.block) ? BlockParams.fromJSON(object.block) : undefined, + evidence: isSet(object.evidence) ? EvidenceParams.fromJSON(object.evidence) : undefined, + validator: isSet(object.validator) ? ValidatorParams.fromJSON(object.validator) : undefined, + version: isSet(object.version) ? VersionParams.fromJSON(object.version) : undefined, + }; + }, + + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + message.block !== undefined && (obj.block = message.block ? BlockParams.toJSON(message.block) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? EvidenceParams.toJSON(message.evidence) : undefined); + message.validator !== undefined && + (obj.validator = message.validator ? ValidatorParams.toJSON(message.validator) : undefined); + message.version !== undefined && + (obj.version = message.version ? VersionParams.toJSON(message.version) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + return message; + }, +}; + +function createBaseBlockParams(): BlockParams { + return { max_bytes: "0", max_gas: "0" }; +} + +export const BlockParams = { + encode(message: BlockParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.max_bytes !== "0") { + writer.uint32(8).int64(message.max_bytes); + } + if (message.max_gas !== "0") { + writer.uint32(16).int64(message.max_gas); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.max_bytes = longToString(reader.int64() as Long); + break; + case 2: + message.max_gas = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BlockParams { + return { + max_bytes: isSet(object.max_bytes) ? String(object.max_bytes) : "0", + max_gas: isSet(object.max_gas) ? String(object.max_gas) : "0", + }; + }, + + toJSON(message: BlockParams): unknown { + const obj: any = {}; + message.max_bytes !== undefined && (obj.max_bytes = message.max_bytes); + message.max_gas !== undefined && (obj.max_gas = message.max_gas); + return obj; + }, + + fromPartial, I>>(object: I): BlockParams { + const message = createBaseBlockParams(); + message.max_bytes = object.max_bytes ?? "0"; + message.max_gas = object.max_gas ?? "0"; + return message; + }, +}; + +function createBaseLastCommitInfo(): LastCommitInfo { + return { round: 0, votes: [] }; +} + +export const LastCommitInfo = { + encode(message: LastCommitInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): LastCommitInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLastCommitInfo(); + 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; + }, + + fromJSON(object: any): LastCommitInfo { + return { + round: isSet(object.round) ? Number(object.round) : 0, + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: LastCommitInfo): unknown { + const obj: any = {}; + message.round !== undefined && (obj.round = Math.round(message.round)); + if (message.votes) { + obj.votes = message.votes.map((e) => e ? VoteInfo.toJSON(e) : undefined); + } else { + obj.votes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): LastCommitInfo { + const message = createBaseLastCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEvent(): Event { + return { type: "", attributes: [] }; +} + +export const Event = { + encode(message: Event, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Event { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Event { + return { + type: isSet(object.type) ? String(object.type) : "", + attributes: Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => EventAttribute.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + if (message.attributes) { + obj.attributes = message.attributes.map((e) => e ? EventAttribute.toJSON(e) : undefined); + } else { + obj.attributes = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Event { + const message = createBaseEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map((e) => EventAttribute.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEventAttribute(): EventAttribute { + return { key: new Uint8Array(), value: new Uint8Array(), index: false }; +} + +export const EventAttribute = { + encode(message: EventAttribute, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.index === true) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.index = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EventAttribute { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + index: isSet(object.index) ? Boolean(object.index) : false, + }; + }, + + toJSON(message: EventAttribute): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.index !== undefined && (obj.index = message.index); + return obj; + }, + + fromPartial, I>>(object: I): EventAttribute { + const message = createBaseEventAttribute(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.index = object.index ?? false; + return message; + }, +}; + +function createBaseTxResult(): TxResult { + return { height: "0", index: 0, tx: new Uint8Array(), result: undefined }; +} + +export const TxResult = { + encode(message: TxResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "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) { + ResponseDeliverTx.encode(message.result, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.index = reader.uint32(); + break; + case 3: + message.tx = reader.bytes(); + break; + case 4: + message.result = ResponseDeliverTx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): TxResult { + return { + height: isSet(object.height) ? String(object.height) : "0", + index: isSet(object.index) ? Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + result: isSet(object.result) ? ResponseDeliverTx.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: TxResult): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.index !== undefined && (obj.index = Math.round(message.index)); + message.tx !== undefined && (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + message.result !== undefined && + (obj.result = message.result ? ResponseDeliverTx.toJSON(message.result) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): TxResult { + const message = createBaseTxResult(); + message.height = object.height ?? "0"; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(); + message.result = (object.result !== undefined && object.result !== null) + ? ResponseDeliverTx.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(), power: "0" }; +} + +export const Validator = { + encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.power !== "0") { + writer.uint32(24).int64(message.power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Validator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(), + power: isSet(object.power) ? String(object.power) : "0", + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + message.address !== undefined && + (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); + message.power !== undefined && (obj.power = message.power); + return obj; + }, + + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.power = object.power ?? "0"; + return message; + }, +}; + +function createBaseValidatorUpdate(): ValidatorUpdate { + return { pub_key: undefined, power: "0" }; +} + +export const ValidatorUpdate = { + encode(message: ValidatorUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pub_key !== undefined) { + PublicKey.encode(message.pub_key, writer.uint32(10).fork()).ldelim(); + } + if (message.power !== "0") { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.pub_key = PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.power = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorUpdate { + return { + pub_key: isSet(object.pub_key) ? PublicKey.fromJSON(object.pub_key) : undefined, + power: isSet(object.power) ? String(object.power) : "0", + }; + }, + + toJSON(message: ValidatorUpdate): unknown { + const obj: any = {}; + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? PublicKey.toJSON(message.pub_key) : undefined); + message.power !== undefined && (obj.power = message.power); + return obj; + }, + + fromPartial, I>>(object: I): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? PublicKey.fromPartial(object.pub_key) + : undefined; + message.power = object.power ?? "0"; + return message; + }, +}; + +function createBaseVoteInfo(): VoteInfo { + return { validator: undefined, signed_last_block: false }; +} + +export const VoteInfo = { + encode(message: VoteInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.signed_last_block === true) { + writer.uint32(16).bool(message.signed_last_block); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 2: + message.signed_last_block = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): VoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + signed_last_block: isSet(object.signed_last_block) ? Boolean(object.signed_last_block) : false, + }; + }, + + toJSON(message: VoteInfo): unknown { + const obj: any = {}; + message.validator !== undefined && + (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); + message.signed_last_block !== undefined && (obj.signed_last_block = message.signed_last_block); + return obj; + }, + + fromPartial, I>>(object: I): VoteInfo { + const message = createBaseVoteInfo(); + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.signed_last_block = object.signed_last_block ?? false; + return message; + }, +}; + +function createBaseEvidence(): Evidence { + return { type: EvidenceType.UNKNOWN, validator: undefined, height: "0", time: undefined, total_voting_power: "0" }; +} + +export const Evidence = { + encode(message: Evidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== EvidenceType.UNKNOWN) { + writer.uint32(8).int32(evidenceTypeToNumber(message.type)); + } + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== "0") { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.total_voting_power !== "0") { + writer.uint32(40).int64(message.total_voting_power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Evidence { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.type = evidenceTypeFromJSON(reader.int32()); + break; + case 2: + message.validator = Validator.decode(reader, reader.uint32()); + break; + case 3: + message.height = longToString(reader.int64() as Long); + break; + case 4: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.total_voting_power = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Evidence { + return { + type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : EvidenceType.UNKNOWN, + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + height: isSet(object.height) ? String(object.height) : "0", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + total_voting_power: isSet(object.total_voting_power) ? String(object.total_voting_power) : "0", + }; + }, + + toJSON(message: Evidence): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = evidenceTypeToJSON(message.type)); + message.validator !== undefined && + (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); + message.height !== undefined && (obj.height = message.height); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.total_voting_power !== undefined && (obj.total_voting_power = message.total_voting_power); + return obj; + }, + + fromPartial, I>>(object: I): Evidence { + const message = createBaseEvidence(); + message.type = object.type ?? EvidenceType.UNKNOWN; + message.validator = (object.validator !== undefined && object.validator !== null) + ? Validator.fromPartial(object.validator) + : undefined; + message.height = object.height ?? "0"; + message.time = object.time ?? undefined; + message.total_voting_power = object.total_voting_power ?? "0"; + return message; + }, +}; + +function createBaseSnapshot(): Snapshot { + return { height: "0", format: 0, chunks: 0, hash: new Uint8Array(), metadata: new Uint8Array() }; +} + +export const Snapshot = { + encode(message: Snapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "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: _m0.Reader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + 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; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? String(object.height) : "0", + format: isSet(object.format) ? Number(object.format) : 0, + chunks: isSet(object.chunks) ? Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + metadata: isSet(object.metadata) ? bytesFromBase64(object.metadata) : new Uint8Array(), + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunks !== undefined && (obj.chunks = Math.round(message.chunks)); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.metadata !== undefined && + (obj.metadata = base64FromBytes(message.metadata !== undefined ? message.metadata : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): Snapshot { + const message = createBaseSnapshot(); + message.height = object.height ?? "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; + }, +}; + +export interface ABCIApplication { + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + SetOption(request: RequestSetOption): Promise; + DeliverTx(request: RequestDeliverTx): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + BeginBlock(request: RequestBeginBlock): Promise; + EndBlock(request: RequestEndBlock): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; +} + +export class ABCIApplicationClientImpl implements ABCIApplication { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || "tendermint.abci.ABCIApplication"; + this.rpc = rpc; + this.Echo = this.Echo.bind(this); + this.Flush = this.Flush.bind(this); + this.Info = this.Info.bind(this); + this.SetOption = this.SetOption.bind(this); + this.DeliverTx = this.DeliverTx.bind(this); + this.CheckTx = this.CheckTx.bind(this); + this.Query = this.Query.bind(this); + this.Commit = this.Commit.bind(this); + this.InitChain = this.InitChain.bind(this); + this.BeginBlock = this.BeginBlock.bind(this); + this.EndBlock = this.EndBlock.bind(this); + this.ListSnapshots = this.ListSnapshots.bind(this); + this.OfferSnapshot = this.OfferSnapshot.bind(this); + this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); + this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + } + Echo(request: RequestEcho): Promise { + const data = RequestEcho.encode(request).finish(); + const promise = this.rpc.request(this.service, "Echo", data); + return promise.then((data) => ResponseEcho.decode(new _m0.Reader(data))); + } + + Flush(request: RequestFlush): Promise { + const data = RequestFlush.encode(request).finish(); + const promise = this.rpc.request(this.service, "Flush", data); + return promise.then((data) => ResponseFlush.decode(new _m0.Reader(data))); + } + + Info(request: RequestInfo): Promise { + const data = RequestInfo.encode(request).finish(); + const promise = this.rpc.request(this.service, "Info", data); + return promise.then((data) => ResponseInfo.decode(new _m0.Reader(data))); + } + + SetOption(request: RequestSetOption): Promise { + const data = RequestSetOption.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetOption", data); + return promise.then((data) => ResponseSetOption.decode(new _m0.Reader(data))); + } + + DeliverTx(request: RequestDeliverTx): Promise { + const data = RequestDeliverTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeliverTx", data); + return promise.then((data) => ResponseDeliverTx.decode(new _m0.Reader(data))); + } + + CheckTx(request: RequestCheckTx): Promise { + const data = RequestCheckTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "CheckTx", data); + return promise.then((data) => ResponseCheckTx.decode(new _m0.Reader(data))); + } + + Query(request: RequestQuery): Promise { + const data = RequestQuery.encode(request).finish(); + const promise = this.rpc.request(this.service, "Query", data); + return promise.then((data) => ResponseQuery.decode(new _m0.Reader(data))); + } + + Commit(request: RequestCommit): Promise { + const data = RequestCommit.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commit", data); + return promise.then((data) => ResponseCommit.decode(new _m0.Reader(data))); + } + + InitChain(request: RequestInitChain): Promise { + const data = RequestInitChain.encode(request).finish(); + const promise = this.rpc.request(this.service, "InitChain", data); + return promise.then((data) => ResponseInitChain.decode(new _m0.Reader(data))); + } + + BeginBlock(request: RequestBeginBlock): Promise { + const data = RequestBeginBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "BeginBlock", data); + return promise.then((data) => ResponseBeginBlock.decode(new _m0.Reader(data))); + } + + EndBlock(request: RequestEndBlock): Promise { + const data = RequestEndBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "EndBlock", data); + return promise.then((data) => ResponseEndBlock.decode(new _m0.Reader(data))); + } + + ListSnapshots(request: RequestListSnapshots): Promise { + const data = RequestListSnapshots.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListSnapshots", data); + return promise.then((data) => ResponseListSnapshots.decode(new _m0.Reader(data))); + } + + OfferSnapshot(request: RequestOfferSnapshot): Promise { + const data = RequestOfferSnapshot.encode(request).finish(); + const promise = this.rpc.request(this.service, "OfferSnapshot", data); + return promise.then((data) => ResponseOfferSnapshot.decode(new _m0.Reader(data))); + } + + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise { + const data = RequestLoadSnapshotChunk.encode(request).finish(); + const promise = this.rpc.request(this.service, "LoadSnapshotChunk", data); + return promise.then((data) => ResponseLoadSnapshotChunk.decode(new _m0.Reader(data))); + } + + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise { + const data = RequestApplySnapshotChunk.encode(request).finish(); + const promise = this.rpc.request(this.service, "ApplySnapshotChunk", data); + return promise.then((data) => ResponseApplySnapshotChunk.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/crypto/keys.ts b/common/types/src/lcd/tendermint/crypto/keys.ts new file mode 100644 index 00000000..a3f5f88f --- /dev/null +++ b/common/types/src/lcd/tendermint/crypto/keys.ts @@ -0,0 +1,129 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "tendermint.crypto"; + +/** PublicKey defines the keys available for use with Tendermint Validators */ +export interface PublicKey { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; +} + +function createBasePublicKey(): PublicKey { + return { ed25519: undefined, secp256k1: undefined }; +} + +export const PublicKey = { + encode(message: PublicKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PublicKey { + return { + ed25519: isSet(object.ed25519) ? bytesFromBase64(object.ed25519) : undefined, + secp256k1: isSet(object.secp256k1) ? bytesFromBase64(object.secp256k1) : undefined, + }; + }, + + toJSON(message: PublicKey): unknown { + const obj: any = {}; + message.ed25519 !== undefined && + (obj.ed25519 = message.ed25519 !== undefined ? base64FromBytes(message.ed25519) : undefined); + message.secp256k1 !== undefined && + (obj.secp256k1 = message.secp256k1 !== undefined ? base64FromBytes(message.secp256k1) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): PublicKey { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/crypto/proof.ts b/common/types/src/lcd/tendermint/crypto/proof.ts new file mode 100644 index 00000000..5c9e78de --- /dev/null +++ b/common/types/src/lcd/tendermint/crypto/proof.ts @@ -0,0 +1,436 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "tendermint.crypto"; + +export interface Proof { + total: string; + index: string; + leaf_hash: Uint8Array; + aunts: Uint8Array[]; +} + +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof?: Proof; +} + +export interface DominoOp { + key: string; + input: string; + output: string; +} + +/** + * 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; +} + +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOps { + ops: ProofOp[]; +} + +function createBaseProof(): Proof { + return { total: "0", index: "0", leaf_hash: new Uint8Array(), aunts: [] }; +} + +export const Proof = { + encode(message: Proof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.total !== "0") { + writer.uint32(8).int64(message.total); + } + if (message.index !== "0") { + writer.uint32(16).int64(message.index); + } + if (message.leaf_hash.length !== 0) { + writer.uint32(26).bytes(message.leaf_hash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Proof { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.index = longToString(reader.int64() as Long); + break; + case 3: + message.leaf_hash = reader.bytes(); + break; + case 4: + message.aunts.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Proof { + return { + total: isSet(object.total) ? String(object.total) : "0", + index: isSet(object.index) ? String(object.index) : "0", + leaf_hash: isSet(object.leaf_hash) ? bytesFromBase64(object.leaf_hash) : new Uint8Array(), + aunts: Array.isArray(object?.aunts) ? object.aunts.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Proof): unknown { + const obj: any = {}; + message.total !== undefined && (obj.total = message.total); + message.index !== undefined && (obj.index = message.index); + message.leaf_hash !== undefined && + (obj.leaf_hash = base64FromBytes(message.leaf_hash !== undefined ? message.leaf_hash : new Uint8Array())); + if (message.aunts) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.aunts = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Proof { + const message = createBaseProof(); + message.total = object.total ?? "0"; + message.index = object.index ?? "0"; + message.leaf_hash = object.leaf_hash ?? new Uint8Array(); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValueOp(): ValueOp { + return { key: new Uint8Array(), proof: undefined }; +} + +export const ValueOp = { + encode(message: ValueOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ValueOp { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: ValueOp): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseDominoOp(): DominoOp { + return { key: "", input: "", output: "" }; +} + +export const DominoOp = { + encode(message: DominoOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): DominoOp { + return { + key: isSet(object.key) ? String(object.key) : "", + input: isSet(object.input) ? String(object.input) : "", + output: isSet(object.output) ? String(object.output) : "", + }; + }, + + toJSON(message: DominoOp): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.input !== undefined && (obj.input = message.input); + message.output !== undefined && (obj.output = message.output); + return obj; + }, + + fromPartial, I>>(object: I): DominoOp { + const message = createBaseDominoOp(); + message.key = object.key ?? ""; + message.input = object.input ?? ""; + message.output = object.output ?? ""; + return message; + }, +}; + +function createBaseProofOp(): ProofOp { + return { type: "", key: new Uint8Array(), data: new Uint8Array() }; +} + +export const ProofOp = { + encode(message: ProofOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +export const ProofOps = { + encode(message: ProofOps, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): ProofOps { + return { ops: Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops) { + obj.ops = message.ops.map((e) => e ? ProofOp.toJSON(e) : undefined); + } else { + obj.ops = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/libs/bits/types.ts b/common/types/src/lcd/tendermint/libs/bits/types.ts new file mode 100644 index 00000000..ddef8ae2 --- /dev/null +++ b/common/types/src/lcd/tendermint/libs/bits/types.ts @@ -0,0 +1,105 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "tendermint.libs.bits"; + +export interface BitArray { + bits: string; + elems: string[]; +} + +function createBaseBitArray(): BitArray { + return { bits: "0", elems: [] }; +} + +export const BitArray = { + encode(message: BitArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bits !== "0") { + writer.uint32(8).int64(message.bits); + } + writer.uint32(18).fork(); + for (const v of message.elems) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BitArray { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bits = longToString(reader.int64() as Long); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.elems.push(longToString(reader.uint64() as Long)); + } + } else { + message.elems.push(longToString(reader.uint64() as Long)); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BitArray { + return { + bits: isSet(object.bits) ? String(object.bits) : "0", + elems: Array.isArray(object?.elems) ? object.elems.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: BitArray): unknown { + const obj: any = {}; + message.bits !== undefined && (obj.bits = message.bits); + if (message.elems) { + obj.elems = message.elems.map((e) => e); + } else { + obj.elems = []; + } + return obj; + }, + + fromPartial, I>>(object: I): BitArray { + const message = createBaseBitArray(); + message.bits = object.bits ?? "0"; + message.elems = object.elems?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/p2p/types.ts b/common/types/src/lcd/tendermint/p2p/types.ts new file mode 100644 index 00000000..8c8f4f0c --- /dev/null +++ b/common/types/src/lcd/tendermint/p2p/types.ts @@ -0,0 +1,532 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; + +export const protobufPackage = "tendermint.p2p"; + +export interface ProtocolVersion { + p2p: string; + block: string; + app: string; +} + +export interface NodeInfo { + protocol_version?: ProtocolVersion; + node_id: string; + listen_addr: string; + network: string; + version: string; + channels: Uint8Array; + moniker: string; + other?: NodeInfoOther; +} + +export interface NodeInfoOther { + tx_index: string; + rpc_address: string; +} + +export interface PeerInfo { + id: string; + address_info: PeerAddressInfo[]; + last_connected?: Date; +} + +export interface PeerAddressInfo { + address: string; + last_dial_success?: Date; + last_dial_failure?: Date; + dial_failures: number; +} + +function createBaseProtocolVersion(): ProtocolVersion { + return { p2p: "0", block: "0", app: "0" }; +} + +export const ProtocolVersion = { + encode(message: ProtocolVersion, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.p2p !== "0") { + writer.uint32(8).uint64(message.p2p); + } + if (message.block !== "0") { + writer.uint32(16).uint64(message.block); + } + if (message.app !== "0") { + writer.uint32(24).uint64(message.app); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProtocolVersion { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProtocolVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.p2p = longToString(reader.uint64() as Long); + break; + case 2: + message.block = longToString(reader.uint64() as Long); + break; + case 3: + message.app = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ProtocolVersion { + return { + p2p: isSet(object.p2p) ? String(object.p2p) : "0", + block: isSet(object.block) ? String(object.block) : "0", + app: isSet(object.app) ? String(object.app) : "0", + }; + }, + + toJSON(message: ProtocolVersion): unknown { + const obj: any = {}; + message.p2p !== undefined && (obj.p2p = message.p2p); + message.block !== undefined && (obj.block = message.block); + message.app !== undefined && (obj.app = message.app); + return obj; + }, + + fromPartial, I>>(object: I): ProtocolVersion { + const message = createBaseProtocolVersion(); + message.p2p = object.p2p ?? "0"; + message.block = object.block ?? "0"; + message.app = object.app ?? "0"; + return message; + }, +}; + +function createBaseNodeInfo(): NodeInfo { + return { + protocol_version: undefined, + node_id: "", + listen_addr: "", + network: "", + version: "", + channels: new Uint8Array(), + moniker: "", + other: undefined, + }; +} + +export const NodeInfo = { + encode(message: NodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.protocol_version !== undefined) { + ProtocolVersion.encode(message.protocol_version, writer.uint32(10).fork()).ldelim(); + } + if (message.node_id !== "") { + writer.uint32(18).string(message.node_id); + } + if (message.listen_addr !== "") { + writer.uint32(26).string(message.listen_addr); + } + if (message.network !== "") { + writer.uint32(34).string(message.network); + } + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + if (message.channels.length !== 0) { + writer.uint32(50).bytes(message.channels); + } + if (message.moniker !== "") { + writer.uint32(58).string(message.moniker); + } + if (message.other !== undefined) { + NodeInfoOther.encode(message.other, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NodeInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.protocol_version = ProtocolVersion.decode(reader, reader.uint32()); + break; + case 2: + message.node_id = reader.string(); + break; + case 3: + message.listen_addr = reader.string(); + break; + case 4: + message.network = reader.string(); + break; + case 5: + message.version = reader.string(); + break; + case 6: + message.channels = reader.bytes(); + break; + case 7: + message.moniker = reader.string(); + break; + case 8: + message.other = NodeInfoOther.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NodeInfo { + return { + protocol_version: isSet(object.protocol_version) ? ProtocolVersion.fromJSON(object.protocol_version) : undefined, + node_id: isSet(object.node_id) ? String(object.node_id) : "", + listen_addr: isSet(object.listen_addr) ? String(object.listen_addr) : "", + network: isSet(object.network) ? String(object.network) : "", + version: isSet(object.version) ? String(object.version) : "", + channels: isSet(object.channels) ? bytesFromBase64(object.channels) : new Uint8Array(), + moniker: isSet(object.moniker) ? String(object.moniker) : "", + other: isSet(object.other) ? NodeInfoOther.fromJSON(object.other) : undefined, + }; + }, + + toJSON(message: NodeInfo): unknown { + const obj: any = {}; + message.protocol_version !== undefined && + (obj.protocol_version = message.protocol_version ? ProtocolVersion.toJSON(message.protocol_version) : undefined); + message.node_id !== undefined && (obj.node_id = message.node_id); + message.listen_addr !== undefined && (obj.listen_addr = message.listen_addr); + message.network !== undefined && (obj.network = message.network); + message.version !== undefined && (obj.version = message.version); + message.channels !== undefined && + (obj.channels = base64FromBytes(message.channels !== undefined ? message.channels : new Uint8Array())); + message.moniker !== undefined && (obj.moniker = message.moniker); + message.other !== undefined && (obj.other = message.other ? NodeInfoOther.toJSON(message.other) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): NodeInfo { + const message = createBaseNodeInfo(); + message.protocol_version = (object.protocol_version !== undefined && object.protocol_version !== null) + ? ProtocolVersion.fromPartial(object.protocol_version) + : undefined; + message.node_id = object.node_id ?? ""; + message.listen_addr = object.listen_addr ?? ""; + message.network = object.network ?? ""; + message.version = object.version ?? ""; + message.channels = object.channels ?? new Uint8Array(); + message.moniker = object.moniker ?? ""; + message.other = (object.other !== undefined && object.other !== null) + ? NodeInfoOther.fromPartial(object.other) + : undefined; + return message; + }, +}; + +function createBaseNodeInfoOther(): NodeInfoOther { + return { tx_index: "", rpc_address: "" }; +} + +export const NodeInfoOther = { + encode(message: NodeInfoOther, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tx_index !== "") { + writer.uint32(10).string(message.tx_index); + } + if (message.rpc_address !== "") { + writer.uint32(18).string(message.rpc_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NodeInfoOther { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeInfoOther(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx_index = reader.string(); + break; + case 2: + message.rpc_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NodeInfoOther { + return { + tx_index: isSet(object.tx_index) ? String(object.tx_index) : "", + rpc_address: isSet(object.rpc_address) ? String(object.rpc_address) : "", + }; + }, + + toJSON(message: NodeInfoOther): unknown { + const obj: any = {}; + message.tx_index !== undefined && (obj.tx_index = message.tx_index); + message.rpc_address !== undefined && (obj.rpc_address = message.rpc_address); + return obj; + }, + + fromPartial, I>>(object: I): NodeInfoOther { + const message = createBaseNodeInfoOther(); + message.tx_index = object.tx_index ?? ""; + message.rpc_address = object.rpc_address ?? ""; + return message; + }, +}; + +function createBasePeerInfo(): PeerInfo { + return { id: "", address_info: [], last_connected: undefined }; +} + +export const PeerInfo = { + encode(message: PeerInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + for (const v of message.address_info) { + PeerAddressInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.last_connected !== undefined) { + Timestamp.encode(toTimestamp(message.last_connected), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PeerInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.address_info.push(PeerAddressInfo.decode(reader, reader.uint32())); + break; + case 3: + message.last_connected = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PeerInfo { + return { + id: isSet(object.id) ? String(object.id) : "", + address_info: Array.isArray(object?.address_info) + ? object.address_info.map((e: any) => PeerAddressInfo.fromJSON(e)) + : [], + last_connected: isSet(object.last_connected) ? fromJsonTimestamp(object.last_connected) : undefined, + }; + }, + + toJSON(message: PeerInfo): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + if (message.address_info) { + obj.address_info = message.address_info.map((e) => e ? PeerAddressInfo.toJSON(e) : undefined); + } else { + obj.address_info = []; + } + message.last_connected !== undefined && (obj.last_connected = message.last_connected.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): PeerInfo { + const message = createBasePeerInfo(); + message.id = object.id ?? ""; + message.address_info = object.address_info?.map((e) => PeerAddressInfo.fromPartial(e)) || []; + message.last_connected = object.last_connected ?? undefined; + return message; + }, +}; + +function createBasePeerAddressInfo(): PeerAddressInfo { + return { address: "", last_dial_success: undefined, last_dial_failure: undefined, dial_failures: 0 }; +} + +export const PeerAddressInfo = { + encode(message: PeerAddressInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.last_dial_success !== undefined) { + Timestamp.encode(toTimestamp(message.last_dial_success), writer.uint32(18).fork()).ldelim(); + } + if (message.last_dial_failure !== undefined) { + Timestamp.encode(toTimestamp(message.last_dial_failure), writer.uint32(26).fork()).ldelim(); + } + if (message.dial_failures !== 0) { + writer.uint32(32).uint32(message.dial_failures); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PeerAddressInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeerAddressInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.last_dial_success = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.last_dial_failure = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 4: + message.dial_failures = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PeerAddressInfo { + return { + address: isSet(object.address) ? String(object.address) : "", + last_dial_success: isSet(object.last_dial_success) ? fromJsonTimestamp(object.last_dial_success) : undefined, + last_dial_failure: isSet(object.last_dial_failure) ? fromJsonTimestamp(object.last_dial_failure) : undefined, + dial_failures: isSet(object.dial_failures) ? Number(object.dial_failures) : 0, + }; + }, + + toJSON(message: PeerAddressInfo): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.last_dial_success !== undefined && (obj.last_dial_success = message.last_dial_success.toISOString()); + message.last_dial_failure !== undefined && (obj.last_dial_failure = message.last_dial_failure.toISOString()); + message.dial_failures !== undefined && (obj.dial_failures = Math.round(message.dial_failures)); + return obj; + }, + + fromPartial, I>>(object: I): PeerAddressInfo { + const message = createBasePeerAddressInfo(); + message.address = object.address ?? ""; + message.last_dial_success = object.last_dial_success ?? undefined; + message.last_dial_failure = object.last_dial_failure ?? undefined; + message.dial_failures = object.dial_failures ?? 0; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/types/block.ts b/common/types/src/lcd/tendermint/types/block.ts new file mode 100644 index 00000000..beb4c40b --- /dev/null +++ b/common/types/src/lcd/tendermint/types/block.ts @@ -0,0 +1,112 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { EvidenceList } from "./evidence"; +import { Commit, Data, Header } from "./types"; + +export const protobufPackage = "tendermint.types"; + +export interface Block { + header?: Header; + data?: Data; + evidence?: EvidenceList; + last_commit?: Commit; +} + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, last_commit: undefined }; +} + +export const Block = { + encode(message: Block, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.last_commit !== undefined) { + Commit.encode(message.last_commit, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Block { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.last_commit = Commit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Block { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + data: isSet(object.data) ? Data.fromJSON(object.data) : undefined, + evidence: isSet(object.evidence) ? EvidenceList.fromJSON(object.evidence) : undefined, + last_commit: isSet(object.last_commit) ? Commit.fromJSON(object.last_commit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.data !== undefined && (obj.data = message.data ? Data.toJSON(message.data) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? EvidenceList.toJSON(message.evidence) : undefined); + message.last_commit !== undefined && + (obj.last_commit = message.last_commit ? Commit.toJSON(message.last_commit) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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.last_commit = (object.last_commit !== undefined && object.last_commit !== null) + ? Commit.fromPartial(object.last_commit) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/types/evidence.ts b/common/types/src/lcd/tendermint/types/evidence.ts new file mode 100644 index 00000000..d4d5ed66 --- /dev/null +++ b/common/types/src/lcd/tendermint/types/evidence.ts @@ -0,0 +1,394 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { LightBlock, Vote } from "./types"; +import { Validator } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +export interface Evidence { + duplicate_vote_evidence?: DuplicateVoteEvidence | undefined; + light_client_attack_evidence?: LightClientAttackEvidence | undefined; +} + +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidence { + vote_a?: Vote; + vote_b?: Vote; + total_voting_power: string; + validator_power: string; + timestamp?: Date; +} + +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidence { + conflicting_block?: LightBlock; + common_height: string; + byzantine_validators: Validator[]; + total_voting_power: string; + timestamp?: Date; +} + +export interface EvidenceList { + evidence: Evidence[]; +} + +function createBaseEvidence(): Evidence { + return { duplicate_vote_evidence: undefined, light_client_attack_evidence: undefined }; +} + +export const Evidence = { + encode(message: Evidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.duplicate_vote_evidence !== undefined) { + DuplicateVoteEvidence.encode(message.duplicate_vote_evidence, writer.uint32(10).fork()).ldelim(); + } + if (message.light_client_attack_evidence !== undefined) { + LightClientAttackEvidence.encode(message.light_client_attack_evidence, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Evidence { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.duplicate_vote_evidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); + break; + case 2: + message.light_client_attack_evidence = LightClientAttackEvidence.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Evidence { + return { + duplicate_vote_evidence: isSet(object.duplicate_vote_evidence) + ? DuplicateVoteEvidence.fromJSON(object.duplicate_vote_evidence) + : undefined, + light_client_attack_evidence: isSet(object.light_client_attack_evidence) + ? LightClientAttackEvidence.fromJSON(object.light_client_attack_evidence) + : undefined, + }; + }, + + toJSON(message: Evidence): unknown { + const obj: any = {}; + message.duplicate_vote_evidence !== undefined && (obj.duplicate_vote_evidence = message.duplicate_vote_evidence + ? DuplicateVoteEvidence.toJSON(message.duplicate_vote_evidence) + : undefined); + message.light_client_attack_evidence !== undefined && + (obj.light_client_attack_evidence = message.light_client_attack_evidence + ? LightClientAttackEvidence.toJSON(message.light_client_attack_evidence) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): Evidence { + const message = createBaseEvidence(); + message.duplicate_vote_evidence = + (object.duplicate_vote_evidence !== undefined && object.duplicate_vote_evidence !== null) + ? DuplicateVoteEvidence.fromPartial(object.duplicate_vote_evidence) + : undefined; + message.light_client_attack_evidence = + (object.light_client_attack_evidence !== undefined && object.light_client_attack_evidence !== null) + ? LightClientAttackEvidence.fromPartial(object.light_client_attack_evidence) + : undefined; + return message; + }, +}; + +function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { + return { vote_a: undefined, vote_b: undefined, total_voting_power: "0", validator_power: "0", timestamp: undefined }; +} + +export const DuplicateVoteEvidence = { + encode(message: DuplicateVoteEvidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vote_a !== undefined) { + Vote.encode(message.vote_a, writer.uint32(10).fork()).ldelim(); + } + if (message.vote_b !== undefined) { + Vote.encode(message.vote_b, writer.uint32(18).fork()).ldelim(); + } + if (message.total_voting_power !== "0") { + writer.uint32(24).int64(message.total_voting_power); + } + if (message.validator_power !== "0") { + writer.uint32(32).int64(message.validator_power); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.vote_a = Vote.decode(reader, reader.uint32()); + break; + case 2: + message.vote_b = Vote.decode(reader, reader.uint32()); + break; + case 3: + message.total_voting_power = longToString(reader.int64() as Long); + break; + case 4: + message.validator_power = longToString(reader.int64() as Long); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DuplicateVoteEvidence { + return { + vote_a: isSet(object.vote_a) ? Vote.fromJSON(object.vote_a) : undefined, + vote_b: isSet(object.vote_b) ? Vote.fromJSON(object.vote_b) : undefined, + total_voting_power: isSet(object.total_voting_power) ? String(object.total_voting_power) : "0", + validator_power: isSet(object.validator_power) ? String(object.validator_power) : "0", + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: DuplicateVoteEvidence): unknown { + const obj: any = {}; + message.vote_a !== undefined && (obj.vote_a = message.vote_a ? Vote.toJSON(message.vote_a) : undefined); + message.vote_b !== undefined && (obj.vote_b = message.vote_b ? Vote.toJSON(message.vote_b) : undefined); + message.total_voting_power !== undefined && (obj.total_voting_power = message.total_voting_power); + message.validator_power !== undefined && (obj.validator_power = message.validator_power); + message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + message.vote_a = (object.vote_a !== undefined && object.vote_a !== null) + ? Vote.fromPartial(object.vote_a) + : undefined; + message.vote_b = (object.vote_b !== undefined && object.vote_b !== null) + ? Vote.fromPartial(object.vote_b) + : undefined; + message.total_voting_power = object.total_voting_power ?? "0"; + message.validator_power = object.validator_power ?? "0"; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { + return { + conflicting_block: undefined, + common_height: "0", + byzantine_validators: [], + total_voting_power: "0", + timestamp: undefined, + }; +} + +export const LightClientAttackEvidence = { + encode(message: LightClientAttackEvidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.conflicting_block !== undefined) { + LightBlock.encode(message.conflicting_block, writer.uint32(10).fork()).ldelim(); + } + if (message.common_height !== "0") { + writer.uint32(16).int64(message.common_height); + } + for (const v of message.byzantine_validators) { + Validator.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.total_voting_power !== "0") { + writer.uint32(32).int64(message.total_voting_power); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.conflicting_block = LightBlock.decode(reader, reader.uint32()); + break; + case 2: + message.common_height = longToString(reader.int64() as Long); + break; + case 3: + message.byzantine_validators.push(Validator.decode(reader, reader.uint32())); + break; + case 4: + message.total_voting_power = longToString(reader.int64() as Long); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LightClientAttackEvidence { + return { + conflicting_block: isSet(object.conflicting_block) ? LightBlock.fromJSON(object.conflicting_block) : undefined, + common_height: isSet(object.common_height) ? String(object.common_height) : "0", + byzantine_validators: Array.isArray(object?.byzantine_validators) + ? object.byzantine_validators.map((e: any) => Validator.fromJSON(e)) + : [], + total_voting_power: isSet(object.total_voting_power) ? String(object.total_voting_power) : "0", + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: LightClientAttackEvidence): unknown { + const obj: any = {}; + message.conflicting_block !== undefined && + (obj.conflicting_block = message.conflicting_block ? LightBlock.toJSON(message.conflicting_block) : undefined); + message.common_height !== undefined && (obj.common_height = message.common_height); + if (message.byzantine_validators) { + obj.byzantine_validators = message.byzantine_validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.byzantine_validators = []; + } + message.total_voting_power !== undefined && (obj.total_voting_power = message.total_voting_power); + message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); + return obj; + }, + + fromPartial, I>>(object: I): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + message.conflicting_block = (object.conflicting_block !== undefined && object.conflicting_block !== null) + ? LightBlock.fromPartial(object.conflicting_block) + : undefined; + message.common_height = object.common_height ?? "0"; + message.byzantine_validators = object.byzantine_validators?.map((e) => Validator.fromPartial(e)) || []; + message.total_voting_power = object.total_voting_power ?? "0"; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +function createBaseEvidenceList(): EvidenceList { + return { evidence: [] }; +} + +export const EvidenceList = { + encode(message: EvidenceList, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.evidence) { + Evidence.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): EvidenceList { + return { evidence: Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Evidence.fromJSON(e)) : [] }; + }, + + toJSON(message: EvidenceList): unknown { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map((e) => e ? Evidence.toJSON(e) : undefined); + } else { + obj.evidence = []; + } + return obj; + }, + + fromPartial, I>>(object: I): EvidenceList { + const message = createBaseEvidenceList(); + message.evidence = object.evidence?.map((e) => Evidence.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/types/params.ts b/common/types/src/lcd/tendermint/types/params.ts new file mode 100644 index 00000000..c5e07f0b --- /dev/null +++ b/common/types/src/lcd/tendermint/types/params.ts @@ -0,0 +1,492 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Duration } from "../../google/protobuf/duration"; + +export const protobufPackage = "tendermint.types"; + +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParams { + block?: BlockParams; + evidence?: EvidenceParams; + validator?: ValidatorParams; + version?: VersionParams; +} + +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * 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; + /** + * Minimum time increment between consecutive blocks (in milliseconds) If the + * block header timestamp is ahead of the system clock, decrease this value. + * + * Not exposed to the application. + */ + time_iota_ms: string; +} + +/** 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}. + */ + 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?: 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 + */ + max_bytes: string; +} + +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pub_key_types: string[]; +} + +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app_version: string; +} + +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + block_max_bytes: string; + block_max_gas: string; +} + +function createBaseConsensusParams(): ConsensusParams { + return { block: undefined, evidence: undefined, validator: undefined, version: undefined }; +} + +export const ConsensusParams = { + encode(message: ConsensusParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ConsensusParams { + return { + block: isSet(object.block) ? BlockParams.fromJSON(object.block) : undefined, + evidence: isSet(object.evidence) ? EvidenceParams.fromJSON(object.evidence) : undefined, + validator: isSet(object.validator) ? ValidatorParams.fromJSON(object.validator) : undefined, + version: isSet(object.version) ? VersionParams.fromJSON(object.version) : undefined, + }; + }, + + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + message.block !== undefined && (obj.block = message.block ? BlockParams.toJSON(message.block) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? EvidenceParams.toJSON(message.evidence) : undefined); + message.validator !== undefined && + (obj.validator = message.validator ? ValidatorParams.toJSON(message.validator) : undefined); + message.version !== undefined && + (obj.version = message.version ? VersionParams.toJSON(message.version) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + return message; + }, +}; + +function createBaseBlockParams(): BlockParams { + return { max_bytes: "0", max_gas: "0", time_iota_ms: "0" }; +} + +export const BlockParams = { + encode(message: BlockParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.max_bytes !== "0") { + writer.uint32(8).int64(message.max_bytes); + } + if (message.max_gas !== "0") { + writer.uint32(16).int64(message.max_gas); + } + if (message.time_iota_ms !== "0") { + writer.uint32(24).int64(message.time_iota_ms); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.max_bytes = longToString(reader.int64() as Long); + break; + case 2: + message.max_gas = longToString(reader.int64() as Long); + break; + case 3: + message.time_iota_ms = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BlockParams { + return { + max_bytes: isSet(object.max_bytes) ? String(object.max_bytes) : "0", + max_gas: isSet(object.max_gas) ? String(object.max_gas) : "0", + time_iota_ms: isSet(object.time_iota_ms) ? String(object.time_iota_ms) : "0", + }; + }, + + toJSON(message: BlockParams): unknown { + const obj: any = {}; + message.max_bytes !== undefined && (obj.max_bytes = message.max_bytes); + message.max_gas !== undefined && (obj.max_gas = message.max_gas); + message.time_iota_ms !== undefined && (obj.time_iota_ms = message.time_iota_ms); + return obj; + }, + + fromPartial, I>>(object: I): BlockParams { + const message = createBaseBlockParams(); + message.max_bytes = object.max_bytes ?? "0"; + message.max_gas = object.max_gas ?? "0"; + message.time_iota_ms = object.time_iota_ms ?? "0"; + return message; + }, +}; + +function createBaseEvidenceParams(): EvidenceParams { + return { max_age_num_blocks: "0", max_age_duration: undefined, max_bytes: "0" }; +} + +export const EvidenceParams = { + encode(message: EvidenceParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.max_age_num_blocks !== "0") { + writer.uint32(8).int64(message.max_age_num_blocks); + } + if (message.max_age_duration !== undefined) { + Duration.encode(message.max_age_duration, writer.uint32(18).fork()).ldelim(); + } + if (message.max_bytes !== "0") { + writer.uint32(24).int64(message.max_bytes); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.max_age_num_blocks = longToString(reader.int64() as Long); + break; + case 2: + message.max_age_duration = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.max_bytes = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EvidenceParams { + return { + max_age_num_blocks: isSet(object.max_age_num_blocks) ? String(object.max_age_num_blocks) : "0", + max_age_duration: isSet(object.max_age_duration) ? Duration.fromJSON(object.max_age_duration) : undefined, + max_bytes: isSet(object.max_bytes) ? String(object.max_bytes) : "0", + }; + }, + + toJSON(message: EvidenceParams): unknown { + const obj: any = {}; + message.max_age_num_blocks !== undefined && (obj.max_age_num_blocks = message.max_age_num_blocks); + message.max_age_duration !== undefined && + (obj.max_age_duration = message.max_age_duration ? Duration.toJSON(message.max_age_duration) : undefined); + message.max_bytes !== undefined && (obj.max_bytes = message.max_bytes); + return obj; + }, + + fromPartial, I>>(object: I): EvidenceParams { + const message = createBaseEvidenceParams(); + message.max_age_num_blocks = object.max_age_num_blocks ?? "0"; + message.max_age_duration = (object.max_age_duration !== undefined && object.max_age_duration !== null) + ? Duration.fromPartial(object.max_age_duration) + : undefined; + message.max_bytes = object.max_bytes ?? "0"; + return message; + }, +}; + +function createBaseValidatorParams(): ValidatorParams { + return { pub_key_types: [] }; +} + +export const ValidatorParams = { + encode(message: ValidatorParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pub_key_types) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.pub_key_types.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorParams { + return { + pub_key_types: Array.isArray(object?.pub_key_types) ? object.pub_key_types.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: ValidatorParams): unknown { + const obj: any = {}; + if (message.pub_key_types) { + obj.pub_key_types = message.pub_key_types.map((e) => e); + } else { + obj.pub_key_types = []; + } + return obj; + }, + + fromPartial, I>>(object: I): ValidatorParams { + const message = createBaseValidatorParams(); + message.pub_key_types = object.pub_key_types?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVersionParams(): VersionParams { + return { app_version: "0" }; +} + +export const VersionParams = { + encode(message: VersionParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.app_version !== "0") { + writer.uint32(8).uint64(message.app_version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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_version = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): VersionParams { + return { app_version: isSet(object.app_version) ? String(object.app_version) : "0" }; + }, + + toJSON(message: VersionParams): unknown { + const obj: any = {}; + message.app_version !== undefined && (obj.app_version = message.app_version); + return obj; + }, + + fromPartial, I>>(object: I): VersionParams { + const message = createBaseVersionParams(); + message.app_version = object.app_version ?? "0"; + return message; + }, +}; + +function createBaseHashedParams(): HashedParams { + return { block_max_bytes: "0", block_max_gas: "0" }; +} + +export const HashedParams = { + encode(message: HashedParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_max_bytes !== "0") { + writer.uint32(8).int64(message.block_max_bytes); + } + if (message.block_max_gas !== "0") { + writer.uint32(16).int64(message.block_max_gas); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.block_max_bytes = longToString(reader.int64() as Long); + break; + case 2: + message.block_max_gas = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): HashedParams { + return { + block_max_bytes: isSet(object.block_max_bytes) ? String(object.block_max_bytes) : "0", + block_max_gas: isSet(object.block_max_gas) ? String(object.block_max_gas) : "0", + }; + }, + + toJSON(message: HashedParams): unknown { + const obj: any = {}; + message.block_max_bytes !== undefined && (obj.block_max_bytes = message.block_max_bytes); + message.block_max_gas !== undefined && (obj.block_max_gas = message.block_max_gas); + return obj; + }, + + fromPartial, I>>(object: I): HashedParams { + const message = createBaseHashedParams(); + message.block_max_bytes = object.block_max_bytes ?? "0"; + message.block_max_gas = object.block_max_gas ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/types/types.ts b/common/types/src/lcd/tendermint/types/types.ts new file mode 100644 index 00000000..d094251a --- /dev/null +++ b/common/types/src/lcd/tendermint/types/types.ts @@ -0,0 +1,1484 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Proof } from "../crypto/proof"; +import { Consensus } from "../version/types"; +import { ValidatorSet } from "./validator"; + +export const protobufPackage = "tendermint.types"; + +/** BlockIdFlag indicates which BlcokID the signature is for */ +export enum BlockIDFlag { + BLOCK_ID_FLAG_UNKNOWN = "BLOCK_ID_FLAG_UNKNOWN", + BLOCK_ID_FLAG_ABSENT = "BLOCK_ID_FLAG_ABSENT", + BLOCK_ID_FLAG_COMMIT = "BLOCK_ID_FLAG_COMMIT", + BLOCK_ID_FLAG_NIL = "BLOCK_ID_FLAG_NIL", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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 function blockIDFlagToNumber(object: BlockIDFlag): number { + switch (object) { + case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN: + return 0; + case BlockIDFlag.BLOCK_ID_FLAG_ABSENT: + return 1; + case BlockIDFlag.BLOCK_ID_FLAG_COMMIT: + return 2; + case BlockIDFlag.BLOCK_ID_FLAG_NIL: + return 3; + case BlockIDFlag.UNRECOGNIZED: + default: + return -1; + } +} + +/** SignedMsgType is a type of signed message in the consensus. */ +export enum SignedMsgType { + SIGNED_MSG_TYPE_UNKNOWN = "SIGNED_MSG_TYPE_UNKNOWN", + /** SIGNED_MSG_TYPE_PREVOTE - Votes */ + SIGNED_MSG_TYPE_PREVOTE = "SIGNED_MSG_TYPE_PREVOTE", + SIGNED_MSG_TYPE_PRECOMMIT = "SIGNED_MSG_TYPE_PRECOMMIT", + /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ + SIGNED_MSG_TYPE_PROPOSAL = "SIGNED_MSG_TYPE_PROPOSAL", + UNRECOGNIZED = "UNRECOGNIZED", +} + +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"; + } +} + +export function signedMsgTypeToNumber(object: SignedMsgType): number { + switch (object) { + case SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN: + return 0; + case SignedMsgType.SIGNED_MSG_TYPE_PREVOTE: + return 1; + case SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT: + return 2; + case SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL: + return 32; + case SignedMsgType.UNRECOGNIZED: + default: + return -1; + } +} + +/** PartsetHeader */ +export interface PartSetHeader { + total: number; + hash: Uint8Array; +} + +export interface Part { + index: number; + bytes: Uint8Array; + proof?: Proof; +} + +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + part_set_header?: PartSetHeader; +} + +/** Header defines the structure of a Tendermint block header. */ +export interface Header { + /** basic block info */ + version?: Consensus; + chain_id: string; + height: string; + time?: Date; + /** prev block info */ + last_block_id?: BlockID; + /** hashes of block data */ + last_commit_hash: Uint8Array; + /** transactions */ + data_hash: Uint8Array; + /** hashes from the app output from the prev block */ + validators_hash: Uint8Array; + /** validators for the next block */ + next_validators_hash: Uint8Array; + /** consensus params for current block */ + consensus_hash: Uint8Array; + /** state after txs from the previous block */ + app_hash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + last_results_hash: Uint8Array; + /** consensus info */ + evidence_hash: Uint8Array; + /** original proposer of the block */ + proposer_address: Uint8Array; +} + +/** 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[]; +} + +/** + * Vote represents a prevote, precommit, or commit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: string; + round: number; + /** zero if vote is nil. */ + block_id?: BlockID; + timestamp?: Date; + validator_address: Uint8Array; + validator_index: number; + signature: Uint8Array; +} + +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: string; + round: number; + block_id?: BlockID; + signatures: CommitSig[]; +} + +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + block_id_flag: BlockIDFlag; + validator_address: Uint8Array; + timestamp?: Date; + signature: Uint8Array; +} + +export interface Proposal { + type: SignedMsgType; + height: string; + round: number; + pol_round: number; + block_id?: BlockID; + timestamp?: Date; + signature: Uint8Array; +} + +export interface SignedHeader { + header?: Header; + commit?: Commit; +} + +export interface LightBlock { + signed_header?: SignedHeader; + validator_set?: ValidatorSet; +} + +export interface BlockMeta { + block_id?: BlockID; + block_size: string; + header?: Header; + num_txs: string; +} + +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + root_hash: Uint8Array; + data: Uint8Array; + proof?: Proof; +} + +function createBasePartSetHeader(): PartSetHeader { + return { total: 0, hash: new Uint8Array() }; +} + +export const PartSetHeader = { + encode(message: PartSetHeader, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): PartSetHeader { + return { + total: isSet(object.total) ? Number(object.total) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + }; + }, + + toJSON(message: PartSetHeader): unknown { + const obj: any = {}; + message.total !== undefined && (obj.total = Math.round(message.total)); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): PartSetHeader { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(); + return message; + }, +}; + +function createBasePart(): Part { + return { index: 0, bytes: new Uint8Array(), proof: undefined }; +} + +export const Part = { + encode(message: Part, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): Part { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Part { + return { + index: isSet(object.index) ? Number(object.index) : 0, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: Part): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = Math.round(message.index)); + message.bytes !== undefined && + (obj.bytes = base64FromBytes(message.bytes !== undefined ? message.bytes : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseBlockID(): BlockID { + return { hash: new Uint8Array(), part_set_header: undefined }; +} + +export const BlockID = { + encode(message: BlockID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.part_set_header !== undefined) { + PartSetHeader.encode(message.part_set_header, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BlockID { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.part_set_header = PartSetHeader.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BlockID { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + part_set_header: isSet(object.part_set_header) ? PartSetHeader.fromJSON(object.part_set_header) : undefined, + }; + }, + + toJSON(message: BlockID): unknown { + const obj: any = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.part_set_header !== undefined && + (obj.part_set_header = message.part_set_header ? PartSetHeader.toJSON(message.part_set_header) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): BlockID { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(); + message.part_set_header = (object.part_set_header !== undefined && object.part_set_header !== null) + ? PartSetHeader.fromPartial(object.part_set_header) + : undefined; + return message; + }, +}; + +function createBaseHeader(): Header { + return { + version: undefined, + chain_id: "", + height: "0", + time: undefined, + last_block_id: undefined, + last_commit_hash: new Uint8Array(), + data_hash: new Uint8Array(), + validators_hash: new Uint8Array(), + next_validators_hash: new Uint8Array(), + consensus_hash: new Uint8Array(), + app_hash: new Uint8Array(), + last_results_hash: new Uint8Array(), + evidence_hash: new Uint8Array(), + proposer_address: new Uint8Array(), + }; +} + +export const Header = { + encode(message: Header, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); + } + if (message.chain_id !== "") { + writer.uint32(18).string(message.chain_id); + } + if (message.height !== "0") { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.last_block_id !== undefined) { + BlockID.encode(message.last_block_id, writer.uint32(42).fork()).ldelim(); + } + if (message.last_commit_hash.length !== 0) { + writer.uint32(50).bytes(message.last_commit_hash); + } + if (message.data_hash.length !== 0) { + writer.uint32(58).bytes(message.data_hash); + } + if (message.validators_hash.length !== 0) { + writer.uint32(66).bytes(message.validators_hash); + } + if (message.next_validators_hash.length !== 0) { + writer.uint32(74).bytes(message.next_validators_hash); + } + if (message.consensus_hash.length !== 0) { + writer.uint32(82).bytes(message.consensus_hash); + } + if (message.app_hash.length !== 0) { + writer.uint32(90).bytes(message.app_hash); + } + if (message.last_results_hash.length !== 0) { + writer.uint32(98).bytes(message.last_results_hash); + } + if (message.evidence_hash.length !== 0) { + writer.uint32(106).bytes(message.evidence_hash); + } + if (message.proposer_address.length !== 0) { + writer.uint32(114).bytes(message.proposer_address); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Header { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.chain_id = reader.string(); + break; + case 3: + message.height = longToString(reader.int64() as Long); + break; + case 4: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.last_block_id = BlockID.decode(reader, reader.uint32()); + break; + case 6: + message.last_commit_hash = reader.bytes(); + break; + case 7: + message.data_hash = reader.bytes(); + break; + case 8: + message.validators_hash = reader.bytes(); + break; + case 9: + message.next_validators_hash = reader.bytes(); + break; + case 10: + message.consensus_hash = reader.bytes(); + break; + case 11: + message.app_hash = reader.bytes(); + break; + case 12: + message.last_results_hash = reader.bytes(); + break; + case 13: + message.evidence_hash = reader.bytes(); + break; + case 14: + message.proposer_address = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chain_id: isSet(object.chain_id) ? String(object.chain_id) : "", + height: isSet(object.height) ? String(object.height) : "0", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + last_block_id: isSet(object.last_block_id) ? BlockID.fromJSON(object.last_block_id) : undefined, + last_commit_hash: isSet(object.last_commit_hash) ? bytesFromBase64(object.last_commit_hash) : new Uint8Array(), + data_hash: isSet(object.data_hash) ? bytesFromBase64(object.data_hash) : new Uint8Array(), + validators_hash: isSet(object.validators_hash) ? bytesFromBase64(object.validators_hash) : new Uint8Array(), + next_validators_hash: isSet(object.next_validators_hash) + ? bytesFromBase64(object.next_validators_hash) + : new Uint8Array(), + consensus_hash: isSet(object.consensus_hash) ? bytesFromBase64(object.consensus_hash) : new Uint8Array(), + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(), + last_results_hash: isSet(object.last_results_hash) ? bytesFromBase64(object.last_results_hash) : new Uint8Array(), + evidence_hash: isSet(object.evidence_hash) ? bytesFromBase64(object.evidence_hash) : new Uint8Array(), + proposer_address: isSet(object.proposer_address) ? bytesFromBase64(object.proposer_address) : new Uint8Array(), + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version ? Consensus.toJSON(message.version) : undefined); + message.chain_id !== undefined && (obj.chain_id = message.chain_id); + message.height !== undefined && (obj.height = message.height); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.last_block_id !== undefined && + (obj.last_block_id = message.last_block_id ? BlockID.toJSON(message.last_block_id) : undefined); + message.last_commit_hash !== undefined && + (obj.last_commit_hash = base64FromBytes( + message.last_commit_hash !== undefined ? message.last_commit_hash : new Uint8Array(), + )); + message.data_hash !== undefined && + (obj.data_hash = base64FromBytes(message.data_hash !== undefined ? message.data_hash : new Uint8Array())); + message.validators_hash !== undefined && + (obj.validators_hash = base64FromBytes( + message.validators_hash !== undefined ? message.validators_hash : new Uint8Array(), + )); + message.next_validators_hash !== undefined && + (obj.next_validators_hash = base64FromBytes( + message.next_validators_hash !== undefined ? message.next_validators_hash : new Uint8Array(), + )); + message.consensus_hash !== undefined && + (obj.consensus_hash = base64FromBytes( + message.consensus_hash !== undefined ? message.consensus_hash : new Uint8Array(), + )); + message.app_hash !== undefined && + (obj.app_hash = base64FromBytes(message.app_hash !== undefined ? message.app_hash : new Uint8Array())); + message.last_results_hash !== undefined && + (obj.last_results_hash = base64FromBytes( + message.last_results_hash !== undefined ? message.last_results_hash : new Uint8Array(), + )); + message.evidence_hash !== undefined && + (obj.evidence_hash = base64FromBytes( + message.evidence_hash !== undefined ? message.evidence_hash : new Uint8Array(), + )); + message.proposer_address !== undefined && + (obj.proposer_address = base64FromBytes( + message.proposer_address !== undefined ? message.proposer_address : new Uint8Array(), + )); + return obj; + }, + + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = (object.version !== undefined && object.version !== null) + ? Consensus.fromPartial(object.version) + : undefined; + message.chain_id = object.chain_id ?? ""; + message.height = object.height ?? "0"; + message.time = object.time ?? undefined; + message.last_block_id = (object.last_block_id !== undefined && object.last_block_id !== null) + ? BlockID.fromPartial(object.last_block_id) + : undefined; + message.last_commit_hash = object.last_commit_hash ?? new Uint8Array(); + message.data_hash = object.data_hash ?? new Uint8Array(); + message.validators_hash = object.validators_hash ?? new Uint8Array(); + message.next_validators_hash = object.next_validators_hash ?? new Uint8Array(); + message.consensus_hash = object.consensus_hash ?? new Uint8Array(); + message.app_hash = object.app_hash ?? new Uint8Array(); + message.last_results_hash = object.last_results_hash ?? new Uint8Array(); + message.evidence_hash = object.evidence_hash ?? new Uint8Array(); + message.proposer_address = object.proposer_address ?? new Uint8Array(); + return message; + }, +}; + +function createBaseData(): Data { + return { txs: [] }; +} + +export const Data = { + encode(message: Data, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Data { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): Data { + return { txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: Data): unknown { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.txs = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Data { + const message = createBaseData(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVote(): Vote { + return { + type: SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN, + height: "0", + round: 0, + block_id: undefined, + timestamp: undefined, + validator_address: new Uint8Array(), + validator_index: 0, + signature: new Uint8Array(), + }; +} + +export const Vote = { + encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN) { + writer.uint32(8).int32(signedMsgTypeToNumber(message.type)); + } + if (message.height !== "0") { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(34).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + if (message.validator_address.length !== 0) { + writer.uint32(50).bytes(message.validator_address); + } + if (message.validator_index !== 0) { + writer.uint32(56).int32(message.validator_index); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Vote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = signedMsgTypeFromJSON(reader.int32()); + break; + case 2: + message.height = longToString(reader.int64() as Long); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.block_id = BlockID.decode(reader, reader.uint32()); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.validator_address = reader.bytes(); + break; + case 7: + message.validator_index = reader.int32(); + break; + case 8: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Vote { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN, + height: isSet(object.height) ? String(object.height) : "0", + round: isSet(object.round) ? Number(object.round) : 0, + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + validator_address: isSet(object.validator_address) ? bytesFromBase64(object.validator_address) : new Uint8Array(), + validator_index: isSet(object.validator_index) ? Number(object.validator_index) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = message.height); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); + message.validator_address !== undefined && + (obj.validator_address = base64FromBytes( + message.validator_address !== undefined ? message.validator_address : new Uint8Array(), + )); + message.validator_index !== undefined && (obj.validator_index = Math.round(message.validator_index)); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.type = object.type ?? SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN; + message.height = object.height ?? "0"; + message.round = object.round ?? 0; + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validator_address = object.validator_address ?? new Uint8Array(); + message.validator_index = object.validator_index ?? 0; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; + +function createBaseCommit(): Commit { + return { height: "0", round: 0, block_id: undefined, signatures: [] }; +} + +export const Commit = { + encode(message: Commit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.signatures) { + CommitSig.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Commit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.int64() as Long); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.block_id = 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; + }, + + fromJSON(object: any): Commit { + return { + height: isSet(object.height) ? String(object.height) : "0", + round: isSet(object.round) ? Number(object.round) : 0, + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => CommitSig.fromJSON(e)) : [], + }; + }, + + toJSON(message: Commit): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => e ? CommitSig.toJSON(e) : undefined); + } else { + obj.signatures = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Commit { + const message = createBaseCommit(); + message.height = object.height ?? "0"; + message.round = object.round ?? 0; + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.signatures = object.signatures?.map((e) => CommitSig.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCommitSig(): CommitSig { + return { + block_id_flag: BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN, + validator_address: new Uint8Array(), + timestamp: undefined, + signature: new Uint8Array(), + }; +} + +export const CommitSig = { + encode(message: CommitSig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_id_flag !== BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN) { + writer.uint32(8).int32(blockIDFlagToNumber(message.block_id_flag)); + } + if (message.validator_address.length !== 0) { + writer.uint32(18).bytes(message.validator_address); + } + 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: _m0.Reader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.block_id_flag = blockIDFlagFromJSON(reader.int32()); + break; + case 2: + message.validator_address = 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; + }, + + fromJSON(object: any): CommitSig { + return { + block_id_flag: isSet(object.block_id_flag) + ? blockIDFlagFromJSON(object.block_id_flag) + : BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN, + validator_address: isSet(object.validator_address) ? bytesFromBase64(object.validator_address) : new Uint8Array(), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + }; + }, + + toJSON(message: CommitSig): unknown { + const obj: any = {}; + message.block_id_flag !== undefined && (obj.block_id_flag = blockIDFlagToJSON(message.block_id_flag)); + message.validator_address !== undefined && + (obj.validator_address = base64FromBytes( + message.validator_address !== undefined ? message.validator_address : new Uint8Array(), + )); + message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): CommitSig { + const message = createBaseCommitSig(); + message.block_id_flag = object.block_id_flag ?? BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN; + message.validator_address = object.validator_address ?? new Uint8Array(); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; + +function createBaseProposal(): Proposal { + return { + type: SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN, + height: "0", + round: 0, + pol_round: 0, + block_id: undefined, + timestamp: undefined, + signature: new Uint8Array(), + }; +} + +export const Proposal = { + encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN) { + writer.uint32(8).int32(signedMsgTypeToNumber(message.type)); + } + if (message.height !== "0") { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.pol_round !== 0) { + writer.uint32(32).int32(message.pol_round); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, 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: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = signedMsgTypeFromJSON(reader.int32()); + break; + case 2: + message.height = longToString(reader.int64() as Long); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.pol_round = reader.int32(); + break; + case 5: + message.block_id = 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; + }, + + fromJSON(object: any): Proposal { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN, + height: isSet(object.height) ? String(object.height) : "0", + round: isSet(object.round) ? Number(object.round) : 0, + pol_round: isSet(object.pol_round) ? Number(object.pol_round) : 0, + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = message.height); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.pol_round !== undefined && (obj.pol_round = Math.round(message.pol_round)); + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.type = object.type ?? SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN; + message.height = object.height ?? "0"; + message.round = object.round ?? 0; + message.pol_round = object.pol_round ?? 0; + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; + +function createBaseSignedHeader(): SignedHeader { + return { header: undefined, commit: undefined }; +} + +export const SignedHeader = { + encode(message: SignedHeader, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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: _m0.Reader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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; + }, + + fromJSON(object: any): SignedHeader { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + commit: isSet(object.commit) ? Commit.fromJSON(object.commit) : undefined, + }; + }, + + toJSON(message: SignedHeader): unknown { + const obj: any = {}; + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.commit !== undefined && (obj.commit = message.commit ? Commit.toJSON(message.commit) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): 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; + }, +}; + +function createBaseLightBlock(): LightBlock { + return { signed_header: undefined, validator_set: undefined }; +} + +export const LightBlock = { + encode(message: LightBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.signed_header !== undefined) { + SignedHeader.encode(message.signed_header, writer.uint32(10).fork()).ldelim(); + } + if (message.validator_set !== undefined) { + ValidatorSet.encode(message.validator_set, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.signed_header = SignedHeader.decode(reader, reader.uint32()); + break; + case 2: + message.validator_set = ValidatorSet.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LightBlock { + return { + signed_header: isSet(object.signed_header) ? SignedHeader.fromJSON(object.signed_header) : undefined, + validator_set: isSet(object.validator_set) ? ValidatorSet.fromJSON(object.validator_set) : undefined, + }; + }, + + toJSON(message: LightBlock): unknown { + const obj: any = {}; + message.signed_header !== undefined && + (obj.signed_header = message.signed_header ? SignedHeader.toJSON(message.signed_header) : undefined); + message.validator_set !== undefined && + (obj.validator_set = message.validator_set ? ValidatorSet.toJSON(message.validator_set) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): LightBlock { + const message = createBaseLightBlock(); + message.signed_header = (object.signed_header !== undefined && object.signed_header !== null) + ? SignedHeader.fromPartial(object.signed_header) + : undefined; + message.validator_set = (object.validator_set !== undefined && object.validator_set !== null) + ? ValidatorSet.fromPartial(object.validator_set) + : undefined; + return message; + }, +}; + +function createBaseBlockMeta(): BlockMeta { + return { block_id: undefined, block_size: "0", header: undefined, num_txs: "0" }; +} + +export const BlockMeta = { + encode(message: BlockMeta, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(10).fork()).ldelim(); + } + if (message.block_size !== "0") { + writer.uint32(16).int64(message.block_size); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).ldelim(); + } + if (message.num_txs !== "0") { + writer.uint32(32).int64(message.num_txs); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.block_id = BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.block_size = longToString(reader.int64() as Long); + break; + case 3: + message.header = Header.decode(reader, reader.uint32()); + break; + case 4: + message.num_txs = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BlockMeta { + return { + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block_size: isSet(object.block_size) ? String(object.block_size) : "0", + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + num_txs: isSet(object.num_txs) ? String(object.num_txs) : "0", + }; + }, + + toJSON(message: BlockMeta): unknown { + const obj: any = {}; + message.block_id !== undefined && (obj.block_id = message.block_id ? BlockID.toJSON(message.block_id) : undefined); + message.block_size !== undefined && (obj.block_size = message.block_size); + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.num_txs !== undefined && (obj.num_txs = message.num_txs); + return obj; + }, + + fromPartial, I>>(object: I): BlockMeta { + const message = createBaseBlockMeta(); + message.block_id = (object.block_id !== undefined && object.block_id !== null) + ? BlockID.fromPartial(object.block_id) + : undefined; + message.block_size = object.block_size ?? "0"; + message.header = (object.header !== undefined && object.header !== null) + ? Header.fromPartial(object.header) + : undefined; + message.num_txs = object.num_txs ?? "0"; + return message; + }, +}; + +function createBaseTxProof(): TxProof { + return { root_hash: new Uint8Array(), data: new Uint8Array(), proof: undefined }; +} + +export const TxProof = { + encode(message: TxProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.root_hash.length !== 0) { + writer.uint32(10).bytes(message.root_hash); + } + 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: _m0.Reader | Uint8Array, length?: number): TxProof { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.root_hash = 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; + }, + + fromJSON(object: any): TxProof { + return { + root_hash: isSet(object.root_hash) ? bytesFromBase64(object.root_hash) : new Uint8Array(), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: TxProof): unknown { + const obj: any = {}; + message.root_hash !== undefined && + (obj.root_hash = base64FromBytes(message.root_hash !== undefined ? message.root_hash : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): TxProof { + const message = createBaseTxProof(); + message.root_hash = object.root_hash ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000).toString(); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1_000; + millis += t.nanos / 1_000_000; + return new Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/types/validator.ts b/common/types/src/lcd/tendermint/types/validator.ts new file mode 100644 index 00000000..41b2d2dc --- /dev/null +++ b/common/types/src/lcd/tendermint/types/validator.ts @@ -0,0 +1,305 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PublicKey } from "../crypto/keys"; + +export const protobufPackage = "tendermint.types"; + +export interface ValidatorSet { + validators: Validator[]; + proposer?: Validator; + total_voting_power: string; +} + +export interface Validator { + address: Uint8Array; + pub_key?: PublicKey; + voting_power: string; + proposer_priority: string; +} + +export interface SimpleValidator { + pub_key?: PublicKey; + voting_power: string; +} + +function createBaseValidatorSet(): ValidatorSet { + return { validators: [], proposer: undefined, total_voting_power: "0" }; +} + +export const ValidatorSet = { + encode(message: ValidatorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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.total_voting_power !== "0") { + writer.uint32(24).int64(message.total_voting_power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.total_voting_power = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + proposer: isSet(object.proposer) ? Validator.fromJSON(object.proposer) : undefined, + total_voting_power: isSet(object.total_voting_power) ? String(object.total_voting_power) : "0", + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } else { + obj.validators = []; + } + message.proposer !== undefined && + (obj.proposer = message.proposer ? Validator.toJSON(message.proposer) : undefined); + message.total_voting_power !== undefined && (obj.total_voting_power = message.total_voting_power); + return obj; + }, + + fromPartial, I>>(object: I): 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.total_voting_power = object.total_voting_power ?? "0"; + return message; + }, +}; + +function createBaseValidator(): Validator { + return { address: new Uint8Array(), pub_key: undefined, voting_power: "0", proposer_priority: "0" }; +} + +export const Validator = { + encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pub_key !== undefined) { + PublicKey.encode(message.pub_key, writer.uint32(18).fork()).ldelim(); + } + if (message.voting_power !== "0") { + writer.uint32(24).int64(message.voting_power); + } + if (message.proposer_priority !== "0") { + writer.uint32(32).int64(message.proposer_priority); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Validator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.pub_key = PublicKey.decode(reader, reader.uint32()); + break; + case 3: + message.voting_power = longToString(reader.int64() as Long); + break; + case 4: + message.proposer_priority = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(), + pub_key: isSet(object.pub_key) ? PublicKey.fromJSON(object.pub_key) : undefined, + voting_power: isSet(object.voting_power) ? String(object.voting_power) : "0", + proposer_priority: isSet(object.proposer_priority) ? String(object.proposer_priority) : "0", + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + message.address !== undefined && + (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? PublicKey.toJSON(message.pub_key) : undefined); + message.voting_power !== undefined && (obj.voting_power = message.voting_power); + message.proposer_priority !== undefined && (obj.proposer_priority = message.proposer_priority); + return obj; + }, + + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? PublicKey.fromPartial(object.pub_key) + : undefined; + message.voting_power = object.voting_power ?? "0"; + message.proposer_priority = object.proposer_priority ?? "0"; + return message; + }, +}; + +function createBaseSimpleValidator(): SimpleValidator { + return { pub_key: undefined, voting_power: "0" }; +} + +export const SimpleValidator = { + encode(message: SimpleValidator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pub_key !== undefined) { + PublicKey.encode(message.pub_key, writer.uint32(10).fork()).ldelim(); + } + if (message.voting_power !== "0") { + writer.uint32(16).int64(message.voting_power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.pub_key = PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.voting_power = longToString(reader.int64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SimpleValidator { + return { + pub_key: isSet(object.pub_key) ? PublicKey.fromJSON(object.pub_key) : undefined, + voting_power: isSet(object.voting_power) ? String(object.voting_power) : "0", + }; + }, + + toJSON(message: SimpleValidator): unknown { + const obj: any = {}; + message.pub_key !== undefined && (obj.pub_key = message.pub_key ? PublicKey.toJSON(message.pub_key) : undefined); + message.voting_power !== undefined && (obj.voting_power = message.voting_power); + return obj; + }, + + fromPartial, I>>(object: I): SimpleValidator { + const message = createBaseSimpleValidator(); + message.pub_key = (object.pub_key !== undefined && object.pub_key !== null) + ? PublicKey.fromPartial(object.pub_key) + : undefined; + message.voting_power = object.voting_power ?? "0"; + return message; + }, +}; + +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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/src/lcd/tendermint/version/types.ts b/common/types/src/lcd/tendermint/version/types.ts new file mode 100644 index 00000000..3eda3af6 --- /dev/null +++ b/common/types/src/lcd/tendermint/version/types.ts @@ -0,0 +1,165 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "tendermint.version"; + +/** + * 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: string; + software: string; +} + +/** + * 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: string; + app: string; +} + +function createBaseApp(): App { + return { protocol: "0", software: "" }; +} + +export const App = { + encode(message: App, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.protocol !== "0") { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): App { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.software = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): App { + return { + protocol: isSet(object.protocol) ? String(object.protocol) : "0", + software: isSet(object.software) ? String(object.software) : "", + }; + }, + + toJSON(message: App): unknown { + const obj: any = {}; + message.protocol !== undefined && (obj.protocol = message.protocol); + message.software !== undefined && (obj.software = message.software); + return obj; + }, + + fromPartial, I>>(object: I): App { + const message = createBaseApp(); + message.protocol = object.protocol ?? "0"; + message.software = object.software ?? ""; + return message; + }, +}; + +function createBaseConsensus(): Consensus { + return { block: "0", app: "0" }; +} + +export const Consensus = { + encode(message: Consensus, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.block !== "0") { + writer.uint32(8).uint64(message.block); + } + if (message.app !== "0") { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Consensus { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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 = longToString(reader.uint64() as Long); + break; + case 2: + message.app = longToString(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Consensus { + return { + block: isSet(object.block) ? String(object.block) : "0", + app: isSet(object.app) ? String(object.app) : "0", + }; + }, + + toJSON(message: Consensus): unknown { + const obj: any = {}; + message.block !== undefined && (obj.block = message.block); + message.app !== undefined && (obj.app = message.app); + return obj; + }, + + fromPartial, I>>(object: I): Consensus { + const message = createBaseConsensus(); + message.block = object.block ?? "0"; + message.app = object.app ?? "0"; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | 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 } & { [K in Exclude>]: never }; + +function longToString(long: Long) { + return long.toString(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/common/types/tsconfig.json b/common/types/tsconfig.json new file mode 100644 index 00000000..21a16488 --- /dev/null +++ b/common/types/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "rootDir": "src", + "declaration": true, + "esModuleInterop": true, + "outDir": "dist", + "strict": true + }, + "exclude": [ + "node_modules" + ], + "include": ["src/**/*"] +} diff --git a/integrations/bitcoin/.gitignore b/integrations/bitcoin/.gitignore new file mode 100644 index 00000000..31cb8bcb --- /dev/null +++ b/integrations/bitcoin/.gitignore @@ -0,0 +1,667 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,macos,windows,node,webstorm+all + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +# dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache +.stylelintcache + +# SvelteKit build / generate output +.svelte-kit + +### WebStorm+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### WebStorm+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Nuget personal access tokens and Credentials +# nuget.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs + +# JetBrains Rider +*.sln.iml + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all \ No newline at end of file diff --git a/integrations/bitcoin/LICENSE b/integrations/bitcoin/LICENSE new file mode 100644 index 00000000..21e34717 --- /dev/null +++ b/integrations/bitcoin/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2022 BCP Innovations UG (haftungsbeschränkt) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/integrations/bitcoin/README.md b/integrations/bitcoin/README.md new file mode 100644 index 00000000..0aa17e86 --- /dev/null +++ b/integrations/bitcoin/README.md @@ -0,0 +1 @@ +# @kyve/bitcoin diff --git a/integrations/bitcoin/package.json b/integrations/bitcoin/package.json new file mode 100644 index 00000000..3275560b --- /dev/null +++ b/integrations/bitcoin/package.json @@ -0,0 +1,38 @@ +{ + "name": "@kyvejs/bitcoin", + "version": "1.0.0-beta.0", + "license": "MIT", + "scripts": { + "build": "rimraf dist && tsc", + "build:binaries": "yarn build && rimraf out && pkg --no-bytecode --public-packages '*' --output out/kyve package.json && node ../../common/protocol/dist/src/scripts/checksum.js", + "start": "node ./dist/src/index.js", + "format": "prettier --write .", + "lint": "eslint . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx", + "lint:fix": "eslint --fix . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx" + }, + "bin": "./dist/src/index.js", + "pkg": { + "scripts": "./dist/src/index.js", + "assets": [ + "../../node_modules/classic-level/**/*" + ], + "targets": [ + "latest-linux-x64", + "latest-linux-arm64", + "latest-macos-x64" + ], + "outputPath": "out" + }, + "dependencies": { + "@kyvejs/protocol": "1.0.0-beta.0", + "axios": "^0.26.1", + "nanoid": "^3.3.3" + }, + "devDependencies": { + "pkg": "^5.8.0", + "prettier": "^2.6.2", + "rimraf": "^3.0.2", + "typescript": "^4.6.3", + "webhook-discord": "^3.7.8" + } +} diff --git a/integrations/bitcoin/src/index.ts b/integrations/bitcoin/src/index.ts new file mode 100644 index 00000000..e67eaf40 --- /dev/null +++ b/integrations/bitcoin/src/index.ts @@ -0,0 +1,7 @@ +import { Validator } from "@kyvejs/protocol"; + +import Bitcoin from "./runtime"; + +const runtime = new Bitcoin(); + +new Validator(runtime).bootstrap(); diff --git a/integrations/bitcoin/src/runtime.ts b/integrations/bitcoin/src/runtime.ts new file mode 100644 index 00000000..f78e7468 --- /dev/null +++ b/integrations/bitcoin/src/runtime.ts @@ -0,0 +1,78 @@ +import { DataItem, IRuntime, Validator, sha256 } from "@kyvejs/protocol"; + +import { name, version } from "../package.json"; +import { fetchBlock, fetchBlockHash } from "./utils"; + +export default class Bitcoin implements IRuntime { + public name = name; + public version = version; + + async getDataItem( + v: Validator, + source: string, + key: string + ): Promise { + // get auth headers for proxy endpoints + const headers = await v.getProxyAuth(); + + const hash = await fetchBlockHash(source, +key, headers); + const block = await fetchBlock(source, hash, headers); + + return { key, value: block }; + } + + async prevalidateDataItem(_: Validator, __: DataItem): Promise { + // TODO: validate if PoW is valid, return valid for now + return true; + } + + async transformDataItem(_: Validator, item: DataItem): Promise { + // don't transform data item + return item; + } + + async validateDataItem( + _: Validator, + proposedDataItem: DataItem, + validationDataItem: DataItem + ): Promise { + const proposedDataItemHash = sha256( + Buffer.from(JSON.stringify(proposedDataItem)) + ); + const validationDataItemHash = sha256( + Buffer.from(JSON.stringify(validationDataItem)) + ); + + return proposedDataItemHash === validationDataItemHash; + } + + public async summarizeDataBundle( + _: Validator, + bundle: DataItem[] + ): Promise { + return bundle.at(-1)?.value?.hash ?? ""; + } + + public async nextKey(_: Validator, key: string): Promise { + return (parseInt(key) + 1).toString(); + } + + private async generateCoinbaseCloudHeaders(v: Validator): Promise { + // requestSignature for coinbase cloud + const address = v.client.account.address; + const timestamp = new Date().valueOf().toString(); + const poolId = v.pool.id; + + const { signature, pub_key } = await v.client.signString( + `${address}//${poolId}//${timestamp}` + ); + + return { + "Content-Type": "application/json", + Signature: signature, + "Public-Key": pub_key.value, + "Pool-ID": poolId, + Timestamp: timestamp, + }; + } +} diff --git a/integrations/bitcoin/src/types.ts b/integrations/bitcoin/src/types.ts new file mode 100644 index 00000000..0c02ab3b --- /dev/null +++ b/integrations/bitcoin/src/types.ts @@ -0,0 +1,12 @@ +export interface Response { + result: T; + error: any; + id: string; +} + +export interface Signature { + signature: string; + pubKey: string; + poolId: string; + timestamp: string; +} diff --git a/integrations/bitcoin/src/utils.ts b/integrations/bitcoin/src/utils.ts new file mode 100644 index 00000000..225e2d10 --- /dev/null +++ b/integrations/bitcoin/src/utils.ts @@ -0,0 +1,44 @@ +import axios from "axios"; +import { nanoid } from "nanoid"; + +import { Response } from "./types"; + +export async function fetchBlock( + endpoint: string, + hash: string, + headers: any +): Promise { + const block = await call(endpoint, "getblock", [hash, 2], headers); + + // Remove confirmations to maintain determinism. + delete block.confirmations; + + return block; +} + +export async function fetchBlockHash( + endpoint: string, + height: number, + headers: any +): Promise { + return await call(endpoint, "getblockhash", [height], headers); +} + +async function call( + endpoint: string, + method: string, + params: any[], + headers: any +): Promise { + const { data } = await axios.get>(endpoint, { + data: JSON.stringify({ + jsonrpc: "1.0", + id: nanoid(), + method, + params, + }), + headers, + }); + + return data.result; +} diff --git a/integrations/bitcoin/tsconfig.json b/integrations/bitcoin/tsconfig.json new file mode 100644 index 00000000..25389c96 --- /dev/null +++ b/integrations/bitcoin/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es2019", + "strict": true, + "outDir": "dist", + "esModuleInterop": true, + "resolveJsonModule": true + }, + "files": ["src/index.ts"] +} diff --git a/integrations/celo/.gitignore b/integrations/celo/.gitignore new file mode 100644 index 00000000..31cb8bcb --- /dev/null +++ b/integrations/celo/.gitignore @@ -0,0 +1,667 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,macos,windows,node,webstorm+all + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +# dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache +.stylelintcache + +# SvelteKit build / generate output +.svelte-kit + +### WebStorm+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### WebStorm+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Nuget personal access tokens and Credentials +# nuget.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs + +# JetBrains Rider +*.sln.iml + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all \ No newline at end of file diff --git a/integrations/celo/LICENSE b/integrations/celo/LICENSE new file mode 100644 index 00000000..21e34717 --- /dev/null +++ b/integrations/celo/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2022 BCP Innovations UG (haftungsbeschränkt) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/integrations/celo/README.md b/integrations/celo/README.md new file mode 100644 index 00000000..59f8083e --- /dev/null +++ b/integrations/celo/README.md @@ -0,0 +1 @@ +# @kyve/celo diff --git a/integrations/celo/package.json b/integrations/celo/package.json new file mode 100644 index 00000000..3885b2e3 --- /dev/null +++ b/integrations/celo/package.json @@ -0,0 +1,40 @@ +{ + "name": "@kyvejs/celo", + "version": "1.0.0-beta.0", + "license": "MIT", + "scripts": { + "build": "rimraf dist && tsc", + "build:binaries": "yarn build && rimraf out && pkg --no-bytecode --public-packages '*' --output out/kyve package.json && node ../../common/protocol/dist/src/scripts/checksum.js", + "start": "node ./dist/src/index.js", + "format": "prettier --write .", + "lint": "eslint . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx", + "lint:fix": "eslint --fix . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx" + }, + "bin": "./dist/src/index.js", + "pkg": { + "scripts": "./dist/src/index.js", + "assets": [ + "../../node_modules/classic-level/**/*" + ], + "targets": [ + "latest-linux-x64", + "latest-linux-arm64", + "latest-macos-x64" + ], + "outputPath": "out" + }, + "prettier": { + "singleQuote": true + }, + "dependencies": { + "@celo-tools/celo-ethers-wrapper": "^0.3.0", + "@kyvejs/protocol": "1.0.0-beta.0" + }, + "devDependencies": { + "ethers": "^5.6.9", + "pkg": "^5.8.0", + "prettier": "^2.7.1", + "rimraf": "^3.0.2", + "typescript": "^4.7.4" + } +} diff --git a/integrations/celo/src/index.ts b/integrations/celo/src/index.ts new file mode 100644 index 00000000..77b5572a --- /dev/null +++ b/integrations/celo/src/index.ts @@ -0,0 +1,7 @@ +import { Validator } from '@kyvejs/protocol'; + +import Celo from './runtime'; + +const runtime = new Celo(); + +new Validator(runtime).bootstrap(); diff --git a/integrations/celo/src/runtime.ts b/integrations/celo/src/runtime.ts new file mode 100644 index 00000000..89416b44 --- /dev/null +++ b/integrations/celo/src/runtime.ts @@ -0,0 +1,57 @@ +import { DataItem, IRuntime, Validator, sha256 } from '@kyvejs/protocol'; + +import { name, version } from '../package.json'; +import { fetchBlock } from './utils'; + +export default class Celo implements IRuntime { + public name = name; + public version = version; + + async getDataItem( + v: Validator, + source: string, + key: string + ): Promise { + // get auth headers for proxy endpoints + const headers = await v.getProxyAuth(); + + const block = await fetchBlock(source, +key, headers); + + if (!block) throw new Error(); + + return { key, value: block }; + } + + async prevalidateDataItem(_: Validator, __: DataItem): Promise { + // TODO: return valid for now + return true; + } + + async transformDataItem(_: Validator, item: DataItem): Promise { + // don't transform data item + return item; + } + + async validateDataItem( + _: Validator, + proposedDataItem: DataItem, + validationDataItem: DataItem + ): Promise { + const proposedDataItemHash = sha256( + Buffer.from(JSON.stringify(proposedDataItem)) + ); + const validationDataItemHash = sha256( + Buffer.from(JSON.stringify(validationDataItem)) + ); + + return proposedDataItemHash === validationDataItemHash; + } + + async summarizeDataBundle(_: Validator, bundle: DataItem[]): Promise { + return bundle.at(-1)?.value?.hash ?? ''; + } + + async nextKey(_: Validator, key: string): Promise { + return (parseInt(key) + 1).toString(); + } +} diff --git a/integrations/celo/src/utils.ts b/integrations/celo/src/utils.ts new file mode 100644 index 00000000..66c8844a --- /dev/null +++ b/integrations/celo/src/utils.ts @@ -0,0 +1,26 @@ +import { StaticCeloProvider } from '@celo-tools/celo-ethers-wrapper'; +import { providers } from 'ethers'; + +export async function fetchBlock( + endpoint: string, + height: number, + headers: any +): Promise { + const provider = new StaticCeloProvider({ url: endpoint, headers }); + const block = await provider.getBlockWithTransactions(height); + + // The block is always defined, unless the height is out of range. + if (block) { + // Delete the number of confirmations from a transaction to maintain determinism. + block.transactions.forEach( + (tx: Partial) => delete tx.confirmations + ); + + // TODO: Figure out why `extraData` varies for some blocks. + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + delete block.extraData; + } + + return block; +} diff --git a/integrations/celo/tsconfig.json b/integrations/celo/tsconfig.json new file mode 100644 index 00000000..25389c96 --- /dev/null +++ b/integrations/celo/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es2019", + "strict": true, + "outDir": "dist", + "esModuleInterop": true, + "resolveJsonModule": true + }, + "files": ["src/index.ts"] +} diff --git a/integrations/cosmos/.gitignore b/integrations/cosmos/.gitignore new file mode 100644 index 00000000..31cb8bcb --- /dev/null +++ b/integrations/cosmos/.gitignore @@ -0,0 +1,667 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,macos,windows,node,webstorm+all + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +# dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache +.stylelintcache + +# SvelteKit build / generate output +.svelte-kit + +### WebStorm+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### WebStorm+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Nuget personal access tokens and Credentials +# nuget.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs + +# JetBrains Rider +*.sln.iml + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all \ No newline at end of file diff --git a/integrations/cosmos/LICENSE b/integrations/cosmos/LICENSE new file mode 100644 index 00000000..21e34717 --- /dev/null +++ b/integrations/cosmos/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2022 BCP Innovations UG (haftungsbeschränkt) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/integrations/cosmos/README.md b/integrations/cosmos/README.md new file mode 100644 index 00000000..4cfe1d5c --- /dev/null +++ b/integrations/cosmos/README.md @@ -0,0 +1 @@ +# @kyve/cosmos diff --git a/integrations/cosmos/package.json b/integrations/cosmos/package.json new file mode 100644 index 00000000..ee8f5826 --- /dev/null +++ b/integrations/cosmos/package.json @@ -0,0 +1,34 @@ +{ + "name": "@kyvejs/cosmos", + "version": "1.0.0-beta", + "license": "MIT", + "scripts": { + "build": "rimraf dist && tsc", + "build:binaries": "yarn build && rimraf out && pkg --no-bytecode --public-packages '*' --output out/kyve package.json && node ../../common/protocol/dist/src/scripts/checksum.js", + "start": "node ./dist/src/index.js", + "format": "prettier --write ." + }, + "bin": "./dist/src/index.js", + "pkg": { + "scripts": "./dist/src/index.js", + "targets": [ + "latest-linux-x64", + "latest-linux-arm64", + "latest-macos-x64" + ], + "outputPath": "out" + }, + "prettier": { + "singleQuote": true + }, + "dependencies": { + "@kyvejs/protocol": "1.0.0-beta.0", + "axios": "^0.27.2" + }, + "devDependencies": { + "pkg": "^5.8.0", + "prettier": "^2.7.1", + "rimraf": "^3.0.2", + "typescript": "^4.7.4" + } +} diff --git a/integrations/cosmos/src/index.ts b/integrations/cosmos/src/index.ts new file mode 100644 index 00000000..d6a7f708 --- /dev/null +++ b/integrations/cosmos/src/index.ts @@ -0,0 +1,6 @@ +import { Validator } from '@kyvejs/protocol'; +import Cosmos from './runtime'; + +const runtime = new Cosmos(); + +new Validator(runtime).bootstrap(); diff --git a/integrations/cosmos/src/runtime.ts b/integrations/cosmos/src/runtime.ts new file mode 100644 index 00000000..5b757908 --- /dev/null +++ b/integrations/cosmos/src/runtime.ts @@ -0,0 +1,59 @@ +import { DataItem, IRuntime, Validator, sha256 } from '@kyvejs/protocol'; +import axios from 'axios'; +import { name, version } from '../package.json'; + +export default class Cosmos implements IRuntime { + public name = name; + public version = version; + + async getDataItem( + v: Validator, + source: string, + key: string + ): Promise { + // get auth headers for proxy endpoints + const headers = await v.getProxyAuth(); + + const { data } = await axios.get( + `${source}/cosmos/base/tendermint/v1beta1/blocks/${key}`, + { + headers, + } + ); + + return { key, value: data }; + } + + async prevalidateDataItem(_: Validator, __: DataItem): Promise { + // TODO: return valid for now + return true; + } + + async transformDataItem(_: Validator, item: DataItem): Promise { + // don't transform data item + return item; + } + + async validateDataItem( + _: Validator, + proposedDataItem: DataItem, + validationDataItem: DataItem + ): Promise { + const proposedDataItemHash = sha256( + Buffer.from(JSON.stringify(proposedDataItem)) + ); + const validationDataItemHash = sha256( + Buffer.from(JSON.stringify(validationDataItem)) + ); + + return proposedDataItemHash === validationDataItemHash; + } + + async summarizeDataBundle(_: Validator, bundle: DataItem[]): Promise { + return bundle.at(-1)?.value?.header?.app_hash ?? ''; + } + + async nextKey(_: Validator, key: string): Promise { + return (parseInt(key) + 1).toString(); + } +} diff --git a/integrations/cosmos/src/types.ts b/integrations/cosmos/src/types.ts new file mode 100644 index 00000000..941960ca --- /dev/null +++ b/integrations/cosmos/src/types.ts @@ -0,0 +1,6 @@ +export interface Signature { + signature: string; + pubKey: string; + poolId: string; + timestamp: string; +} diff --git a/integrations/cosmos/tsconfig.json b/integrations/cosmos/tsconfig.json new file mode 100644 index 00000000..25389c96 --- /dev/null +++ b/integrations/cosmos/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es2019", + "strict": true, + "outDir": "dist", + "esModuleInterop": true, + "resolveJsonModule": true + }, + "files": ["src/index.ts"] +} diff --git a/integrations/evm/.gitignore b/integrations/evm/.gitignore new file mode 100644 index 00000000..31cb8bcb --- /dev/null +++ b/integrations/evm/.gitignore @@ -0,0 +1,667 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,macos,windows,node,webstorm+all + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +# dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache +.stylelintcache + +# SvelteKit build / generate output +.svelte-kit + +### WebStorm+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### WebStorm+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Nuget personal access tokens and Credentials +# nuget.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs + +# JetBrains Rider +*.sln.iml + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all \ No newline at end of file diff --git a/integrations/evm/LICENSE b/integrations/evm/LICENSE new file mode 100644 index 00000000..21e34717 --- /dev/null +++ b/integrations/evm/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2022 BCP Innovations UG (haftungsbeschränkt) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/integrations/evm/README.md b/integrations/evm/README.md new file mode 100644 index 00000000..c39feca5 --- /dev/null +++ b/integrations/evm/README.md @@ -0,0 +1 @@ +# @kyve/evm diff --git a/integrations/evm/package.json b/integrations/evm/package.json new file mode 100644 index 00000000..47d9ac60 --- /dev/null +++ b/integrations/evm/package.json @@ -0,0 +1,40 @@ +{ + "name": "@kyvejs/evm", + "version": "1.0.0-beta.0", + "license": "MIT", + "scripts": { + "build": "rimraf dist && tsc", + "build:binaries": "yarn build && rimraf out && pkg --no-bytecode --public-packages '*' --output out/kyve package.json && node ../../common/protocol/dist/src/scripts/checksum.js", + "start": "node ./dist/src/index.js", + "format": "prettier --write .", + "lint": "eslint . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx", + "lint:fix": "eslint --fix . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx" + }, + "bin": "./dist/src/index.js", + "pkg": { + "scripts": "./dist/src/index.js", + "assets": [ + "../../node_modules/classic-level/**/*" + ], + "targets": [ + "latest-linux-x64", + "latest-linux-arm64", + "latest-macos-x64" + ], + "outputPath": "out" + }, + "prettier": { + "singleQuote": true + }, + "dependencies": { + "@kyvejs/protocol": "1.0.0-beta.0", + "ethers": "^5.6.5" + }, + "devDependencies": { + "pkg": "^5.8.0", + "prettier": "^2.6.2", + "rimraf": "^3.0.2", + "typescript": "^4.6.4", + "webhook-discord": "^3.7.8" + } +} diff --git a/integrations/evm/src/index.ts b/integrations/evm/src/index.ts new file mode 100644 index 00000000..b7821cea --- /dev/null +++ b/integrations/evm/src/index.ts @@ -0,0 +1,7 @@ +import { Validator } from '@kyvejs/protocol'; + +import Evm from './runtime'; + +const runtime = new Evm(); + +new Validator(runtime).bootstrap(); diff --git a/integrations/evm/src/runtime.ts b/integrations/evm/src/runtime.ts new file mode 100644 index 00000000..2d594a0d --- /dev/null +++ b/integrations/evm/src/runtime.ts @@ -0,0 +1,85 @@ +import { DataItem, IRuntime, Validator, sha256 } from '@kyvejs/protocol'; +import { providers } from 'ethers'; + +import { name, version } from '../package.json'; + +export default class Evm implements IRuntime { + public name = name; + public version = version; + + async getDataItem( + v: Validator, + source: string, + key: string + ): Promise { + // set network settings if available + let network; + + if (v.poolConfig.chainId && v.poolConfig.chainName) { + network = { + chainId: v.poolConfig.chainId, + name: v.poolConfig.chainName, + }; + } + + // get auth headers for proxy endpoints + const headers = await v.getProxyAuth(); + + // setup web3 provider + const provider = new providers.StaticJsonRpcProvider( + { + url: source, + headers, + }, + network + ); + + // fetch data item + const value = await provider.getBlockWithTransactions(+key); + + // throw if data item is not available + if (!value) throw new Error(); + + return { + key, + value, + }; + } + + async prevalidateDataItem(_: Validator, __: DataItem): Promise { + // TODO: return valid for now + return true; + } + + async transformDataItem(_: Validator, item: DataItem): Promise { + // Delete the number of confirmations from a transaction to keep data deterministic. + item.value.transactions.forEach( + (tx: Partial) => delete tx.confirmations + ); + + return item; + } + + async validateDataItem( + _: Validator, + proposedDataItem: DataItem, + validationDataItem: DataItem + ): Promise { + const proposedDataItemHash = sha256( + Buffer.from(JSON.stringify(proposedDataItem)) + ); + const validationDataItemHash = sha256( + Buffer.from(JSON.stringify(validationDataItem)) + ); + + return proposedDataItemHash === validationDataItemHash; + } + + async summarizeDataBundle(_: Validator, bundle: DataItem[]): Promise { + return bundle.at(-1)?.value?.hash ?? ''; + } + + async nextKey(_: Validator, key: string): Promise { + return (parseInt(key) + 1).toString(); + } +} diff --git a/integrations/evm/tsconfig.json b/integrations/evm/tsconfig.json new file mode 100644 index 00000000..25389c96 --- /dev/null +++ b/integrations/evm/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es2019", + "strict": true, + "outDir": "dist", + "esModuleInterop": true, + "resolveJsonModule": true + }, + "files": ["src/index.ts"] +} diff --git a/lerna.json b/lerna.json new file mode 100644 index 00000000..2ca3a748 --- /dev/null +++ b/lerna.json @@ -0,0 +1,17 @@ +{ + "version": "independent", + "npmClient": "yarn", + "useWorkspaces": true, + "useNx": true, + "command": { + "version": { + "conventionalCommits": true, + "allowBranch": "main", + "exact": true, + "message": "chore: released new version" + }, + "clean": { + "yes": true + } + } +} diff --git a/nx.json b/nx.json new file mode 100644 index 00000000..ea71e4f7 --- /dev/null +++ b/nx.json @@ -0,0 +1,10 @@ +{ + "tasksRunnerOptions": { + "default": { + "runner": "nx/tasks-runners/default", + "options": { + "cacheableOperations": ["build"] + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..9a2b1f18 --- /dev/null +++ b/package.json @@ -0,0 +1,40 @@ +{ + "name": "root", + "private": true, + "repository": { + "type": "git", + "url": "https://github.com/KYVENetwork/kyvejs.git" + }, + "workspaces": [ + "common/*", + "integrations/*", + "tools/*" + ], + "devDependencies": { + "lerna": "^6.1.0", + "nx": "^14.4.3", + "prettier": "^2.3.0", + "rimraf": "^3.0.2", + "@typescript-eslint/eslint-plugin": "^5.42.1", + "@typescript-eslint/parser": "^5.42.1", + "eslint": "^8.27.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-simple-import-sort": "^8.0.0" + }, + "scripts": { + "setup": "lerna clean && lerna bootstrap --ignore-scripts && lerna run build", + "graph": "yarn nx graph", + "build": "lerna run build", + "pub": "lerna run build && lerna publish", + "build:changed": "lerna run --since origin/master --include-dependents build", + "test": "lerna run test", + "test:unit": "lerna run test:unit", + "fmt": "prettier --write .", + "clean": "lerna run clean", + "lint": "lerna run lint", + "lint:fix": "lerna run lint:fix", + "custom-version": "yarn lerna version --conventional-commits=false" + }, + "version": "0.0.0" +} diff --git a/tools/kysor/.gitignore b/tools/kysor/.gitignore new file mode 100644 index 00000000..989dfe0a --- /dev/null +++ b/tools/kysor/.gitignore @@ -0,0 +1,216 @@ +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,macos,windows,node,webstorm+all + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +# dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache +.stylelintcache + +# SvelteKit build / generate output +.svelte-kit + +### WebStorm+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ \ No newline at end of file diff --git a/tools/kysor/README.md b/tools/kysor/README.md new file mode 100644 index 00000000..f67e2f62 --- /dev/null +++ b/tools/kysor/README.md @@ -0,0 +1,151 @@ + + +
+

KYVE + COSMOVISOR

+
+ +![banner](https://github.com/kyve-org/assets/raw/main/banners/KYSOR.png) + +## Why use KYSOR + +KYVE has a broad ecosystem of projects archiving their data with KYVE. To standardize different data from different projects KYVE created special runtimes for standards like `@kyve/evm` for all EVM based chains. This has great benefits but also has downsides for protocol node runners in terms of user experience. + +Without KYSOR for every pool the node runner has to get the binaries manually. If you want to run on another pool which has a different runtime you again have to manually obtain the binaries. Furthermore, if a pool ever upgrades to a newer protocol node version, you have the same procedure like before. Even worse, you might miss the update and receive a timeout slash for being offline + +**Running nodes with KYSOR has the following benefits:** + +- Only use **one** program to run on **every** pool +- Not installing and compiling protocol binaries **manually** for every pool +- Getting the new upgrade binaries during a pool upgrade **automatically** and therefore **don't risk timeout slashes** +- Make running protocol nodes **standardized** and **easier** + +## Installation + +Currently, there are no binaries for the KYSOR, therefore it has to be installed and build manually by cloning the repository: + +```bash +git clone https://github.com/kyve-org/kysor.git +cd kysor +``` + +## Install dependencies + +In order to get started run the following in the project root directory: + +```bash +yarn install +``` + +## Setup + +General directory structure and important files: + +- `src` contains all the source code of KYSOR +- `kysor.conf.ts` is the main config file. It is explained in more detail below +- `secrets` is the directory where your secrets are stored like `arweave.json` and `mnemonic.txt` +- `runtimes` will be autogenerated once you start KYSOR and will contain all binaries structured by runtime and version +- `db` will be autogenerated once you start KYSOR and will contain all caching data for the protocol nodes +- `logs` will be autogenerated once you start KYSOR and will contain all log data for the protocol nodes + +In order to setup KYSOR the following secrets need to be added under the `secrets` directory: + +- `arweave.json` this is the arweave keyfile you need to provide in order to run protocol nodes. This one keyfile will be used for **all** of your protocol nodes +- `mnemonic.txt` this is the file which contains your mnemonic of your validator account. This one mnemonic will be used for **all** of your protocol nodes + +After adding the required secrets you can check the `kysor.conf.ts` file. When you initially open it, it should look like this: + +```ts +import { IConfig } from "./src/faces"; + +const config: IConfig = { + // target of the host machine, can be either "linux" or "macos" + // important for downloading the correct binaries + hostTarget: "linux", + + // whether KYSOR should auto download new binaries + // if set to false, you have to insert the binaries manually + autoDownload: true, + + // whether KYSOR should verify the checksums of downloaded binaries + // if autoDownload is false this option can be ignored + verifyChecksums: true, + + // settings for protocol node + // notice that mnemonic and keyfile is missing, those need to be files under the secrets directory + protocolNode: { + // the ID of the pool you want to join as a validator + // an overview of all pools can be found here -> https://app.kyve.network + poolId: 0, + + // the network you want to run on + // currently only the testnet network "korellia" is available + network: "korellia", + + // the amount of $KYVE you want to stake + // will only get applied if you are not a validator yet + // once you are a validator you can manage your stake in the KYVE app + initialStake: 100, + + // the amount of bytes the node can use at max to cache data + // 1000000000 equals 1 GB which is usually enough + space: 1000000000, + + // specify verbose logging + // is often recommended in order to have a more detailed insight + verbose: true, + }, +}; + +export default config; +``` + +Since this file is commented and explained in detail the info regarding config properties can be found in this file. +Every time you edit the config file you have to build the project with `yarn build`. + +After entering your config like the `poolId` and your `initialStake` and other settings that are required to run a protocol node on a pool you can start KYSOR by running + +``` +yarn build +yarn start +``` + +When you see logs like this everything should work fine + +```ts +2022-05-19 13:54:00.299 INFO Starting KYSOR ... +2022-05-19 13:54:00.299 INFO Validating files ... +2022-05-19 13:54:00.300 INFO Found kysor.conf.ts +2022-05-19 13:54:00.300 INFO Found arweave.json +2022-05-19 13:54:00.300 INFO Found mnemonic.txt +2022-05-19 13:54:00.300 INFO Creating "runtimes" directory ... +2022-05-19 13:54:00.300 INFO Attempting to fetch pool state. +2022-05-19 13:54:00.543 INFO Fetched pool state +2022-05-19 13:54:00.543 INFO Binary of runtime "@kyve/evm" with version 1.0.5 not found locally +2022-05-19 13:54:00.544 INFO Found downloadable binary on pool +2022-05-19 13:54:00.545 INFO Downloading https://github.com/kyve-org/evm/releases/download/v1.0.5/kyve-linux.zip?checksum=8662ddeb3a3e0eaedbbb5a665a4fa0eed12448349218ef0d98afed25cfacd60c ... +2022-05-19 13:54:01.910 INFO Extracting binary to "./runtimes/@kyve/evm/1.0.5/kyve.zip" ... +2022-05-19 13:54:02.315 INFO Deleting kyve.zip ... +2022-05-19 13:54:02.664 INFO Comparing binary checksums ... + +2022-05-19 13:54:02.666 INFO Found checksum = 8662ddeb3a3e0eaedbbb5a665a4fa0eed12448349218ef0d98afed25cfacd60c +2022-05-19 13:54:02.666 INFO Local checksum = 8662ddeb3a3e0eaedbbb5a665a4fa0eed12448349218ef0d98afed25cfacd60c + +2022-05-19 13:54:02.666 INFO Checksums are equal. Continuing ... +2022-05-19 13:54:02.666 INFO Starting child process ... + + +2022-05-19 13:54:06.858 INFO Starting node ... + +2022-05-19 13:54:06.861 INFO Name = impressed-emerald-spoonbill +2022-05-19 13:54:06.953 INFO Address = kyve1eka2hngntu5r2yeuyz5pd45a0fadarp3zue8gd +2022-05-19 13:54:06.954 INFO Pool Id = 0 +2022-05-19 13:54:06.954 INFO @kyve/core = v1.0.8 +2022-05-19 13:54:06.954 INFO @kyve/evm = v1.0.5 + +2022-05-19 13:54:06.955 DEBUG Attempting to fetch pool state. +2022-05-19 13:54:07.245 INFO Running node on runtime @kyve/evm. +2022-05-19 13:54:07.248 INFO Pool version requirements met +2022-05-19 13:54:07.249 INFO Fetched pool state +2022-05-19 13:54:07.349 INFO Node is already staked. Skipping ... +2022-05-19 13:54:07.350 INFO Running node with a stake of 100.0000 $KYVE +``` diff --git a/tools/kysor/package.json b/tools/kysor/package.json new file mode 100644 index 00000000..1f56e8a5 --- /dev/null +++ b/tools/kysor/package.json @@ -0,0 +1,60 @@ +{ + "name": "@kyve/kysor", + "description": "The Cosmovisor for KYVE protocol nodes", + "version": "1.0.0-beta.0", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "homepage": "https://github.com/KYVENetwork/kysor#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/KYVENetwork/kyvejs.git" + }, + "publishConfig": { + "registry": "https://npm.pkg.github.com" + }, + "author": "Troy Kessler ", + "license": "MIT", + "scripts": { + "build": "rimraf dist && tsc", + "build:binaries": "yarn build && rimraf out && pkg --no-bytecode --public-packages '*' --output out/kysor package.json", + "start": "node ./dist/index.js", + "format": "prettier --write .", + "deploy": "yarn build && yarn npm publish", + "lint": "eslint . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx", + "lint:fix": "eslint --fix . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx" + }, + "bin": "./dist/index.js", + "pkg": { + "scripts": "./dist/index.js", + "assets": [ + "../../node_modules/classic-level/**/*" + ], + "targets": [ + "latest-linux-x64", + "latest-linux-arm64", + "latest-macos-x64" + ], + "outputPath": "out" + }, + "dependencies": { + "@iarna/toml": "^2.2.5", + "@kyvejs/sdk": "1.0.0-beta.0", + "@kyvejs/types": "1.0.0-beta.0", + "axios": "^0.27.2", + "bignumber.js": "^9.1.0", + "commander": "^9.4.0", + "download": "^8.0.0", + "extract-zip": "^2.0.1", + "pkg": "^5.8.0", + "prompts": "^2.4.2", + "tslog": "^3.3.3" + }, + "devDependencies": { + "@types/download": "^8.0.1", + "@types/node": "^18.11.9", + "@types/node-fetch": "^2.6.2", + "@types/prompts": "^2.0.14", + "rimraf": "^3.0.2", + "typescript": "^4.6.4" + } +} diff --git a/tools/kysor/src/commands/init.ts b/tools/kysor/src/commands/init.ts new file mode 100644 index 00000000..0c145b98 --- /dev/null +++ b/tools/kysor/src/commands/init.ts @@ -0,0 +1,61 @@ +import TOML from "@iarna/toml"; +import KyveSDK from "@kyvejs/sdk"; +import { Command } from "commander"; +import fs from "fs"; +import path from "path"; + +const home = path.join(process.env.HOME!, ".kysor"); + +const init = new Command("init").description("Init KYSOR"); + +init + .requiredOption( + "-n, --network ", + "The network the KYSOR should run on" + ) + .option( + "-d, --auto-download-binaries", + "Allow automatic download and execution of new upgrade binaries" + ) + .action(async (options) => { + try { + if (fs.existsSync(path.join(home, `config.toml`))) { + console.log( + `KYSOR was already initialized. You can directly edit the config file under ${path.join( + home, + `config.toml` + )}` + ); + } else { + // create KYSOR home directory + fs.mkdirSync(home, { + recursive: true, + }); + + try { + new KyveSDK(options.network); + } catch (err) { + console.log(`ERROR: network ${options.network} was not recognized`); + return; + } + + const config = { + network: options.network, + autoDownloadBinaries: options.autoDownloadBinaries, + }; + + fs.writeFileSync( + path.join(home, `config.toml`), + TOML.stringify(config as any) + ); + + console.log( + `Successfully initialized KYSOR in the following home directory: ${home}` + ); + } + } catch (err) { + console.log(`ERROR: Could not init KYSOR: ${err}`); + } + }); + +export default init; diff --git a/tools/kysor/src/commands/start.ts b/tools/kysor/src/commands/start.ts new file mode 100644 index 00000000..e9261b4b --- /dev/null +++ b/tools/kysor/src/commands/start.ts @@ -0,0 +1,14 @@ +import { Command } from "commander"; + +import { run } from "../kysor"; + +const start = new Command("start").description("Start KYSOR"); + +start + .requiredOption("-v, --valaccount ", "Name of the valaccount to run") + .option("-d, --auto-download-binaries") + .action(async (options) => { + await run(options); + }); + +export default start; diff --git a/tools/kysor/src/commands/valaccounts.ts b/tools/kysor/src/commands/valaccounts.ts new file mode 100644 index 00000000..4c7c411d --- /dev/null +++ b/tools/kysor/src/commands/valaccounts.ts @@ -0,0 +1,148 @@ +import TOML from "@iarna/toml"; +import KyveSDK from "@kyvejs/sdk"; +import { Command } from "commander"; +import fs from "fs"; +import path from "path"; +import prompts from "prompts"; + +import { IValaccountConfig } from "../types/interfaces"; + +const home = path.join(process.env.HOME!, ".kysor"); + +const valaccounts = new Command("valaccounts").description( + "Create and delete valaccounts" +); + +valaccounts + .command("create") + .description("Create a new valaccount") + .requiredOption( + "--name ", + "Name of the valaccount (name only used locally for KYSOR)" + ) + .requiredOption( + "--pool ", + "The ID of the pool this valaccount should participate as a validator" + ) + .requiredOption( + "--storage-priv ", + "The private key of the storage provider" + ) + .option("--verbose", "Run the validator node in verbose logging mode") + .option( + "--metrics", + "Start a prometheus metrics server on http://localhost:8080/metrics" + ) + .option( + "--metrics-port ", + "Specify the port of the metrics server. Only considered if '--metrics' is set [default = 8080]", + "8080" + ) + .option("--recover", "Create a valaccount by importing an existing mnemonic") + .action(async (options) => { + try { + if (!fs.existsSync(path.join(home, `config.toml`))) { + console.log( + `KYSOR is not initialized yet. You can initialize it by running: ./kysor init --network --auto-download-binaries` + ); + return; + } + + // create home directory for valaccount configs + fs.mkdirSync(path.join(home, "valaccounts"), { recursive: true }); + + // check if valaccount with same pool id was already created + const pools = []; + const valaccounts = fs.readdirSync(path.join(home, "valaccounts")); + + for (const valaccount of valaccounts) { + const config: IValaccountConfig = TOML.parse( + fs.readFileSync(path.join(home, "valaccounts", valaccount), "utf-8") + ) as any; + pools.push(config.pool); + } + + // parse pool id + const pool = parseInt(options.pool, 10); + + if (pools.includes(pool)) { + console.log( + `ERROR: Already created a valaccount with Pool Id = ${pool}` + ); + return; + } + + // get mnemonic for valaccount + let valaccount; + + if (options.recover) { + const { mnemonic } = await prompts( + { + type: "text", + name: "mnemonic", + message: "Enter the mnemonic", + validate: async (value) => { + try { + await KyveSDK.getAddressFromMnemonic(value); + } catch (err) { + return `${err}`; + } + + return true; + }, + }, + { + onCancel: () => { + throw Error("Aborted mnemonic input"); + }, + } + ); + + valaccount = mnemonic; + } else { + valaccount = await KyveSDK.generateMnemonic(); + } + + const config: IValaccountConfig = { + pool, + valaccount, + storagePriv: options.storagePriv, + verbose: options.verbose, + metrics: options.metrics, + metricsPort: options.metricsPort, + }; + + fs.writeFileSync( + path.join(home, "valaccounts", `${options.name}.toml`), + TOML.stringify(config as any) + ); + console.log(`Successfully created valaccount ${options.name}`); + } catch (err) { + console.log(`ERROR: Could not create valaccount: ${err}`); + } + }); + +valaccounts + .command("delete") + .description("Delete a valaccount") + .requiredOption( + "--name ", + "Name of the valaccount (name only used locally for KYSOR)" + ) + .action(async (options) => { + try { + if ( + !fs.existsSync(path.join(home, "valaccounts", `${options.name}.toml`)) + ) { + console.log(`Valaccount with name ${options.name} does not exist`); + return; + } + + fs.unlinkSync(path.join(home, "valaccounts", `${options.name}.toml`)); + console.log(`Successfully deleted valaccount ${options.name}`); + } catch (err) { + console.log(`ERROR: Could not delete valaccount: ${err}`); + } + }); + +export default valaccounts; diff --git a/tools/kysor/src/index.ts b/tools/kysor/src/index.ts new file mode 100644 index 00000000..727b53a3 --- /dev/null +++ b/tools/kysor/src/index.ts @@ -0,0 +1,24 @@ +import { Command } from "commander"; + +import init from "./commands/init"; +import start from "./commands/start"; +import valaccounts from "./commands/valaccounts"; + +const main = async () => { + // define main program + const program = new Command(); + + // add init commands + program.addCommand(init); + + // add valaccounts commands + program.addCommand(valaccounts); + + // add start commands + program.addCommand(start); + + // bootstrap program + program.parse(); +}; + +main(); diff --git a/tools/kysor/src/kysor.ts b/tools/kysor/src/kysor.ts new file mode 100644 index 00000000..6c5304a7 --- /dev/null +++ b/tools/kysor/src/kysor.ts @@ -0,0 +1,355 @@ +import TOML from "@iarna/toml"; +import KyveSDK, { KyveLCDClientType } from "@kyvejs/sdk"; +import { PoolResponse } from "@kyvejs/types/lcd/kyve/query/v1beta1/pools"; +import download from "download"; +import extract from "extract-zip"; +import fs from "fs"; +import os from "os"; +import path from "path"; + +import { IConfig, IValaccountConfig } from "./types/interfaces"; +import { getChecksum, setupLogger, startNodeProcess } from "./utils"; + +const home = path.join(process.env.HOME!, ".kysor"); +const platform = os.platform() === "darwin" ? "macos" : os.platform(); +const arch = os.arch(); +const INFINITY_LOOP = true; +const logger = setupLogger(); + +export const run = async (options: any) => { + let config: IConfig = {} as IConfig; + let valaccount: IValaccountConfig = {} as IValaccountConfig; + let pool: PoolResponse; + let lcd: KyveLCDClientType = {} as KyveLCDClientType; + + if (!fs.existsSync(path.join(home, `config.toml`))) { + logger.error( + `KYSOR is not initialized yet. You can initialize it by running: ./kysor init --network --auto-download-binaries` + ); + return; + } + + logger.info("Starting KYSOR ..."); + logger.info(`Running on platform and architecture "${platform}" - "${arch}"`); + + // verify that KYSOR config toml exists and can be parsed + try { + if (!fs.existsSync(path.join(home, `config.toml`))) { + logger.error(`KYSOR config.toml does not exist. Exiting KYSOR ...`); + process.exit(0); + } + } catch (err) { + logger.error( + `Error opening KYSOR config file config.toml. Exiting KYSOR ...` + ); + logger.error(err); + process.exit(0); + } + + // verify that KYSOR config toml can be parsed + try { + config = TOML.parse( + fs.readFileSync(path.join(home, `config.toml`), "utf-8") + ) as any; + logger.info(`Found KYSOR config file "config.toml"`); + } catch (err) { + logger.error( + `Error parsing KYSOR config file config.toml. Exiting KYSOR ...` + ); + logger.error(err); + process.exit(0); + } + + // verify that valaccount toml exists and can be parsed + try { + if ( + !fs.existsSync( + path.join(home, "valaccounts", `${options.valaccount}.toml`) + ) + ) { + logger.error( + `Valaccount with name ${options.valaccount} does not exist. Exiting KYSOR ...` + ); + process.exit(0); + } + } catch (err) { + logger.error( + `Error opening valaccount config file ${options.valaccount}.toml. Exiting KYSOR ...` + ); + logger.error(err); + process.exit(0); + } + + // verify that valaccount toml can be parsed + try { + valaccount = TOML.parse( + fs.readFileSync( + path.join(home, "valaccounts", `${options.valaccount}.toml`), + "utf-8" + ) + ) as any; + logger.info(`Found valaccount config file "${options.valaccount}.toml"`); + } catch (err) { + logger.error( + `Error parsing valaccount config file ${options.valaccount}.toml. Exiting KYSOR ...` + ); + logger.error(err); + process.exit(0); + } + + // verify kyve sdk client can be created + try { + lcd = new KyveSDK(config.network).createLCDClient(); + } catch (err) { + logger.error( + `Error creating LCD client from network ${options.network}. Exiting KYSOR ...` + ); + logger.error(err); + } + + while (INFINITY_LOOP) { + // create pool directory if it does not exist yet + if (!fs.existsSync("./upgrades")) { + logger.info(`Creating "upgrades" directory ...`); + fs.mkdirSync(path.join(home, `upgrades`), { + recursive: true, + }); + } + + // fetch pool state + const data = await lcd.kyve.query.v1beta1.pool({ + id: valaccount.pool.toString(), + }); + + pool = data.pool as PoolResponse; + + const version = pool.data?.protocol?.version; + + if (!version) { + logger.error("Version tag not found on pool. Exiting KYSOR ..."); + process.exit(0); + } + + // create pool directory if does not exist yet + if (!fs.existsSync(path.join(home, `upgrades`, `pool-${pool.id}`))) { + fs.mkdirSync(path.join(home, `upgrades`, `pool-${pool.id}`), { + recursive: true, + }); + } + + // check if directory with version already exists + if ( + fs.existsSync(path.join(home, `upgrades`, `pool-${pool.id}`, version)) + ) { + logger.info( + `Binary of pool "${pool.id}" with version ${version} found locally` + ); + } else { + logger.info( + `Binary of pool "${pool.id}" with version ${version} not found locally` + ); + + // if binary needs to be downloaded and autoDownload is disable exit + if (!config.autoDownloadBinaries) { + logger.error( + "Auto download is disabled and new upgrade binary could not be found. Exiting KYSOR ..." + ); + process.exit(0); + } + + const binaries = JSON.parse(pool.data!.protocol!.binaries); + const downloadLink = binaries[`kyve-${platform}-${arch}`]; + + // if download link was not found exit + if (!downloadLink) { + logger.error( + `Upgrade binary "kyve-${platform}-${arch}" not found on pool. Exiting KYSOR ...` + ); + process.exit(0); + } + + logger.info("Found downloadable binary on pool"); + + const checksum = new URL(downloadLink).searchParams.get("checksum") || ""; + + // create directories for new version + fs.mkdirSync( + path.join(home, `upgrades`, `pool-${pool.id}`, version, `bin`), + { + recursive: true, + } + ); + + // try to download binary + try { + logger.info(`Downloading from ${downloadLink} ...`); + + fs.writeFileSync( + path.join( + home, + `upgrades`, + `pool-${pool.id}`, + version, + `bin`, + "kyve.zip" + ), + await download(downloadLink) + ); + } catch (err) { + logger.error( + `Error downloading binary from ${downloadLink}. Exiting KYSOR ...` + ); + logger.error(err); + + // exit and delete version folders if binary could not be downloaded + fs.rmSync(path.join(home, `upgrades`, `pool-${pool.id}`, version), { + recursive: true, + }); + process.exit(0); + } + + try { + logger.info( + `Extracting binary to ${path.join( + home, + `upgrades`, + `pool-${pool.id}`, + version, + `bin`, + "kyve.zip" + )} ...` + ); + await extract( + path.join( + home, + `upgrades`, + `pool-${pool.id}`, + version, + `bin`, + "kyve.zip" + ), + { + dir: path.resolve( + path.join(home, `upgrades`, `pool-${pool.id}`, version, `bin`) + ), + } + ); + + // check if kyve.zip exists + if ( + fs.existsSync( + path.join( + home, + `upgrades`, + `pool-${pool.id}`, + version, + `bin`, + "kyve.zip" + ) + ) + ) { + logger.info(`Deleting kyve.zip ...`); + // delete zip afterwards + fs.unlinkSync( + path.join( + home, + `upgrades`, + `pool-${pool.id}`, + version, + `bin`, + "kyve.zip" + ) + ); + } + } catch (err) { + logger.error("Error extracting binary. Exiting KYSOR ..."); + logger.error(err); + + // exit and delete version folders if binary could not be extracted + fs.rmSync(path.join(home, `upgrades`, `pool-${pool.id}`, version), { + recursive: true, + }); + process.exit(0); + } + + if (checksum) { + const versionHome = path.join( + home, + `upgrades`, + `pool-${pool.id}`, + version + ); + const binHome = path.join(versionHome, `bin`); + const binName = fs.readdirSync(binHome)[0]; + const binPath = path.join(binHome, binName); + + const localChecksum = await getChecksum(binPath); + + logger.info("Comparing binary checksums ..."); + console.log(); + logger.info(`Found checksum = ${checksum}`); + logger.info(`Local checksum = ${localChecksum}`); + console.log(); + + if (checksum === localChecksum) { + logger.info("Checksums are equal. Continuing ..."); + } else { + logger.info("Checksums are not equal. Exiting KYSOR ..."); + process.exit(0); + } + } + } + + try { + const versionHome = path.join( + home, + `upgrades`, + `pool-${pool.id}`, + version + ); + const binHome = path.join(versionHome, `bin`); + const binName = fs.readdirSync(binHome)[0]; + const binPath = path.join(binHome, binName); + + const args = [ + `start`, + `--pool`, + `${valaccount.pool}`, + `--valaccount`, + `${valaccount.valaccount}`, + `--storage-priv`, + `${valaccount.storagePriv}`, + `--network`, + `${config.network}`, + `--home`, + `${versionHome}`, + ]; + + if (valaccount.verbose) { + args.push("--verbose"); + } + + if (valaccount.metrics) { + args.push("--metrics"); + args.push("--metrics-port"); + args.push(`${valaccount.metricsPort}`); + } + + logger.info("Starting process ..."); + + console.log("\n"); + + await startNodeProcess(binPath, args, {}); + + console.log("\n"); + + logger.info("Stopped process ..."); + } catch (err) { + logger.error("Found unexpected runtime error. Exiting KYSOR ..."); + if (err) { + logger.error(err); + } + process.exit(1); + } + } +}; diff --git a/tools/kysor/src/types/interfaces.ts b/tools/kysor/src/types/interfaces.ts new file mode 100644 index 00000000..b3096ba4 --- /dev/null +++ b/tools/kysor/src/types/interfaces.ts @@ -0,0 +1,15 @@ +import { KYVE_NETWORK } from "@kyvejs/sdk/dist/constants"; + +export interface IConfig { + network: KYVE_NETWORK; + autoDownloadBinaries: boolean; +} + +export interface IValaccountConfig { + pool: number; + valaccount: string; + storagePriv: string; + verbose: boolean; + metrics: boolean; + metricsPort: string; +} diff --git a/tools/kysor/src/utils.ts b/tools/kysor/src/utils.ts new file mode 100644 index 00000000..2a91e2ec --- /dev/null +++ b/tools/kysor/src/utils.ts @@ -0,0 +1,102 @@ +import { spawn, SpawnOptionsWithoutStdio } from "child_process"; +import crypto from "crypto"; +import fs from "fs"; +import path from "path"; +import { ILogObject, Logger } from "tslog"; + +const home = path.join(process.env.HOME!, ".kysor"); + +export const setupLogger = () => { + // create log folder + fs.mkdirSync(path.join(home, `logs`), { recursive: true }); + + const logFile = `${new Date().toISOString()}.log`; + + const logToTransport = (log: ILogObject) => { + fs.appendFileSync( + path.join(home, `logs`, logFile), + JSON.stringify(log) + "\n" + ); + }; + + const logger: Logger = new Logger({ + displayFilePath: "hidden", + displayFunctionName: false, + logLevelsColors: { + 0: "white", + 1: "white", + 2: "white", + 3: "white", + 4: "white", + 5: "white", + 6: "white", + }, + }); + + logger.attachTransport({ + silly: logToTransport, + debug: logToTransport, + trace: logToTransport, + info: logToTransport, + warn: logToTransport, + error: logToTransport, + fatal: logToTransport, + }); + + return logger; +}; + +export const sleep = (ms: number) => { + return new Promise((resolve) => setTimeout(resolve, ms)); +}; + +export const startNodeProcess = ( + command: string, + args: string[], + options: SpawnOptionsWithoutStdio +): Promise => { + return new Promise((resolve, reject) => { + try { + const child = spawn(command, args, options); + + child.stdout.pipe(process.stdout); + child.stderr.pipe(process.stderr); + + child.stderr.on("data", (data: Buffer) => { + if (data.toString().includes("Running an invalid version.")) { + child.kill(); + resolve(); + } + }); + + child.on("error", (err) => { + child.kill(); + reject(err); + }); + + child.on("close", () => { + child.kill(); + reject(); + }); + } catch (err) { + reject(err); + } + }); +}; + +export const getChecksum = (path: string): Promise => { + return new Promise((resolve, reject) => { + const hash = crypto.createHash("sha256"); + const input = fs.createReadStream(path); + + input.on("error", reject); + + input.on("data", (chunk: Buffer) => { + hash.update(chunk); + }); + + input.on("close", () => { + resolve(hash.digest("hex")); + }); + }); +}; diff --git a/tools/kysor/tsconfig.json b/tools/kysor/tsconfig.json new file mode 100644 index 00000000..781a04c7 --- /dev/null +++ b/tools/kysor/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es2019", + "module": "commonjs", + "strict": true, + "outDir": "dist", + "esModuleInterop": true, + "resolveJsonModule": true + }, + "files": ["src/index.ts"] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..c3530f97 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "declaration": true, + "esModuleInterop": true, + "sourceMap": true, + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 00000000..c3853131 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,10030 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@ampproject/remapping@^2.1.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" + integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w== + dependencies: + "@jridgewell/gen-mapping" "^0.1.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" + integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== + dependencies: + "@babel/highlight" "^7.18.6" + +"@babel/compat-data@^7.20.0": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.1.tgz#f2e6ef7790d8c8dbf03d379502dcc246dcce0b30" + integrity sha512-EWZ4mE2diW3QALKvDMiXnbZpRvlj+nayZ112nK93SnhqOtpdsbVD4W+2tEoT3YNBAG9RBR0ISY758ZkOgsn6pQ== + +"@babel/core@^7.11.6", "@babel/core@^7.12.3": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.2.tgz#8dc9b1620a673f92d3624bd926dc49a52cf25b92" + integrity sha512-w7DbG8DtMrJcFOi4VrLm+8QM4az8Mo+PuLBKLp2zrYRCow8W/f9xiXm5sN53C8HksCyDQwCKha9JiDoIyPjT2g== + dependencies: + "@ampproject/remapping" "^2.1.0" + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.20.2" + "@babel/helper-compilation-targets" "^7.20.0" + "@babel/helper-module-transforms" "^7.20.2" + "@babel/helpers" "^7.20.1" + "@babel/parser" "^7.20.2" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.20.1" + "@babel/types" "^7.20.2" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.1" + semver "^6.3.0" + +"@babel/generator@7.18.2": + version "7.18.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.2.tgz#33873d6f89b21efe2da63fe554460f3df1c5880d" + integrity sha512-W1lG5vUwFvfMd8HVXqdfbuG7RuaSrTCCD8cl8fP8wOivdbtbIg2Db3IWUcgvfxKbbn6ZBGYRW/Zk1MIwK49mgw== + dependencies: + "@babel/types" "^7.18.2" + "@jridgewell/gen-mapping" "^0.3.0" + jsesc "^2.5.1" + +"@babel/generator@^7.20.1", "@babel/generator@^7.20.2", "@babel/generator@^7.7.2": + version "7.20.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.4.tgz#4d9f8f0c30be75fd90a0562099a26e5839602ab8" + integrity sha512-luCf7yk/cm7yab6CAW1aiFnmEfBJplb/JojV56MYEK7ziWfGmFlTfmL9Ehwfy4gFhbjBfWO1wj7/TuSbVNEEtA== + dependencies: + "@babel/types" "^7.20.2" + "@jridgewell/gen-mapping" "^0.3.2" + jsesc "^2.5.1" + +"@babel/helper-compilation-targets@^7.20.0": + version "7.20.0" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz#6bf5374d424e1b3922822f1d9bdaa43b1a139d0a" + integrity sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ== + dependencies: + "@babel/compat-data" "^7.20.0" + "@babel/helper-validator-option" "^7.18.6" + browserslist "^4.21.3" + semver "^6.3.0" + +"@babel/helper-environment-visitor@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" + integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== + +"@babel/helper-function-name@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c" + integrity sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w== + dependencies: + "@babel/template" "^7.18.10" + "@babel/types" "^7.19.0" + +"@babel/helper-hoist-variables@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" + integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-module-imports@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz#1e3ebdbbd08aad1437b428c50204db13c5a3ca6e" + integrity sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-module-transforms@^7.20.2": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.20.2.tgz#ac53da669501edd37e658602a21ba14c08748712" + integrity sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA== + dependencies: + "@babel/helper-environment-visitor" "^7.18.9" + "@babel/helper-module-imports" "^7.18.6" + "@babel/helper-simple-access" "^7.20.2" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/helper-validator-identifier" "^7.19.1" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.20.1" + "@babel/types" "^7.20.2" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.8.0": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz#d1b9000752b18d0877cff85a5c376ce5c3121629" + integrity sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ== + +"@babel/helper-simple-access@^7.20.2": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz#0ab452687fe0c2cfb1e2b9e0015de07fc2d62dd9" + integrity sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA== + dependencies: + "@babel/types" "^7.20.2" + +"@babel/helper-split-export-declaration@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075" + integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-string-parser@^7.19.4": + version "7.19.4" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" + integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== + +"@babel/helper-validator-identifier@^7.16.7", "@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" + integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== + +"@babel/helper-validator-option@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8" + integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== + +"@babel/helpers@^7.20.1": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.1.tgz#2ab7a0fcb0a03b5bf76629196ed63c2d7311f4c9" + integrity sha512-J77mUVaDTUJFZ5BpP6mMn6OIl3rEWymk2ZxDBQJUG3P+PbmyMcF3bYWvz0ma69Af1oobDqT/iAsvzhB58xhQUg== + dependencies: + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.20.1" + "@babel/types" "^7.20.0" + +"@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@babel/parser@7.18.4": + version "7.18.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.4.tgz#6774231779dd700e0af29f6ad8d479582d7ce5ef" + integrity sha512-FDge0dFazETFcxGw/EXzOkN8uJp0PC7Qbm+Pe9T+av2zlBpOgunFHkQPPn+eRuClU73JF+98D531UgayY89tow== + +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.20.1", "@babel/parser@^7.20.2": + version "7.20.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.3.tgz#5358cf62e380cf69efcb87a7bb922ff88bfac6e2" + integrity sha512-OP/s5a94frIPXwjzEcv5S/tpQfc6XhxYUnmWpgdqMWGgYCuErA3SzozaRAMQgSZWKeTJxht9aWAkUY+0UzvOFg== + +"@babel/plugin-syntax-async-generators@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-bigint@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" + integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-class-properties@^7.8.3": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-import-meta@^7.8.3": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-logical-assignment-operators@^7.8.3": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-numeric-separator@^7.8.3": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-top-level-await@^7.8.3": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-typescript@^7.7.2": + version "7.20.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz#4e9a0cfc769c85689b77a2e642d24e9f697fc8c7" + integrity sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.19.0" + +"@babel/runtime@^7.12.5", "@babel/runtime@^7.17.2": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.1.tgz#1148bb33ab252b165a06698fde7576092a78b4a9" + integrity sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg== + dependencies: + regenerator-runtime "^0.13.10" + +"@babel/template@^7.18.10", "@babel/template@^7.3.3": + version "7.18.10" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.18.10.tgz#6f9134835970d1dbf0835c0d100c9f38de0c5e71" + integrity sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/parser" "^7.18.10" + "@babel/types" "^7.18.10" + +"@babel/traverse@^7.20.1", "@babel/traverse@^7.7.2": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.1.tgz#9b15ccbf882f6d107eeeecf263fbcdd208777ec8" + integrity sha512-d3tN8fkVJwFLkHkBN479SOsw4DMZnz8cdbL/gvuDuzy3TS6Nfw80HuQqhw1pITbIruHyh7d1fMA47kWzmcUEGA== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.20.1" + "@babel/helper-environment-visitor" "^7.18.9" + "@babel/helper-function-name" "^7.19.0" + "@babel/helper-hoist-variables" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/parser" "^7.20.1" + "@babel/types" "^7.20.0" + debug "^4.1.0" + globals "^11.1.0" + +"@babel/types@7.18.4": + version "7.18.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.4.tgz#27eae9b9fd18e9dccc3f9d6ad051336f307be354" + integrity sha512-ThN1mBcMq5pG/Vm2IcBmPPfyPXbd8S02rS+OBIDENdufvqC7Z/jHPCv9IcP01277aKtDI8g/2XysBN4hA8niiw== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + to-fast-properties "^2.0.0" + +"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.2", "@babel/types@^7.18.6", "@babel/types@^7.19.0", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.2.tgz#67ac09266606190f496322dbaff360fdaa5e7842" + integrity sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog== + dependencies: + "@babel/helper-string-parser" "^7.19.4" + "@babel/helper-validator-identifier" "^7.19.1" + to-fast-properties "^2.0.0" + +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== + +"@bundlr-network/client@^0.8.9": + version "0.8.9" + resolved "https://registry.yarnpkg.com/@bundlr-network/client/-/client-0.8.9.tgz#58e969a5d80f8d25d212d46bb7a060730a3c1736" + integrity sha512-SJ7BAt/KhONeFQ0+nbqrw2DUWrsev6y6cmlXt+3x7fPCkw7OJwudtxV/h2nBteZd65NXjqw8yzkmLiLfZ7CCRA== + dependencies: + "@solana/wallet-adapter-base" "^0.9.2" + "@solana/web3.js" "^1.36.0" + "@supercharge/promise-pool" "^2.1.0" + algosdk "^1.13.1" + arbundles "^0.6.21" + arweave "^1.11.4" + async-retry "^1.3.3" + axios "^0.25.0" + base64url "^3.0.1" + bignumber.js "^9.0.1" + bs58 "^4.0.1" + commander "^8.2.0" + csv "^6.0.5" + ethers "^5.5.1" + inquirer "^8.2.0" + js-sha256 "^0.9.0" + mime-types "^2.1.34" + near-api-js "^0.44.2" + near-seed-phrase "^0.2.0" + +"@celo-tools/celo-ethers-wrapper@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@celo-tools/celo-ethers-wrapper/-/celo-ethers-wrapper-0.3.0.tgz#14e19edde1c71da912927344590029e9ffcb3a97" + integrity sha512-qJgVQ3EeVYzM0uvGcVxPB4cH8BaEnoLMyG8k/gAWzSCjJFIgNTlRs05IFGzAb7U0GlbDKCDSualHSGMXq+OHEw== + +"@confio/ics23@^0.6.3", "@confio/ics23@^0.6.8": + version "0.6.8" + resolved "https://registry.yarnpkg.com/@confio/ics23/-/ics23-0.6.8.tgz#2a6b4f1f2b7b20a35d9a0745bb5a446e72930b3d" + integrity sha512-wB6uo+3A50m0sW/EWcU64xpV/8wShZ6bMTa7pF8eYsTrSkQA7oLUIJcs/wb8g4y2Oyq701BaGiO6n/ak5WXO1w== + dependencies: + "@noble/hashes" "^1.0.0" + protobufjs "^6.8.8" + +"@cosmjs/amino@0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.27.1.tgz#0910256b5aecd794420bb5f7319d98fc63252fa1" + integrity sha512-w56ar/nK9+qlvWDpBPRmD0Blk2wfkkLqRi1COs1x7Ll1LF0AtkIBUjbRKplENLbNovK0T3h+w8bHiFm+GBGQOA== + dependencies: + "@cosmjs/crypto" "0.27.1" + "@cosmjs/encoding" "0.27.1" + "@cosmjs/math" "0.27.1" + "@cosmjs/utils" "0.27.1" + +"@cosmjs/amino@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.28.0.tgz#bbf84e0ca717a8e42214c1f5ba784d9f88f9cec2" + integrity sha512-/6EPrU9khqcQzCVbU9VFwKZ9GVfhuW7XlRVSiGIui7tG/uAQ4F+1MY/YK9gN/+JEW2ZuY/VASbAnrqUL4yrvjQ== + dependencies: + "@cosmjs/crypto" "0.28.0" + "@cosmjs/encoding" "0.28.0" + "@cosmjs/math" "0.28.0" + "@cosmjs/utils" "0.28.0" + +"@cosmjs/amino@0.28.3": + version "0.28.3" + resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.28.3.tgz#103c9804c028d71af2aaf86fd0873df9aa02bd9d" + integrity sha512-35qgkj7m4NeC/UJf3RgT153mmfz0m/2xdbBEwhkf2VF3T1acmeSI8AymSGCz0Rp2VmcUZumEVXEAETJ1XZsrmw== + dependencies: + "@cosmjs/crypto" "0.28.3" + "@cosmjs/encoding" "0.28.3" + "@cosmjs/math" "0.28.3" + "@cosmjs/utils" "0.28.3" + +"@cosmjs/crypto@0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.27.1.tgz#271c853089a3baf3acd6cf0b2122fd49f8815743" + integrity sha512-vbcxwSt99tIYJg8Spp00wc3zx72qx+pY3ozGuBN8gAvySnagK9dQ/jHwtWQWdammmdD6oW+75WfIHZ+gNa+Ybg== + dependencies: + "@cosmjs/encoding" "0.27.1" + "@cosmjs/math" "0.27.1" + "@cosmjs/utils" "0.27.1" + bip39 "^3.0.2" + bn.js "^5.2.0" + elliptic "^6.5.3" + js-sha3 "^0.8.0" + libsodium-wrappers "^0.7.6" + ripemd160 "^2.0.2" + sha.js "^2.4.11" + +"@cosmjs/crypto@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.28.0.tgz#1e02afc09ae461b37cf12d020b9d072096bf2c58" + integrity sha512-XlBqB21SDsySvKRb8o+7KNRVSyrytAEkf7TqGR0LKyznIj3yKOR+xWw13vsfIPNjo/cy+4fUb9KlZ8ztwiPG/A== + dependencies: + "@cosmjs/encoding" "0.28.0" + "@cosmjs/math" "0.28.0" + "@cosmjs/utils" "0.28.0" + "@noble/hashes" "^1" + bn.js "^5.2.0" + elliptic "^6.5.3" + libsodium-wrappers "^0.7.6" + +"@cosmjs/crypto@0.28.3": + version "0.28.3" + resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.28.3.tgz#07f8bb7423bdb9e06cc08efbd47ae07d87c17ee1" + integrity sha512-o6YMT40zjQuAnJ+LUOjZYuV3jfz5q25YmGkuwvQJa+c+ETMU+bOCnSgaAMC+hA9HAlVi2xZGywr8nHXCtx8lnA== + dependencies: + "@cosmjs/encoding" "0.28.3" + "@cosmjs/math" "0.28.3" + "@cosmjs/utils" "0.28.3" + "@noble/hashes" "^1" + bn.js "^5.2.0" + elliptic "^6.5.3" + libsodium-wrappers "^0.7.6" + +"@cosmjs/crypto@^0.24.1": + version "0.24.1" + resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.24.1.tgz#62da59c32b26344f26b10dd31a02b93655586d04" + integrity sha512-GPhaWmQO06mXldKj/b+oKF5o3jMNfRKpAw+Q8XQhrD7ItinVPDMu8Xgl6frUXWTUdgpYwqpvqOcpm85QUsYV0Q== + dependencies: + "@cosmjs/encoding" "^0.24.1" + "@cosmjs/math" "^0.24.1" + "@cosmjs/utils" "^0.24.1" + bip39 "^3.0.2" + bn.js "^4.11.8" + elliptic "^6.5.3" + js-sha3 "^0.8.0" + libsodium-wrappers "^0.7.6" + pbkdf2 "^3.1.1" + ripemd160 "^2.0.2" + sha.js "^2.4.11" + unorm "^1.5.0" + +"@cosmjs/encoding@0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.27.1.tgz#3cd5bc0af743485eb2578cdb08cfa84c86d610e1" + integrity sha512-rayLsA0ojHeniaRfWWcqSsrE/T1rl1gl0OXVNtXlPwLJifKBeLEefGbOUiAQaT0wgJ8VNGBazVtAZBpJidfDhw== + dependencies: + base64-js "^1.3.0" + bech32 "^1.1.4" + readonly-date "^1.0.0" + +"@cosmjs/encoding@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.28.0.tgz#e93f1ad0ee887074bb094e9c1c388bdb479c1abb" + integrity sha512-MKpEPg1g49PWiW9DMo4/PkHODYTR4kDveJqrYpGLucj3kipjzNe0C84K5cpc6Pfzwu0x56qnTq5J0b45v1z+ng== + dependencies: + base64-js "^1.3.0" + bech32 "^1.1.4" + readonly-date "^1.0.0" + +"@cosmjs/encoding@0.28.3": + version "0.28.3" + resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.28.3.tgz#b61494336968fd36d46a81524420f729a50810c3" + integrity sha512-KXHIqWxloyGMcfHheT6c7qJVg7JOpcHlsZEK3KXktqQU4lQpVbmZc3Bi6o1r8AymVh8UnaxBuKcbbMRHlXhCJw== + dependencies: + base64-js "^1.3.0" + bech32 "^1.1.4" + readonly-date "^1.0.0" + +"@cosmjs/encoding@^0.20.0": + version "0.20.1" + resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.20.1.tgz#1d1162b3eca51b7244cd45102e313612cea77281" + integrity sha512-aBp153iq2LD4GwDGwodDWZk/eyAUZ8J8bbiqZ1uK8rrylzm9Rdw84aa6JxykezJe+uBPtoI4lx9eH7VQXCGDXw== + dependencies: + base64-js "^1.3.0" + bech32 "^1.1.4" + readonly-date "^1.0.0" + +"@cosmjs/encoding@^0.24.1": + version "0.24.1" + resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.24.1.tgz#b30e92cdb70fc200a163b8c7aa5254606c8a09ab" + integrity sha512-PMr+gaXAuM0XgjeXwB1zdX1QI0t+PgVhbmjgI/RSgswDzdExNH97qUopecL0/HG3p64vhIT/6ZjXYYTljZL7WA== + dependencies: + base64-js "^1.3.0" + bech32 "^1.1.4" + readonly-date "^1.0.0" + +"@cosmjs/json-rpc@0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.27.1.tgz#ce0a6157f57a76e964587ceb9027884bc4ffe701" + integrity sha512-AKvsllGr6oN5kiroatIeIIxRdCFetLd8LCWV04RRNkoJ2OefDNb46VlWEQ+gI3ay5GgfVjB9qAcfvbJyrcEv+A== + dependencies: + "@cosmjs/stream" "0.27.1" + xstream "^11.14.0" + +"@cosmjs/json-rpc@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.28.0.tgz#cbb8ee4c47bb9d2fbd0f70395d3e715097962eb2" + integrity sha512-5GYCowl4xbh8cRVs6QZI1+fbW8BmmEGQ3m1ee43KySZsSBvUv4sXNA3vvHt0KMDhkrwX5oEBBKppSjDO9Nt1PA== + dependencies: + "@cosmjs/stream" "0.28.0" + xstream "^11.14.0" + +"@cosmjs/launchpad@^0.24.0-alpha.25", "@cosmjs/launchpad@^0.24.1": + version "0.24.1" + resolved "https://registry.yarnpkg.com/@cosmjs/launchpad/-/launchpad-0.24.1.tgz#fe7e80734dfd60ea093429a646d7a38634c70134" + integrity sha512-syqVGKRH6z1vw4DdAJOSu4OgUXJdkXQozqvDde0cXYwnvhb7EXGSg5CTtp+2GqTBJuNVfMZ2DSvrC2Ig8cWBQQ== + dependencies: + "@cosmjs/crypto" "^0.24.1" + "@cosmjs/encoding" "^0.24.1" + "@cosmjs/math" "^0.24.1" + "@cosmjs/utils" "^0.24.1" + axios "^0.21.1" + fast-deep-equal "^3.1.3" + +"@cosmjs/math@0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.27.1.tgz#be78857b008ffc6b1ed6fecaa1c4cd5bc38c07d7" + integrity sha512-cHWVjmfIjtRc7f80n7x+J5k8pe+vTVTQ0lA82tIxUgqUvgS6rogPP/TmGtTiZ4+NxWxd11DUISY6gVpr18/VNQ== + dependencies: + bn.js "^5.2.0" + +"@cosmjs/math@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.28.0.tgz#bb875a09ac33dc1d1b008ed6e0ef2e006052233e" + integrity sha512-W2BQCMt75ZG93ijtOGpC7K6tgLxQq/oIxyXOF5QHG3MtcKVvUlJgMTqLz7+YbDZEw/cr1COqYqKag9oXG21s0Q== + dependencies: + bn.js "^5.2.0" + +"@cosmjs/math@0.28.3": + version "0.28.3" + resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.28.3.tgz#6f44b146afb419773adacde010d081995b6f0606" + integrity sha512-Y5vWF0Le2GVeIgWJGWXbqOcAMZ6WqcHehZ8toVPwmLhwdX+61VNwNox+2a18RuSvwwI0P9EEheZNwchHEMV7Ww== + dependencies: + bn.js "^5.2.0" + +"@cosmjs/math@^0.20.0": + version "0.20.1" + resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.20.1.tgz#c3c2be821b8b5dbbb9b2c0401bd9f1472e821f2a" + integrity sha512-xt7BmpSw2OVGM2+JhlJvKv9OJs9+3DqgVL6+byUDC355CSISrZhFjJg9GFko1EFssDXz5YgvBZR5FkifC0xazw== + dependencies: + bn.js "^4.11.8" + +"@cosmjs/math@^0.24.1": + version "0.24.1" + resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.24.1.tgz#9eed507885aacc9b269441fc9ecb00fb5876883a" + integrity sha512-eBQk8twgzmpHFCVkoNjTZhsZwWRbR+JXt0FhjXJoD85SBm4K8b2OnOyTg68uPHVKOJjLRwzyRVYgMrg5TBVgwQ== + dependencies: + bn.js "^4.11.8" + +"@cosmjs/proto-signing@0.27.1", "@cosmjs/proto-signing@^0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.27.1.tgz#1f8f662550aab012d957d02f43c77d914c2ae0db" + integrity sha512-t7/VvQivMdM1KgKWai/9ZCEcGFXJtr9Xo0hGcPLTn9wGkh9tmOsUXINYVMsf5D/jWIm1MDPbGCYfdb9V1Od4hw== + dependencies: + "@cosmjs/amino" "0.27.1" + "@cosmjs/crypto" "0.27.1" + "@cosmjs/math" "0.27.1" + cosmjs-types "^0.4.0" + long "^4.0.0" + protobufjs "~6.10.2" + +"@cosmjs/proto-signing@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.28.0.tgz#d0e6880a6cb0115c78a5bca9cc89490e4b5e5e69" + integrity sha512-UbIrtRxtaiNg3hP/+y6QFGwMIZaLHhkoRtgz3BmsEpFnROLjTIGe0OjA8CZHe7yD7Jl6MDnN5LDqdHQpstsfbw== + dependencies: + "@cosmjs/amino" "0.28.0" + "@cosmjs/crypto" "0.28.0" + "@cosmjs/math" "0.28.0" + cosmjs-types "^0.4.0" + long "^4.0.0" + protobufjs "~6.10.2" + +"@cosmjs/proto-signing@^0.24.0-alpha.25": + version "0.24.1" + resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.24.1.tgz#4ee38d4e0d29c626344fb832235fda8e8d645c28" + integrity sha512-/rnyNx+FlG6b6O+igsb42eMN1/RXY+pTrNnAE8/YZaRloP9A6MXiTMO5JdYSTcjaD0mEVhejiy96bcyflKYXBg== + dependencies: + "@cosmjs/launchpad" "^0.24.1" + long "^4.0.0" + protobufjs "~6.10.2" + +"@cosmjs/socket@0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.27.1.tgz#c7a3eceb15efb9874a048c3238d1f0b185185742" + integrity sha512-bKCRsaSXh/TA7efxVCogzS2K3cgC40Ge2itFYmTfgpOE+++52FchCblVCsCYwMNDLS497RP4P0GbeC1VEBToMA== + dependencies: + "@cosmjs/stream" "0.27.1" + isomorphic-ws "^4.0.1" + ws "^7" + xstream "^11.14.0" + +"@cosmjs/socket@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.28.0.tgz#2669310a67fe6bea2240417176c7dc4979435a95" + integrity sha512-9jkzci/+8cfD0+ir/SJ1uE5KZZzJ+cloJ5BjCxJoAdLeap2IbG/ElkgWz30Jt8d0WINhewsEUIwmhGn6CY9bPA== + dependencies: + "@cosmjs/stream" "0.28.0" + isomorphic-ws "^4.0.1" + ws "^7" + xstream "^11.14.0" + +"@cosmjs/stargate@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.28.0.tgz#ecd9b8829b86c381fd3f0f9b4f2ab18ad9ac6e2a" + integrity sha512-i0n9RxqOVkYYcyCjksBSqiDO5SVAPbIbPVZwMrAQHyb/mO//BX+A7XldGEwGYj1wGwKI+l1VEeaoh8UQA4PZxg== + dependencies: + "@confio/ics23" "^0.6.8" + "@cosmjs/amino" "0.28.0" + "@cosmjs/encoding" "0.28.0" + "@cosmjs/math" "0.28.0" + "@cosmjs/proto-signing" "0.28.0" + "@cosmjs/stream" "0.28.0" + "@cosmjs/tendermint-rpc" "0.28.0" + "@cosmjs/utils" "0.28.0" + cosmjs-types "^0.4.0" + long "^4.0.0" + protobufjs "~6.10.2" + xstream "^11.14.0" + +"@cosmjs/stargate@^0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.27.1.tgz#0abc1f91e5cc421940c920f16a22c6c93cc774d5" + integrity sha512-7hAIyNd6NbhQA51w9mPVyMYw515Hpj0o7SXMaqbc7nxs3hkJNMONQ9RakyMm0U/WeCd6ObcSaPEcdkqbfkc+mg== + dependencies: + "@confio/ics23" "^0.6.3" + "@cosmjs/amino" "0.27.1" + "@cosmjs/encoding" "0.27.1" + "@cosmjs/math" "0.27.1" + "@cosmjs/proto-signing" "0.27.1" + "@cosmjs/stream" "0.27.1" + "@cosmjs/tendermint-rpc" "0.27.1" + "@cosmjs/utils" "0.27.1" + cosmjs-types "^0.4.0" + long "^4.0.0" + protobufjs "~6.10.2" + xstream "^11.14.0" + +"@cosmjs/stream@0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.27.1.tgz#02f40856c0840e34ef11054da9e84e8196d37593" + integrity sha512-cEyEAVfXEyuUpKYBeEJrOj8Dp/c+M6a0oGJHxvDdhP5gSsaeCPgQXrh7qZFBiUfu3Brmqd+e/bKZm+068l9bBw== + dependencies: + xstream "^11.14.0" + +"@cosmjs/stream@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.28.0.tgz#a6f4ea8156d8c08654b7a5268e8bf8663505cf4e" + integrity sha512-POwyxM8XU/Jm5IAUR0hJMA27TzPgYhAxfuF28hGfcIScKCmaWlOYUraviJIZk2ShwplBS8slHU7DU1f55gKfkw== + dependencies: + xstream "^11.14.0" + +"@cosmjs/tendermint-rpc@0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.27.1.tgz#66f4a04d1b9ac5849ea2981c2e67bc229996a85a" + integrity sha512-eN1NyBYIiFutDNleEaTfvIJ3S3KA1gP45UHaLhSETm8KyiaUqg/b0Mj6sp7J3h4BhgwLq2zn/TDtIn0k5luedg== + dependencies: + "@cosmjs/crypto" "0.27.1" + "@cosmjs/encoding" "0.27.1" + "@cosmjs/json-rpc" "0.27.1" + "@cosmjs/math" "0.27.1" + "@cosmjs/socket" "0.27.1" + "@cosmjs/stream" "0.27.1" + axios "^0.21.2" + readonly-date "^1.0.0" + xstream "^11.14.0" + +"@cosmjs/tendermint-rpc@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.28.0.tgz#fb040dded884e8d1b80b6d906f1ea6d56c185368" + integrity sha512-hqQGgFIZs5XjvwfH6+X44jHUxL0Eg3TqEg3iMvtCM9M3iC8AxKgCfb0sjO6HzOguQoWayVITkaU1/ZV84Peh4A== + dependencies: + "@cosmjs/crypto" "0.28.0" + "@cosmjs/encoding" "0.28.0" + "@cosmjs/json-rpc" "0.28.0" + "@cosmjs/math" "0.28.0" + "@cosmjs/socket" "0.28.0" + "@cosmjs/stream" "0.28.0" + axios "^0.21.2" + readonly-date "^1.0.0" + xstream "^11.14.0" + +"@cosmjs/utils@0.27.1": + version "0.27.1" + resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.27.1.tgz#1c8efde17256346ef142a3bd15158ee4055470e2" + integrity sha512-VG7QPDiMUzVPxRdJahDV8PXxVdnuAHiIuG56hldV4yPnOz/si/DLNd7VAUUA5923b6jS1Hhev0Hr6AhEkcxBMg== + +"@cosmjs/utils@0.28.0": + version "0.28.0" + resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.28.0.tgz#a2fefb68b7e2dddabf27f739a0f51578f7ebb4dc" + integrity sha512-1Um7h2a20ipbvEw0dzKPHL8qTbH5YY9ND0u5XxlVaCxaYDMTpzjjPiQD+Offxx/28afi8cuHWDbJc45dJXoCAg== + +"@cosmjs/utils@0.28.3": + version "0.28.3" + resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.28.3.tgz#a11f72369d69d9f2dd24e251593ab19b9a36753d" + integrity sha512-fc4yt0E0QF7bfsmvSvrOTbJ6RdLJwWbv+pYhVzqSYURj3YfP4qow49vUIEfhO7MLyskXV9exRj4mqoIUUymlBQ== + +"@cosmjs/utils@^0.20.0": + version "0.20.1" + resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.20.1.tgz#4d239b7d93c15523cdf109f225cbf61326fb69cd" + integrity sha512-xl9YnIrAAaBd6nFffwFbyrnKjqjD9zKGP8OBKxzyglxamHfqAS+PcJPEiaEpt+oUt7HAIOyhL3KK75Dh52hGvA== + +"@cosmjs/utils@^0.24.1": + version "0.24.1" + resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.24.1.tgz#0adfefe63b7f17222bc2bc12f71296f35e7ad378" + integrity sha512-VA3WFx1lMFb7esp9BqHWkDgMvHoA3D9w+uDRvWhVRpUpDc7RYHxMbWExASjz+gNblTCg556WJGzF64tXnf9tdQ== + +"@cosmostation/extension-client@^0.0.6": + version "0.0.6" + resolved "https://registry.yarnpkg.com/@cosmostation/extension-client/-/extension-client-0.0.6.tgz#a04420c1c3d68b83d197e48e79787a3484fb8d2c" + integrity sha512-3N7NOz8JMOpJlVaGS++zha4AZoijJTnPkq8djEfpk/mJ6+laUNo4a1/mxANFm9i1KUZcU9HX6GKKx9v9nL/VDg== + +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + +"@eslint/eslintrc@^1.3.3": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95" + integrity sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.4.0" + globals "^13.15.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" + integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== + dependencies: + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" + integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + +"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" + integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" + integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + +"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" + integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + +"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" + integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + +"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" + integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + bn.js "^5.2.1" + +"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" + integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" + integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + +"@ethersproject/contracts@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" + integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== + dependencies: + "@ethersproject/abi" "^5.7.0" + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + +"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" + integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" + integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wordlists" "^5.7.0" + +"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" + integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hdnode" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + aes-js "3.0.0" + scrypt-js "3.0.1" + +"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" + integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + js-sha3 "0.8.0" + +"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" + integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== + +"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" + integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" + integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + +"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" + integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/providers@5.7.2": + version "5.7.2" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" + integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + bech32 "1.1.4" + ws "7.4.6" + +"@ethersproject/random@5.7.0", "@ethersproject/random@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" + integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" + integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" + integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + hash.js "1.1.7" + +"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" + integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + bn.js "^5.2.1" + elliptic "6.5.4" + hash.js "1.1.7" + +"@ethersproject/solidity@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" + integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" + integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" + integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== + dependencies: + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + +"@ethersproject/units@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" + integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/wallet@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" + integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/hdnode" "^5.7.0" + "@ethersproject/json-wallets" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wordlists" "^5.7.0" + +"@ethersproject/web@5.7.1", "@ethersproject/web@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" + integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== + dependencies: + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" + integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@gar/promisify@^1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" + integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== + +"@humanwhocodes/config-array@^0.11.6": + version "0.11.7" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.7.tgz#38aec044c6c828f6ed51d5d7ae3d9b9faf6dbb0f" + integrity sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw== + dependencies: + "@humanwhocodes/object-schema" "^1.2.1" + debug "^4.1.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" + integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== + +"@hutson/parse-repository-url@^3.0.0": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" + integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== + +"@iarna/toml@^2.2.5": + version "2.2.5" + resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c" + integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg== + +"@iov/crypto@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@iov/crypto/-/crypto-2.1.0.tgz#10e91b6692e154958c11626dfd096a80e8a481a4" + integrity sha512-jnb4XuK50admolm7fBxOcxfAW2TO+wYrZlhDWiMETItY/Y5gNNa1zaDSO2wNIjjfGng+8nQ1yqnNhqy7busV2Q== + dependencies: + "@iov/encoding" "^2.1.0" + bip39 "^3.0.2" + bn.js "^4.11.8" + elliptic "^6.4.0" + js-sha3 "^0.8.0" + libsodium-wrappers "^0.7.6" + pbkdf2 "^3.0.16" + ripemd160 "^2.0.2" + sha.js "^2.4.11" + type-tagger "^1.0.0" + unorm "^1.5.0" + +"@iov/encoding@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@iov/encoding/-/encoding-2.1.0.tgz#434203c39874c68bc1d96e1278251f0feb23be07" + integrity sha512-5IOdLO7Xg/uRykuiCqeMYghQ3IjWDtGxv7NTWXkgpHuna0aewx43mRpT2NPCpOZd1tpuorDtQ7/zbDNRaIIF/w== + dependencies: + base64-js "^1.3.0" + bech32 "^1.1.3" + bn.js "^4.11.8" + readonly-date "^1.0.0" + +"@iov/encoding@^2.1.0": + version "2.5.0" + resolved "https://registry.yarnpkg.com/@iov/encoding/-/encoding-2.5.0.tgz#9612e529f45e63633b2375c13db28b9330ce6293" + integrity sha512-HGHLlQEvD23rFjW5PQrxD2B/6LiBHVSxqX6gjOz9KfcmIMIftRA0qROrTITfjjjUr/yZZEeNk4qjuBls9TaYcA== + dependencies: + "@cosmjs/encoding" "^0.20.0" + "@cosmjs/math" "^0.20.0" + "@cosmjs/utils" "^0.20.0" + readonly-date "^1.0.0" + +"@iov/utils@2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@iov/utils/-/utils-2.0.2.tgz#3527f376d26100e07ac823bf87bebd0f24680d1c" + integrity sha512-4D8MEvTcFc/DVy5q25vHxRItmgJyeX85dixMH+MxdKr+yy71h3sYk+sVBEIn70uqGP7VqAJkGOPNFs08/XYELw== + +"@isaacs/string-locale-compare@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@isaacs/string-locale-compare/-/string-locale-compare-1.1.0.tgz#291c227e93fd407a96ecd59879a35809120e432b" + integrity sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ== + +"@istanbuljs/load-nyc-config@^1.0.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== + dependencies: + camelcase "^5.3.1" + find-up "^4.1.0" + get-package-type "^0.1.0" + js-yaml "^3.13.1" + resolve-from "^5.0.0" + +"@istanbuljs/schema@^0.1.2": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== + +"@jest/console@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-28.1.3.tgz#2030606ec03a18c31803b8a36382762e447655df" + integrity sha512-QPAkP5EwKdK/bxIr6C1I4Vs0rm2nHiANzj/Z5X2JQkrZo6IqvC4ldZ9K95tF0HdidhA8Bo6egxSzUFPYKcEXLw== + dependencies: + "@jest/types" "^28.1.3" + "@types/node" "*" + chalk "^4.0.0" + jest-message-util "^28.1.3" + jest-util "^28.1.3" + slash "^3.0.0" + +"@jest/core@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-28.1.3.tgz#0ebf2bd39840f1233cd5f2d1e6fc8b71bd5a1ac7" + integrity sha512-CIKBrlaKOzA7YG19BEqCw3SLIsEwjZkeJzf5bdooVnW4bH5cktqe3JX+G2YV1aK5vP8N9na1IGWFzYaTp6k6NA== + dependencies: + "@jest/console" "^28.1.3" + "@jest/reporters" "^28.1.3" + "@jest/test-result" "^28.1.3" + "@jest/transform" "^28.1.3" + "@jest/types" "^28.1.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + ci-info "^3.2.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-changed-files "^28.1.3" + jest-config "^28.1.3" + jest-haste-map "^28.1.3" + jest-message-util "^28.1.3" + jest-regex-util "^28.0.2" + jest-resolve "^28.1.3" + jest-resolve-dependencies "^28.1.3" + jest-runner "^28.1.3" + jest-runtime "^28.1.3" + jest-snapshot "^28.1.3" + jest-util "^28.1.3" + jest-validate "^28.1.3" + jest-watcher "^28.1.3" + micromatch "^4.0.4" + pretty-format "^28.1.3" + rimraf "^3.0.0" + slash "^3.0.0" + strip-ansi "^6.0.0" + +"@jest/environment@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-28.1.3.tgz#abed43a6b040a4c24fdcb69eab1f97589b2d663e" + integrity sha512-1bf40cMFTEkKyEf585R9Iz1WayDjHoHqvts0XFYEqyKM3cFWDpeMoqKKTAF9LSYQModPUlh8FKptoM2YcMWAXA== + dependencies: + "@jest/fake-timers" "^28.1.3" + "@jest/types" "^28.1.3" + "@types/node" "*" + jest-mock "^28.1.3" + +"@jest/expect-utils@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-28.1.3.tgz#58561ce5db7cd253a7edddbc051fb39dda50f525" + integrity sha512-wvbi9LUrHJLn3NlDW6wF2hvIMtd4JUl2QNVrjq+IBSHirgfrR3o9RnVtxzdEGO2n9JyIWwHnLfby5KzqBGg2YA== + dependencies: + jest-get-type "^28.0.2" + +"@jest/expect@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-28.1.3.tgz#9ac57e1d4491baca550f6bdbd232487177ad6a72" + integrity sha512-lzc8CpUbSoE4dqT0U+g1qODQjBRHPpCPXissXD4mS9+sWQdmmpeJ9zSH1rS1HEkrsMN0fb7nKrJ9giAR1d3wBw== + dependencies: + expect "^28.1.3" + jest-snapshot "^28.1.3" + +"@jest/fake-timers@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-28.1.3.tgz#230255b3ad0a3d4978f1d06f70685baea91c640e" + integrity sha512-D/wOkL2POHv52h+ok5Oj/1gOG9HSywdoPtFsRCUmlCILXNn5eIWmcnd3DIiWlJnpGvQtmajqBP95Ei0EimxfLw== + dependencies: + "@jest/types" "^28.1.3" + "@sinonjs/fake-timers" "^9.1.2" + "@types/node" "*" + jest-message-util "^28.1.3" + jest-mock "^28.1.3" + jest-util "^28.1.3" + +"@jest/globals@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-28.1.3.tgz#a601d78ddc5fdef542728309894895b4a42dc333" + integrity sha512-XFU4P4phyryCXu1pbcqMO0GSQcYe1IsalYCDzRNyhetyeyxMcIxa11qPNDpVNLeretItNqEmYYQn1UYz/5x1NA== + dependencies: + "@jest/environment" "^28.1.3" + "@jest/expect" "^28.1.3" + "@jest/types" "^28.1.3" + +"@jest/reporters@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-28.1.3.tgz#9adf6d265edafc5fc4a434cfb31e2df5a67a369a" + integrity sha512-JuAy7wkxQZVNU/V6g9xKzCGC5LVXx9FDcABKsSXp5MiKPEE2144a/vXTEDoyzjUpZKfVwp08Wqg5A4WfTMAzjg== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "^28.1.3" + "@jest/test-result" "^28.1.3" + "@jest/transform" "^28.1.3" + "@jest/types" "^28.1.3" + "@jridgewell/trace-mapping" "^0.3.13" + "@types/node" "*" + chalk "^4.0.0" + collect-v8-coverage "^1.0.0" + exit "^0.1.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^5.1.0" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^4.0.0" + istanbul-reports "^3.1.3" + jest-message-util "^28.1.3" + jest-util "^28.1.3" + jest-worker "^28.1.3" + slash "^3.0.0" + string-length "^4.0.1" + strip-ansi "^6.0.0" + terminal-link "^2.0.0" + v8-to-istanbul "^9.0.1" + +"@jest/schemas@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-28.1.3.tgz#ad8b86a66f11f33619e3d7e1dcddd7f2d40ff905" + integrity sha512-/l/VWsdt/aBXgjshLWOFyFt3IVdYypu5y2Wn2rOO1un6nkqIn8SLXzgIMYXFyYsRWDyF5EthmKJMIdJvk08grg== + dependencies: + "@sinclair/typebox" "^0.24.1" + +"@jest/source-map@^28.1.2": + version "28.1.2" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-28.1.2.tgz#7fe832b172b497d6663cdff6c13b0a920e139e24" + integrity sha512-cV8Lx3BeStJb8ipPHnqVw/IM2VCMWO3crWZzYodSIkxXnRcXJipCdx1JCK0K5MsJJouZQTH73mzf4vgxRaH9ww== + dependencies: + "@jridgewell/trace-mapping" "^0.3.13" + callsites "^3.0.0" + graceful-fs "^4.2.9" + +"@jest/test-result@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-28.1.3.tgz#5eae945fd9f4b8fcfce74d239e6f725b6bf076c5" + integrity sha512-kZAkxnSE+FqE8YjW8gNuoVkkC9I7S1qmenl8sGcDOLropASP+BkcGKwhXoyqQuGOGeYY0y/ixjrd/iERpEXHNg== + dependencies: + "@jest/console" "^28.1.3" + "@jest/types" "^28.1.3" + "@types/istanbul-lib-coverage" "^2.0.0" + collect-v8-coverage "^1.0.0" + +"@jest/test-sequencer@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-28.1.3.tgz#9d0c283d906ac599c74bde464bc0d7e6a82886c3" + integrity sha512-NIMPEqqa59MWnDi1kvXXpYbqsfQmSJsIbnd85mdVGkiDfQ9WQQTXOLsvISUfonmnBT+w85WEgneCigEEdHDFxw== + dependencies: + "@jest/test-result" "^28.1.3" + graceful-fs "^4.2.9" + jest-haste-map "^28.1.3" + slash "^3.0.0" + +"@jest/transform@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-28.1.3.tgz#59d8098e50ab07950e0f2fc0fc7ec462371281b0" + integrity sha512-u5dT5di+oFI6hfcLOHGTAfmUxFRrjK+vnaP0kkVow9Md/M7V/MxqQMOz/VV25UZO8pzeA9PjfTpOu6BDuwSPQA== + dependencies: + "@babel/core" "^7.11.6" + "@jest/types" "^28.1.3" + "@jridgewell/trace-mapping" "^0.3.13" + babel-plugin-istanbul "^6.1.1" + chalk "^4.0.0" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.2.9" + jest-haste-map "^28.1.3" + jest-regex-util "^28.0.2" + jest-util "^28.1.3" + micromatch "^4.0.4" + pirates "^4.0.4" + slash "^3.0.0" + write-file-atomic "^4.0.1" + +"@jest/types@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-28.1.3.tgz#b05de80996ff12512bc5ceb1d208285a7d11748b" + integrity sha512-RyjiyMUZrKz/c+zlMFO1pm70DcIlST8AeWTkoUdZevew44wcNZQHsEVOiCVtgVnlFFD82FPaXycys58cf2muVQ== + dependencies: + "@jest/schemas" "^28.1.3" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + +"@jridgewell/gen-mapping@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996" + integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w== + dependencies: + "@jridgewell/set-array" "^1.0.0" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" + integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== + dependencies: + "@jridgewell/set-array" "^1.0.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/resolve-uri@3.1.0", "@jridgewell/resolve-uri@^3.0.3": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== + +"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + +"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.14" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" + integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== + +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.13", "@jridgewell/trace-mapping@^0.3.9": + version "0.3.17" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" + integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== + dependencies: + "@jridgewell/resolve-uri" "3.1.0" + "@jridgewell/sourcemap-codec" "1.4.14" + +"@keplr-wallet/cosmos@0.9.16": + version "0.9.16" + resolved "https://registry.yarnpkg.com/@keplr-wallet/cosmos/-/cosmos-0.9.16.tgz#bfd1968e32bf7108b213c82c7c36e650f9963ce9" + integrity sha512-pTbqgZdxMY/O4w37YVDTNFdfbueQUXGiYlMAVsrdtFWBQSz+s1j2UpAgtJoIoEoawYVPmlHSWXviafXr7Y7B7w== + dependencies: + "@cosmjs/launchpad" "^0.24.0-alpha.25" + "@keplr-wallet/crypto" "^0.9.10" + "@keplr-wallet/types" "^0.9.12" + "@keplr-wallet/unit" "^0.9.12" + axios "^0.21.4" + bech32 "^1.1.4" + buffer "^6.0.3" + long "^4.0.0" + protobufjs "^6.10.2" + +"@keplr-wallet/crypto@^0.9.10": + version "0.9.10" + resolved "https://registry.yarnpkg.com/@keplr-wallet/crypto/-/crypto-0.9.10.tgz#2ea6f20c68fc284c4f6e7545af7a57bb6545190b" + integrity sha512-zjoUUL5Ky72eJBm7bd9kPNBTgQL/cFO6pbvPgVa32S8UZ6GlwsPSyiHuvq0k8z0t9X9GwdpuH0nrnlL4viU4fw== + dependencies: + bip32 "^2.0.6" + bip39 "^3.0.3" + buffer "^6.0.3" + crypto-js "^4.0.0" + elliptic "^6.5.3" + sha.js "^2.4.11" + +"@keplr-wallet/types@^0.9.12": + version "0.9.12" + resolved "https://registry.yarnpkg.com/@keplr-wallet/types/-/types-0.9.12.tgz#5771913343030a491c551a5a2eebb9cb0ad480f7" + integrity sha512-vtAczeD3+CgGExSZCnU9Wzs9Y8BpdbOii+UjIFHwCR57OXFQphbWHh2j15QFpV4CbebpDcBzIm+/4IAyLeI0Yw== + dependencies: + "@cosmjs/launchpad" "^0.24.0-alpha.25" + "@cosmjs/proto-signing" "^0.24.0-alpha.25" + axios "^0.21.4" + long "^4.0.0" + secretjs "^0.17.0" + +"@keplr-wallet/unit@^0.9.12": + version "0.9.12" + resolved "https://registry.yarnpkg.com/@keplr-wallet/unit/-/unit-0.9.12.tgz#ca672aab115d604ccbe18d6664285252c3acf0f4" + integrity sha512-24b3lSaaOrD3/ctdz+ADZn8vhqojsV5SGGzgD8F+DklI76uw8jYmmxSNcKyUAYpVUzRzTas6nnfB+4MwHBNU/Q== + dependencies: + "@keplr-wallet/types" "^0.9.12" + big-integer "^1.6.48" + utility-types "^3.10.0" + +"@lerna/add@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-6.1.0.tgz#0f09495c5e1af4c4f316344af34b6d1a91b15b19" + integrity sha512-f2cAeS1mE/p7QvSRn5TCgdUXw6QVbu8PeRxaTOxTThhTdJIWdXZfY00QjAsU6jw1PdYXK1qGUSwWOPkdR16mBg== + dependencies: + "@lerna/bootstrap" "6.1.0" + "@lerna/command" "6.1.0" + "@lerna/filter-options" "6.1.0" + "@lerna/npm-conf" "6.1.0" + "@lerna/validation-error" "6.1.0" + dedent "^0.7.0" + npm-package-arg "8.1.1" + p-map "^4.0.0" + pacote "^13.6.1" + semver "^7.3.4" + +"@lerna/bootstrap@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-6.1.0.tgz#81738f32cd431814c9943dfffe28752587d90830" + integrity sha512-aDxKqgxexVj/Z0B1aPu7P1iPbPqhk1FPkl/iayCmPlkAh90pYEH0uVytGzi1hFB5iXEfG7Pa6azGQywUodx/1g== + dependencies: + "@lerna/command" "6.1.0" + "@lerna/filter-options" "6.1.0" + "@lerna/has-npm-version" "6.1.0" + "@lerna/npm-install" "6.1.0" + "@lerna/package-graph" "6.1.0" + "@lerna/pulse-till-done" "6.1.0" + "@lerna/rimraf-dir" "6.1.0" + "@lerna/run-lifecycle" "6.1.0" + "@lerna/run-topologically" "6.1.0" + "@lerna/symlink-binary" "6.1.0" + "@lerna/symlink-dependencies" "6.1.0" + "@lerna/validation-error" "6.1.0" + "@npmcli/arborist" "5.3.0" + dedent "^0.7.0" + get-port "^5.1.1" + multimatch "^5.0.0" + npm-package-arg "8.1.1" + npmlog "^6.0.2" + p-map "^4.0.0" + p-map-series "^2.1.0" + p-waterfall "^2.1.1" + semver "^7.3.4" + +"@lerna/changed@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-6.1.0.tgz#4fa480cbb0e7106ea9dad30d315e953975118d06" + integrity sha512-p7C2tf1scmvoUC1Osck/XIKVKXAQ8m8neL8/rfgKSYsvUVjsOB1LbF5HH1VUZntE6S4OxkRxUQGkAHVf5xrGqw== + dependencies: + "@lerna/collect-updates" "6.1.0" + "@lerna/command" "6.1.0" + "@lerna/listable" "6.1.0" + "@lerna/output" "6.1.0" + +"@lerna/check-working-tree@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-6.1.0.tgz#b8970fd27a26449b12456d5d0ece60477aa54e15" + integrity sha512-hSciDmRqsNPevMhAD+SYbnhjatdb7UUu9W8vTyGtUXkrq2xtRZU0vAOgqovV8meirRkbC41pZePYKqyQtF0y3w== + dependencies: + "@lerna/collect-uncommitted" "6.1.0" + "@lerna/describe-ref" "6.1.0" + "@lerna/validation-error" "6.1.0" + +"@lerna/child-process@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-6.1.0.tgz#6361f7945cd5b36e983f819de3cd91c315707302" + integrity sha512-jhr3sCFeps6Y15SCrWEPvqE64i+QLOTSh+OzxlziCBf7ZEUu7sF0yA4n5bAqw8j43yCKhhjkf/ZLYxZe+pnl3Q== + dependencies: + chalk "^4.1.0" + execa "^5.0.0" + strong-log-transformer "^2.1.0" + +"@lerna/clean@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-6.1.0.tgz#1114fd90ad82438123726e2493d3550e73abebbc" + integrity sha512-LRK2hiNUiBhPe5tmJiefOVpkaX2Yob0rp15IFNIbuteRWUJg0oERFQo62WvnxwElfzKSOhr8OGuEq/vN4bMrRA== + dependencies: + "@lerna/command" "6.1.0" + "@lerna/filter-options" "6.1.0" + "@lerna/prompt" "6.1.0" + "@lerna/pulse-till-done" "6.1.0" + "@lerna/rimraf-dir" "6.1.0" + p-map "^4.0.0" + p-map-series "^2.1.0" + p-waterfall "^2.1.1" + +"@lerna/cli@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-6.1.0.tgz#41214331fa4c1ea5f41125befdd81b009fe12640" + integrity sha512-p4G/OSPIrHiNkEl8bXrQdFOh4ORAZp2+ljvbXmAxpdf2qmopaUdr+bZYtIAxd+Z42SxRnDNz9IEyR0kOsARRQQ== + dependencies: + "@lerna/global-options" "6.1.0" + dedent "^0.7.0" + npmlog "^6.0.2" + yargs "^16.2.0" + +"@lerna/collect-uncommitted@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-6.1.0.tgz#b6ffd7adda24d73b70304210967d3518caa3529d" + integrity sha512-VvWvqDZG+OiF4PwV4Ro695r3+8ty4w+11Bnq8tbsbu5gq8qZiam8Fkc/TQLuNNqP0SPi4qmMPaIzWvSze3SmDg== + dependencies: + "@lerna/child-process" "6.1.0" + chalk "^4.1.0" + npmlog "^6.0.2" + +"@lerna/collect-updates@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-6.1.0.tgz#75fcc0733b5a9ac318a6484b890aa4061b7859c2" + integrity sha512-dgH7kgstwCXFctylQ4cxuCmhwSIE6VJZfHdh2bOaLuncs6ATMErKWN/mVuFHuUWEqPDRyy5Ky40Cu9S40nUq5w== + dependencies: + "@lerna/child-process" "6.1.0" + "@lerna/describe-ref" "6.1.0" + minimatch "^3.0.4" + npmlog "^6.0.2" + slash "^3.0.0" + +"@lerna/command@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-6.1.0.tgz#bcb12516f2c181822b3b5be46c18eadc9b61e885" + integrity sha512-OnMqBDaEBY0C8v9CXIWFbGGKgsiUtZrnKVvQRbupMSZDKMpVGWIUd3X98Is9j9MAmk1ynhBMWE9Fwai5ML/mcA== + dependencies: + "@lerna/child-process" "6.1.0" + "@lerna/package-graph" "6.1.0" + "@lerna/project" "6.1.0" + "@lerna/validation-error" "6.1.0" + "@lerna/write-log-file" "6.1.0" + clone-deep "^4.0.1" + dedent "^0.7.0" + execa "^5.0.0" + is-ci "^2.0.0" + npmlog "^6.0.2" + +"@lerna/conventional-commits@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-6.1.0.tgz#1157bb66d84d48880dc5c5026d743cedf0f47094" + integrity sha512-Tipo3cVr8mNVca4btzrCIzct59ZJWERT8/ZCZ/TQWuI4huUJZs6LRofLtB0xsGJAVZ7Vz2WRXAeH4XYgeUxutQ== + dependencies: + "@lerna/validation-error" "6.1.0" + conventional-changelog-angular "^5.0.12" + conventional-changelog-core "^4.2.4" + conventional-recommended-bump "^6.1.0" + fs-extra "^9.1.0" + get-stream "^6.0.0" + npm-package-arg "8.1.1" + npmlog "^6.0.2" + pify "^5.0.0" + semver "^7.3.4" + +"@lerna/create-symlink@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-6.1.0.tgz#d4260831f5d10abc0c70f0a8f39bea91db87e640" + integrity sha512-ulMa5OUJEwEWBHSgCUNGxrcsJllq1YMYWqhufvIigmMPJ0Zv3TV1Hha5i2MsqLJAakxtW0pNuwdutkUTtUdgxQ== + dependencies: + cmd-shim "^5.0.0" + fs-extra "^9.1.0" + npmlog "^6.0.2" + +"@lerna/create@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-6.1.0.tgz#cde219da46a7c5062c558366b4ffce2134f13845" + integrity sha512-ZqlknXu0L29cV5mcfNgBLl+1RbKTWmNk8mj545zgXc7qQDgmrY+EVvrs8Cirey8C7bBpVkzP7Brzze0MSoB4rQ== + dependencies: + "@lerna/child-process" "6.1.0" + "@lerna/command" "6.1.0" + "@lerna/npm-conf" "6.1.0" + "@lerna/validation-error" "6.1.0" + dedent "^0.7.0" + fs-extra "^9.1.0" + init-package-json "^3.0.2" + npm-package-arg "8.1.1" + p-reduce "^2.1.0" + pacote "^13.6.1" + pify "^5.0.0" + semver "^7.3.4" + slash "^3.0.0" + validate-npm-package-license "^3.0.4" + validate-npm-package-name "^4.0.0" + yargs-parser "20.2.4" + +"@lerna/describe-ref@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-6.1.0.tgz#60f0b8297b912aa5fe5e6ab8ef6c4127813681a7" + integrity sha512-0RQAYnxBaMz1SrEb/rhfR+8VeZx5tvCNYKRee5oXIDZdQ2c6/EPyrKCp3WcqiuOWY50SfGOVfxJEcxpK8Y3FNA== + dependencies: + "@lerna/child-process" "6.1.0" + npmlog "^6.0.2" + +"@lerna/diff@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-6.1.0.tgz#bfa9bc35894d88a33fa0a3a5787082dea45d8cb2" + integrity sha512-GhP+jPDbcp9QcAMSAjFn4lzM8MKpLR1yt5jll+zUD831U1sL0I5t8HUosFroe5MoRNffEL/jHuI3SbC3jjqWjQ== + dependencies: + "@lerna/child-process" "6.1.0" + "@lerna/command" "6.1.0" + "@lerna/validation-error" "6.1.0" + npmlog "^6.0.2" + +"@lerna/exec@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-6.1.0.tgz#a2d165576471ff61e33c49952d40a5dbc36fc78f" + integrity sha512-Ej6WlPHXLF6hZHsfD+J/dxeuTrnc0HIfIXR1DU//msHW5RNCdi9+I7StwreCAQH/dLEsdBjPg5chNmuj2JLQRg== + dependencies: + "@lerna/child-process" "6.1.0" + "@lerna/command" "6.1.0" + "@lerna/filter-options" "6.1.0" + "@lerna/profiler" "6.1.0" + "@lerna/run-topologically" "6.1.0" + "@lerna/validation-error" "6.1.0" + p-map "^4.0.0" + +"@lerna/filter-options@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-6.1.0.tgz#f4ee65d0db0273ce490ce6c72c9dbb1d23268ca6" + integrity sha512-kPf92Z7uLsR6MUiXnyXWebaUWArLa15wLfpfTwIp5H3MNk1lTbuG7QnrxE7OxQj+ozFmBvXeV9fuwfLsYTfmOw== + dependencies: + "@lerna/collect-updates" "6.1.0" + "@lerna/filter-packages" "6.1.0" + dedent "^0.7.0" + npmlog "^6.0.2" + +"@lerna/filter-packages@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-6.1.0.tgz#1ddac63a6ffdf5f058d206be5adfb39ad7aaf4f9" + integrity sha512-zW2avsZHs/ITE/37AEMhegGVHjiD0rgNk9bguNDfz6zaPa90UaW6PWDH6Tf4ThPRlbkl2Go48N3bFYHYSJKbcw== + dependencies: + "@lerna/validation-error" "6.1.0" + multimatch "^5.0.0" + npmlog "^6.0.2" + +"@lerna/get-npm-exec-opts@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/get-npm-exec-opts/-/get-npm-exec-opts-6.1.0.tgz#22351e2ebc4adbef21ca4b86187278e15e4cb38a" + integrity sha512-10Pdf+W0z7RT34o0SWlf+WVzz2/WbnTIJ1tQqXvXx6soj2L/xGLhOPvhJiKNtl4WlvUiO/zQ91yb83ESP4TZaA== + dependencies: + npmlog "^6.0.2" + +"@lerna/get-packed@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-6.1.0.tgz#b6d1c1dd1e068212e784b8dfc2e5fe64741ea8db" + integrity sha512-lg0wPpV0wPekcD0mebJp619hMxsOgbZDOH5AkL/bCR217391eha0iPhQ0dU/G0Smd2vv6Cg443+J5QdI4LGRTg== + dependencies: + fs-extra "^9.1.0" + ssri "^9.0.1" + tar "^6.1.0" + +"@lerna/github-client@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-6.1.0.tgz#cd33743e4529a0b822ae6716cb4b981e1d8ffe8f" + integrity sha512-+/4PtDgsjt0VRRZtOCN2Piyu0asU/16gSZZy/opVb8dlT44lTrH/ZghrJLE4tSL8Nuv688kx0kSgbUG8BY54jQ== + dependencies: + "@lerna/child-process" "6.1.0" + "@octokit/plugin-enterprise-rest" "^6.0.1" + "@octokit/rest" "^19.0.3" + git-url-parse "^13.1.0" + npmlog "^6.0.2" + +"@lerna/gitlab-client@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/gitlab-client/-/gitlab-client-6.1.0.tgz#bbcbf80d937e5980798ac1e0edd1f769101057d8" + integrity sha512-fUI/ppXzxJafN9ceSl+FDgsYvu3iTsO6UW0WTD63pS32CfM+PiCryLQHzuc4RkyVW8WQH3aCR/GbaKCqbu52bw== + dependencies: + node-fetch "^2.6.1" + npmlog "^6.0.2" + +"@lerna/global-options@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-6.1.0.tgz#268e1de924369102e47babd9288086764ec6f9e6" + integrity sha512-1OyJ/N1XJh3ZAy8S20c6th9C4yBm/k3bRIdC+z0XxpDaHwfNt8mT9kUIDt6AIFCUvVKjSwnIsMHwhzXqBnwYSA== + +"@lerna/has-npm-version@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-6.1.0.tgz#a5d960213d1a7ca5374eb3c551a17b322b9a9e62" + integrity sha512-up5PVuP6BmKQ5/UgH/t2c5B1q4HhjwW3/bqbNayX6V0qNz8OijnMYvEUbxFk8fOdeN41qVnhAk0Tb5kbdtYh2A== + dependencies: + "@lerna/child-process" "6.1.0" + semver "^7.3.4" + +"@lerna/import@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-6.1.0.tgz#1c64281e3431c43c9cd140b66a6a51427afe7095" + integrity sha512-xsBhiKLUavATR32dAFL+WFY0yuab0hsM1eztKtRKk4wy7lSyxRfA5EIUcNCsLXx2xaDOKoMncCTXgNcpeYuqcQ== + dependencies: + "@lerna/child-process" "6.1.0" + "@lerna/command" "6.1.0" + "@lerna/prompt" "6.1.0" + "@lerna/pulse-till-done" "6.1.0" + "@lerna/validation-error" "6.1.0" + dedent "^0.7.0" + fs-extra "^9.1.0" + p-map-series "^2.1.0" + +"@lerna/info@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/info/-/info-6.1.0.tgz#a5d66a9c1f18398dc020a6f6073c399013081587" + integrity sha512-CsrWdW/Wyb4kcvHSnrsm7KYWFvjUNItu+ryeyWBZJtWYQOv45jNmWix6j2L4/w1+mMlWMjsfLmBscg82UBrF5w== + dependencies: + "@lerna/command" "6.1.0" + "@lerna/output" "6.1.0" + envinfo "^7.7.4" + +"@lerna/init@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-6.1.0.tgz#b178775693b9c38c0f3fe3300eeb574cf76e0297" + integrity sha512-z8oUeVjn+FQYAtepAw6G47cGodLyBAyNoEjO3IsJjQLWE1yH3r83L2sjyD/EckgR3o2VTEzrKo4ArhxLp2mNmg== + dependencies: + "@lerna/child-process" "6.1.0" + "@lerna/command" "6.1.0" + "@lerna/project" "6.1.0" + fs-extra "^9.1.0" + p-map "^4.0.0" + write-json-file "^4.3.0" + +"@lerna/link@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-6.1.0.tgz#f6f0cfd0b02aecdeb304ce614e4e4e89fe0a3ad5" + integrity sha512-7OD2lYNQHl6Kl1KYmplt8KoWjVHdiaqpYqwD38AwcB09YN58nGmo4aJgC12Fdx8DSNjkumgM0ROg/JOjMCTIzQ== + dependencies: + "@lerna/command" "6.1.0" + "@lerna/package-graph" "6.1.0" + "@lerna/symlink-dependencies" "6.1.0" + "@lerna/validation-error" "6.1.0" + p-map "^4.0.0" + slash "^3.0.0" + +"@lerna/list@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-6.1.0.tgz#a7625bceb5224c4bf1154e715c07ea29f9698bac" + integrity sha512-7/g2hjizkvVnBGpVm+qC7lUFGhZ/0GIMUbGQwnE6yXDGm8yP9aEcNVkU4JGrDWW+uIklf9oodnMHaLXd/FJe6Q== + dependencies: + "@lerna/command" "6.1.0" + "@lerna/filter-options" "6.1.0" + "@lerna/listable" "6.1.0" + "@lerna/output" "6.1.0" + +"@lerna/listable@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-6.1.0.tgz#2510045fde7bc568b18172a5d24372a719bb5c4c" + integrity sha512-3KZ9lQ9AtNfGNH/mYJYaMKCiF2EQvLLBGYkWHeIzIs6foegcZNXe0Cyv3LNXuo5WslMNr5RT4wIgy3BOoAxdtg== + dependencies: + "@lerna/query-graph" "6.1.0" + chalk "^4.1.0" + columnify "^1.6.0" + +"@lerna/log-packed@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-6.1.0.tgz#18ae946e8b7881f2fc5b973cc6682cc599b1759b" + integrity sha512-Sq2HZJAcPuoNeEHeIutcPYQCyWBxLyVGvEhgsP3xTe6XkBGQCG8piCp9wX+sc2zT+idPdpI6qLqdh85yYIMMhA== + dependencies: + byte-size "^7.0.0" + columnify "^1.6.0" + has-unicode "^2.0.1" + npmlog "^6.0.2" + +"@lerna/npm-conf@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-6.1.0.tgz#79697260c9d14ffb9d892927f37fcde75b89ec58" + integrity sha512-+RD3mmJe9XSQj7Diibs0+UafAHPcrFCd29ODpDI+tzYl4MmYZblfrlL6mbSCiVYCZQneQ8Uku3P0r+DlbYBaFw== + dependencies: + config-chain "^1.1.12" + pify "^5.0.0" + +"@lerna/npm-dist-tag@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-6.1.0.tgz#29f843aa628687a29dc3a9b905dd3002db7a3820" + integrity sha512-1zo+Yww/lvWJWZnEXpke9dZSb5poDzhUM/pQNqAQYSlbZ96o18SuCR6TEi5isMPiw63Aq1MMzbUqttQfJ11EOA== + dependencies: + "@lerna/otplease" "6.1.0" + npm-package-arg "8.1.1" + npm-registry-fetch "^13.3.0" + npmlog "^6.0.2" + +"@lerna/npm-install@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-6.1.0.tgz#b75d1f152540a144bd6c81586a9f6010ed7f3046" + integrity sha512-1SHmOHZA1YJuUctLQBRjA2+yMp+UNYdOBsFb3xUVT7MjWnd1Zl0toT3jxGu96RNErD9JKkk/cGo/Aq+DU3s9pg== + dependencies: + "@lerna/child-process" "6.1.0" + "@lerna/get-npm-exec-opts" "6.1.0" + fs-extra "^9.1.0" + npm-package-arg "8.1.1" + npmlog "^6.0.2" + signal-exit "^3.0.3" + write-pkg "^4.0.0" + +"@lerna/npm-publish@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-6.1.0.tgz#8fe561e639e6a06380354271aeca7cbc39acf7dd" + integrity sha512-N0LdR1ImZQw1r4cYaKtVbBhBPtj4Zu9NbvygzizEP5HuTfxZmE1Ans3w93Kks9VTXZXob8twNbXnzBwzTyEpEA== + dependencies: + "@lerna/otplease" "6.1.0" + "@lerna/run-lifecycle" "6.1.0" + fs-extra "^9.1.0" + libnpmpublish "^6.0.4" + npm-package-arg "8.1.1" + npmlog "^6.0.2" + pify "^5.0.0" + read-package-json "^5.0.1" + +"@lerna/npm-run-script@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-6.1.0.tgz#bc5bd414ee9696168d88d8ce78f8e8b715967100" + integrity sha512-7p13mvdxdY5+VqWvvtMsMDeyCRs0PrrTmSHRO+FKuLQuGhBvUo05vevcMEOQNDvEvl/tXPrOVbeGCiGubYTCLg== + dependencies: + "@lerna/child-process" "6.1.0" + "@lerna/get-npm-exec-opts" "6.1.0" + npmlog "^6.0.2" + +"@lerna/otplease@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-6.1.0.tgz#d25dbe2d867215b69f06de12ab4ff559d83d1d01" + integrity sha512-gqSE6IbaD4IeNJePkaDLaFLoGp0Ceu35sn7z0AHAOoHiQGGorOmvM+h1Md3xZZRSXQmY9LyJVhG5eRa38SoG4g== + dependencies: + "@lerna/prompt" "6.1.0" + +"@lerna/output@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/output/-/output-6.1.0.tgz#d470146c6ee8ee063fd416081c1ca64fb132c4d8" + integrity sha512-mgCIzLKIuroytXuxjTB689ERtpfgyNXW0rMv9WHOa6ufQc+QJPjh3L4jVsOA0l+/OxZyi97PUXotduNj+0cbnA== + dependencies: + npmlog "^6.0.2" + +"@lerna/pack-directory@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-6.1.0.tgz#3252ba7250d826b9922238c775abf5004e7580c4" + integrity sha512-Xsixqm2nkGXs9hvq08ClbGpRlCYnlBV4TwSrLttIDL712RlyXoPe2maJzTUqo9OXBbOumFSahUEInCMT2OS05g== + dependencies: + "@lerna/get-packed" "6.1.0" + "@lerna/package" "6.1.0" + "@lerna/run-lifecycle" "6.1.0" + "@lerna/temp-write" "6.1.0" + npm-packlist "^5.1.1" + npmlog "^6.0.2" + tar "^6.1.0" + +"@lerna/package-graph@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-6.1.0.tgz#2373617605f48f53b5fa9d13188838b6c09022b0" + integrity sha512-yGyxd/eHTDjkpnBbDhTV0hwKF+i01qZc+6/ko65wOsh8xtgqpQeE6mtdgbvsLKcuMcIQ7PDy1ntyIv9phg14gQ== + dependencies: + "@lerna/prerelease-id-from-version" "6.1.0" + "@lerna/validation-error" "6.1.0" + npm-package-arg "8.1.1" + npmlog "^6.0.2" + semver "^7.3.4" + +"@lerna/package@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/package/-/package-6.1.0.tgz#e9e33876c0509a86c1b676045b19fd3f7f1c77e2" + integrity sha512-PyNFtdH2IcLasp/nyMDshmeXotriOSlhbeFIxhdl1XuGj5v1so3utMSOrJMO5kzZJQg5zyx8qQoxL+WH/hkrVQ== + dependencies: + load-json-file "^6.2.0" + npm-package-arg "8.1.1" + write-pkg "^4.0.0" + +"@lerna/prerelease-id-from-version@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-6.1.0.tgz#4ee5beeef4e81d77001e94ec5613c140b6615616" + integrity sha512-ngC4I6evvZztB6aOaSDEnhUgRTlqX3TyBXwWwLGTOXCPaCQBTPaLNokhmRdJ+ZVdZ4iHFbzEDSL07ubZrYUcmQ== + dependencies: + semver "^7.3.4" + +"@lerna/profiler@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/profiler/-/profiler-6.1.0.tgz#aae2249f1a39c79db72a548ce50bf32f86a0f3a5" + integrity sha512-WFDQNpuqPqMJLg8llvrBHF8Ib5Asgp23lMeNUe89T62NUX6gkjVBTYdjsduxM0tZH6Pa0GAGaQcha97P6fxfdQ== + dependencies: + fs-extra "^9.1.0" + npmlog "^6.0.2" + upath "^2.0.1" + +"@lerna/project@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/project/-/project-6.1.0.tgz#605afe28fb15d8b8b890fafe0ec1da2700964056" + integrity sha512-EOkfjjrTM16c3GUxGqcfYD2stV35p9mBEmkF41NPmyjfbzjol/irDF1r6Q7BsQSRsdClMJRCeZ168xdSxC2X0A== + dependencies: + "@lerna/package" "6.1.0" + "@lerna/validation-error" "6.1.0" + cosmiconfig "^7.0.0" + dedent "^0.7.0" + dot-prop "^6.0.1" + glob-parent "^5.1.1" + globby "^11.0.2" + js-yaml "^4.1.0" + load-json-file "^6.2.0" + npmlog "^6.0.2" + p-map "^4.0.0" + resolve-from "^5.0.0" + write-json-file "^4.3.0" + +"@lerna/prompt@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-6.1.0.tgz#98e228220428d33620822f77e39f592ce29c776c" + integrity sha512-981J/C53TZ2l2mFVlWJN7zynSzf5GEHKvKQa12Td9iknhASZOuwTAWb6eq46246Ant6W5tWwb0NSPu3I5qtcrA== + dependencies: + inquirer "^8.2.4" + npmlog "^6.0.2" + +"@lerna/publish@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-6.1.0.tgz#9d62c327bc3541a0430951d726b39a2fb17b7925" + integrity sha512-XtvuydtU0IptbAapLRgoN1AZj/WJR+e3UKnx9BQ1Dwc+Fpg2oqPxR/vi+6hxAsr95pdQ5CnWBdgS+dg2wEUJ7Q== + dependencies: + "@lerna/check-working-tree" "6.1.0" + "@lerna/child-process" "6.1.0" + "@lerna/collect-updates" "6.1.0" + "@lerna/command" "6.1.0" + "@lerna/describe-ref" "6.1.0" + "@lerna/log-packed" "6.1.0" + "@lerna/npm-conf" "6.1.0" + "@lerna/npm-dist-tag" "6.1.0" + "@lerna/npm-publish" "6.1.0" + "@lerna/otplease" "6.1.0" + "@lerna/output" "6.1.0" + "@lerna/pack-directory" "6.1.0" + "@lerna/prerelease-id-from-version" "6.1.0" + "@lerna/prompt" "6.1.0" + "@lerna/pulse-till-done" "6.1.0" + "@lerna/run-lifecycle" "6.1.0" + "@lerna/run-topologically" "6.1.0" + "@lerna/validation-error" "6.1.0" + "@lerna/version" "6.1.0" + fs-extra "^9.1.0" + libnpmaccess "^6.0.3" + npm-package-arg "8.1.1" + npm-registry-fetch "^13.3.0" + npmlog "^6.0.2" + p-map "^4.0.0" + p-pipe "^3.1.0" + pacote "^13.6.1" + semver "^7.3.4" + +"@lerna/pulse-till-done@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/pulse-till-done/-/pulse-till-done-6.1.0.tgz#df0112a9a5b8547b53d18742ce21104eb360d731" + integrity sha512-a2RVT82E4R9nVXtehzp2TQL6iXp0QfEM3bu8tBAR/SfI1A9ggZWQhuuUqtRyhhVCajdQDOo7rS0UG7R5JzK58w== + dependencies: + npmlog "^6.0.2" + +"@lerna/query-graph@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-6.1.0.tgz#e78c47c78d4691231fc379570e036bc2753cf6fa" + integrity sha512-YkyCc+6aR7GlCOcZXEKPcl5o5L2v+0YUNs59JrfAS0mctFosZ/2tP7pkdu2SI4qXIi5D0PMNsh/0fRni56znsQ== + dependencies: + "@lerna/package-graph" "6.1.0" + +"@lerna/resolve-symlink@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-6.1.0.tgz#5a8686b99c838bc6e869930e5b5fd582607ebbe7" + integrity sha512-8ILO+h5fsE0q8MSLfdL+MT1GEsNhAB1fDyMkSsYgLRCsssN/cViZbffpclZyT/EfAhpyKfBCHZ0CmT1ZGofU1A== + dependencies: + fs-extra "^9.1.0" + npmlog "^6.0.2" + read-cmd-shim "^3.0.0" + +"@lerna/rimraf-dir@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-6.1.0.tgz#75559585d5921563eff0e206bb9ec8ab0cc967c6" + integrity sha512-J9YeGHkCCeAIzsnKURYeGECBexiIii6HA+Bbd+rAgoKPsNCOj6ql4+qJE8Jbd7fQEFNDPQeBCYvM7JcdMc0WSA== + dependencies: + "@lerna/child-process" "6.1.0" + npmlog "^6.0.2" + path-exists "^4.0.0" + rimraf "^3.0.2" + +"@lerna/run-lifecycle@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-6.1.0.tgz#e1fa6cd300842ef1d688af77648fed05ec2d5345" + integrity sha512-GbTdKxL+hWHEPgyBEKtqY9Nf+jFlt6YLtP5VjEVc5SdLkm+FeRquar9/YcZVUbzr3c+NJwWNgVjHuePfowdpUA== + dependencies: + "@lerna/npm-conf" "6.1.0" + "@npmcli/run-script" "^4.1.7" + npmlog "^6.0.2" + p-queue "^6.6.2" + +"@lerna/run-topologically@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-6.1.0.tgz#8f1a428b5d4b800bced178edabfa2262b328572f" + integrity sha512-kpTaSBKdKjtf61be8Z1e7TIaMt/aksfxswQtpFxEuKDsPsdHfR8htSkADO4d/3SZFtmcAHIHNCQj9CaNj4O4Xw== + dependencies: + "@lerna/query-graph" "6.1.0" + p-queue "^6.6.2" + +"@lerna/run@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-6.1.0.tgz#efaea1acc78cb7fc73b4906be70002e118628d64" + integrity sha512-vlEEKPcTloiob6EK7gxrjEdB6fQQ/LNfWhSJCGxJlvNVbrMpoWIu0Kpp20b0nE+lzX7rRJ4seWr7Wdo/Fjub4Q== + dependencies: + "@lerna/command" "6.1.0" + "@lerna/filter-options" "6.1.0" + "@lerna/npm-run-script" "6.1.0" + "@lerna/output" "6.1.0" + "@lerna/profiler" "6.1.0" + "@lerna/run-topologically" "6.1.0" + "@lerna/timer" "6.1.0" + "@lerna/validation-error" "6.1.0" + fs-extra "^9.1.0" + p-map "^4.0.0" + +"@lerna/symlink-binary@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-6.1.0.tgz#7d476499b86ae5fcb853c510603cff9a27acf105" + integrity sha512-DaiRNZk/dvomNxgEaTW145PyL7vIGP7rvnfXV2FO+rjX8UUSNUOjmVmHlYfs64gV9Eqx/dLfQClIbKcwYMD83A== + dependencies: + "@lerna/create-symlink" "6.1.0" + "@lerna/package" "6.1.0" + fs-extra "^9.1.0" + p-map "^4.0.0" + +"@lerna/symlink-dependencies@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-6.1.0.tgz#f44d33e043fed21a366c4ced2cbde8fa8be0c5fc" + integrity sha512-hrTvtY1Ek+fLA4JjXsKsvwPjuJD0rwB/+K4WY57t00owj//BpCsJ37w3kkkS7f/PcW/5uRjCuHcY67LOEwsRxw== + dependencies: + "@lerna/create-symlink" "6.1.0" + "@lerna/resolve-symlink" "6.1.0" + "@lerna/symlink-binary" "6.1.0" + fs-extra "^9.1.0" + p-map "^4.0.0" + p-map-series "^2.1.0" + +"@lerna/temp-write@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/temp-write/-/temp-write-6.1.0.tgz#a5d532090dd7b2d4f8965fbb475376aae06b9242" + integrity sha512-ZcQl88H9HbQ/TeWUOVt+vDYwptm7kwprGvj9KkZXr9S5Bn6SiKRQOeydCCfCrQT+9Q3dm7QZXV6rWzLsACcAlQ== + dependencies: + graceful-fs "^4.1.15" + is-stream "^2.0.0" + make-dir "^3.0.0" + temp-dir "^1.0.0" + uuid "^8.3.2" + +"@lerna/timer@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/timer/-/timer-6.1.0.tgz#245b02c05b2dec6d2aed2da8a0962cf0343d83d5" + integrity sha512-du+NQ9q7uO4d2nVU4AD2DSPuAZqUapA/bZKuVpFVxvY9Qhzb8dQKLsFISe4A9TjyoNAk8ZeWK0aBc/6N+Qer9A== + +"@lerna/validation-error@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/validation-error/-/validation-error-6.1.0.tgz#03bd46f6219b6db7c4420528d5aaf047f92693e3" + integrity sha512-q0c3XCi5OpyTr8AcfbisS6e3svZaJF/riCvBDqRMaQUT4A8QOPzB4fVF3/+J2u54nidBuTlIk0JZu9aOdWTUkQ== + dependencies: + npmlog "^6.0.2" + +"@lerna/version@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-6.1.0.tgz#44d8649e978df9d6a14d97c9d7631a7dcd4a9cbf" + integrity sha512-RUxVFdzHt0739lRNMrAbo6HWcFrcyG7atM1pn+Eo61fUoA5R/9N4bCk4m9xUGkJ/mOcROjuwAGe+wT1uOs58Bg== + dependencies: + "@lerna/check-working-tree" "6.1.0" + "@lerna/child-process" "6.1.0" + "@lerna/collect-updates" "6.1.0" + "@lerna/command" "6.1.0" + "@lerna/conventional-commits" "6.1.0" + "@lerna/github-client" "6.1.0" + "@lerna/gitlab-client" "6.1.0" + "@lerna/output" "6.1.0" + "@lerna/prerelease-id-from-version" "6.1.0" + "@lerna/prompt" "6.1.0" + "@lerna/run-lifecycle" "6.1.0" + "@lerna/run-topologically" "6.1.0" + "@lerna/temp-write" "6.1.0" + "@lerna/validation-error" "6.1.0" + "@nrwl/devkit" ">=14.8.6 < 16" + chalk "^4.1.0" + dedent "^0.7.0" + load-json-file "^6.2.0" + minimatch "^3.0.4" + npmlog "^6.0.2" + p-map "^4.0.0" + p-pipe "^3.1.0" + p-reduce "^2.1.0" + p-waterfall "^2.1.1" + semver "^7.3.4" + slash "^3.0.0" + write-json-file "^4.3.0" + +"@lerna/write-log-file@6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@lerna/write-log-file/-/write-log-file-6.1.0.tgz#b811cffd2ea2b3be6239a756c64dac9a3795707a" + integrity sha512-09omu2w4NCt8mJH/X9ZMuToQQ3xu/KpC7EU4yDl2Qy8nxKf8HiG8Oe+YYNprngmkdsq60F5eUZvoiFDZ5JeGIg== + dependencies: + npmlog "^6.0.2" + write-file-atomic "^4.0.1" + +"@noble/ed25519@^1.6.1", "@noble/ed25519@^1.7.0": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.1.tgz#6899660f6fbb97798a6fbd227227c4589a454724" + integrity sha512-Rk4SkJFaXZiznFyC/t77Q0NKS4FL7TLJJsVG2V2oiEq3kJVeTdxysEe/yRWSpnWMe808XRDJ+VFh5pt/FN5plw== + +"@noble/hashes@^1", "@noble/hashes@^1.0.0", "@noble/hashes@^1.1.2": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.3.tgz#360afc77610e0a61f3417e497dcf36862e4f8111" + integrity sha512-CE0FCR57H2acVI5UOzIGSSIYxZ6v/HOhDR0Ro9VLyhnzLwx0o8W1mmgaqlEUx4049qJDlIBRztv5k+MM8vbO3A== + +"@noble/secp256k1@^1.6.3": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.0.tgz#d15357f7c227e751d90aa06b05a0e5cf993ba8c1" + integrity sha512-kbacwGSsH/CTout0ZnZWxnW1B+jH/7r/WAAKLBtrRJ/+CUH7lgmQzl3GTrQua3SGKWNSDsS6lmjnDpIJ5Dxyaw== + +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + +"@npmcli/arborist@5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@npmcli/arborist/-/arborist-5.3.0.tgz#321d9424677bfc08569e98a5ac445ee781f32053" + integrity sha512-+rZ9zgL1lnbl8Xbb1NQdMjveOMwj4lIYfcDtyJHHi5x4X8jtR6m8SXooJMZy5vmFVZ8w7A2Bnd/oX9eTuU8w5A== + dependencies: + "@isaacs/string-locale-compare" "^1.1.0" + "@npmcli/installed-package-contents" "^1.0.7" + "@npmcli/map-workspaces" "^2.0.3" + "@npmcli/metavuln-calculator" "^3.0.1" + "@npmcli/move-file" "^2.0.0" + "@npmcli/name-from-folder" "^1.0.1" + "@npmcli/node-gyp" "^2.0.0" + "@npmcli/package-json" "^2.0.0" + "@npmcli/run-script" "^4.1.3" + bin-links "^3.0.0" + cacache "^16.0.6" + common-ancestor-path "^1.0.1" + json-parse-even-better-errors "^2.3.1" + json-stringify-nice "^1.1.4" + mkdirp "^1.0.4" + mkdirp-infer-owner "^2.0.0" + nopt "^5.0.0" + npm-install-checks "^5.0.0" + npm-package-arg "^9.0.0" + npm-pick-manifest "^7.0.0" + npm-registry-fetch "^13.0.0" + npmlog "^6.0.2" + pacote "^13.6.1" + parse-conflict-json "^2.0.1" + proc-log "^2.0.0" + promise-all-reject-late "^1.0.0" + promise-call-limit "^1.0.1" + read-package-json-fast "^2.0.2" + readdir-scoped-modules "^1.1.0" + rimraf "^3.0.2" + semver "^7.3.7" + ssri "^9.0.0" + treeverse "^2.0.0" + walk-up-path "^1.0.0" + +"@npmcli/fs@^2.1.0": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-2.1.2.tgz#a9e2541a4a2fec2e69c29b35e6060973da79b865" + integrity sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ== + dependencies: + "@gar/promisify" "^1.1.3" + semver "^7.3.5" + +"@npmcli/git@^3.0.0": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@npmcli/git/-/git-3.0.2.tgz#5c5de6b4d70474cf2d09af149ce42e4e1dacb931" + integrity sha512-CAcd08y3DWBJqJDpfuVL0uijlq5oaXaOJEKHKc4wqrjd00gkvTZB+nFuLn+doOOKddaQS9JfqtNoFCO2LCvA3w== + dependencies: + "@npmcli/promise-spawn" "^3.0.0" + lru-cache "^7.4.4" + mkdirp "^1.0.4" + npm-pick-manifest "^7.0.0" + proc-log "^2.0.0" + promise-inflight "^1.0.1" + promise-retry "^2.0.1" + semver "^7.3.5" + which "^2.0.2" + +"@npmcli/installed-package-contents@^1.0.7": + version "1.0.7" + resolved "https://registry.yarnpkg.com/@npmcli/installed-package-contents/-/installed-package-contents-1.0.7.tgz#ab7408c6147911b970a8abe261ce512232a3f4fa" + integrity sha512-9rufe0wnJusCQoLpV9ZPKIVP55itrM5BxOXs10DmdbRfgWtHy1LDyskbwRnBghuB0PrF7pNPOqREVtpz4HqzKw== + dependencies: + npm-bundled "^1.1.1" + npm-normalize-package-bin "^1.0.1" + +"@npmcli/map-workspaces@^2.0.3": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@npmcli/map-workspaces/-/map-workspaces-2.0.4.tgz#9e5e8ab655215a262aefabf139782b894e0504fc" + integrity sha512-bMo0aAfwhVwqoVM5UzX1DJnlvVvzDCHae821jv48L1EsrYwfOZChlqWYXEtto/+BkBXetPbEWgau++/brh4oVg== + dependencies: + "@npmcli/name-from-folder" "^1.0.1" + glob "^8.0.1" + minimatch "^5.0.1" + read-package-json-fast "^2.0.3" + +"@npmcli/metavuln-calculator@^3.0.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@npmcli/metavuln-calculator/-/metavuln-calculator-3.1.1.tgz#9359bd72b400f8353f6a28a25c8457b562602622" + integrity sha512-n69ygIaqAedecLeVH3KnO39M6ZHiJ2dEv5A7DGvcqCB8q17BGUgW8QaanIkbWUo2aYGZqJaOORTLAlIvKjNDKA== + dependencies: + cacache "^16.0.0" + json-parse-even-better-errors "^2.3.1" + pacote "^13.0.3" + semver "^7.3.5" + +"@npmcli/move-file@^2.0.0": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@npmcli/move-file/-/move-file-2.0.1.tgz#26f6bdc379d87f75e55739bab89db525b06100e4" + integrity sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ== + dependencies: + mkdirp "^1.0.4" + rimraf "^3.0.2" + +"@npmcli/name-from-folder@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@npmcli/name-from-folder/-/name-from-folder-1.0.1.tgz#77ecd0a4fcb772ba6fe927e2e2e155fbec2e6b1a" + integrity sha512-qq3oEfcLFwNfEYOQ8HLimRGKlD8WSeGEdtUa7hmzpR8Sa7haL1KVQrvgO6wqMjhWFFVjgtrh1gIxDz+P8sjUaA== + +"@npmcli/node-gyp@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@npmcli/node-gyp/-/node-gyp-2.0.0.tgz#8c20e53e34e9078d18815c1d2dda6f2420d75e35" + integrity sha512-doNI35wIe3bBaEgrlPfdJPaCpUR89pJWep4Hq3aRdh6gKazIVWfs0jHttvSSoq47ZXgC7h73kDsUl8AoIQUB+A== + +"@npmcli/package-json@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@npmcli/package-json/-/package-json-2.0.0.tgz#3bbcf4677e21055adbe673d9f08c9f9cde942e4a" + integrity sha512-42jnZ6yl16GzjWSH7vtrmWyJDGVa/LXPdpN2rcUWolFjc9ON2N3uz0qdBbQACfmhuJZ2lbKYtmK5qx68ZPLHMA== + dependencies: + json-parse-even-better-errors "^2.3.1" + +"@npmcli/promise-spawn@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@npmcli/promise-spawn/-/promise-spawn-3.0.0.tgz#53283b5f18f855c6925f23c24e67c911501ef573" + integrity sha512-s9SgS+p3a9Eohe68cSI3fi+hpcZUmXq5P7w0kMlAsWVtR7XbK3ptkZqKT2cK1zLDObJ3sR+8P59sJE0w/KTL1g== + dependencies: + infer-owner "^1.0.4" + +"@npmcli/run-script@^4.1.0", "@npmcli/run-script@^4.1.3", "@npmcli/run-script@^4.1.7": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-4.2.1.tgz#c07c5c71bc1c70a5f2a06b0d4da976641609b946" + integrity sha512-7dqywvVudPSrRCW5nTHpHgeWnbBtz8cFkOuKrecm6ih+oO9ciydhWt6OF7HlqupRRmB8Q/gECVdB9LMfToJbRg== + dependencies: + "@npmcli/node-gyp" "^2.0.0" + "@npmcli/promise-spawn" "^3.0.0" + node-gyp "^9.0.0" + read-package-json-fast "^2.0.3" + which "^2.0.2" + +"@nrwl/cli@14.8.6": + version "14.8.6" + resolved "https://registry.yarnpkg.com/@nrwl/cli/-/cli-14.8.6.tgz#56fcfae492a159efe978b7d51dd51f8a18cda0af" + integrity sha512-R4udxekMd4jhoRPEksJu+224DocOIrAqenFo0D2R36epE5FaCnZQX7xg+b3TjRbdS10e426i4D9LuXdQmP5jJg== + dependencies: + nx "14.8.6" + +"@nrwl/cli@15.2.4": + version "15.2.4" + resolved "https://registry.yarnpkg.com/@nrwl/cli/-/cli-15.2.4.tgz#7cf18d474c428d6b4aaf7b511c298369c47de39a" + integrity sha512-Urhkzj/hzhTlJqOHFZyibYGjvzHvSQhkjN3keHiYCNEOaAGp9DPF+oC5cYrPcqWbu3ZkldDWTk7aVBbeqwDWZQ== + dependencies: + nx "15.2.4" + +"@nrwl/devkit@>=14.8.6 < 16": + version "15.2.4" + resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-15.2.4.tgz#ffcb69f462df19d3d282cf25bf346926ee23f141" + integrity sha512-5JZWB4ydnu+NKNIfj958nML8AWwhareQ+Q1hLXoOIS/7brqfALNP3y/Ef1ljrLIo1f3xc484TPclqwSH7aRdvQ== + dependencies: + "@phenomnomnominal/tsquery" "4.1.1" + ejs "^3.1.7" + ignore "^5.0.4" + semver "7.3.4" + tslib "^2.3.0" + +"@nrwl/tao@14.8.6": + version "14.8.6" + resolved "https://registry.yarnpkg.com/@nrwl/tao/-/tao-14.8.6.tgz#5055af46942744fae0b88beedbf2ad016ab53b2b" + integrity sha512-CByqrsfSJeonOd7TLAHP8bRYNWgDksxA7j+yncSzgQnFLEbZdJGG/AqqIovx8g6g2v0JS+nRgGC+w5UPf04UrQ== + dependencies: + nx "14.8.6" + +"@nrwl/tao@15.2.4": + version "15.2.4" + resolved "https://registry.yarnpkg.com/@nrwl/tao/-/tao-15.2.4.tgz#c335e0774e5b7ee26bb3b257a436fe154693d619" + integrity sha512-ebGJCkg84yfptuNhGMnIrgHvnknJkeyxWLqRQ7AlMXTzxXOfMS+whjVImM9XjfVYVpBVFWc5QBU5gaKQtzLHmA== + dependencies: + nx "15.2.4" + +"@octokit/auth-token@^3.0.0": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-3.0.2.tgz#a0fc8de149fd15876e1ac78f6525c1c5ab48435f" + integrity sha512-pq7CwIMV1kmzkFTimdwjAINCXKTajZErLB4wMLYapR2nuB/Jpr66+05wOTZMSCBXP6n4DdDWT2W19Bm17vU69Q== + dependencies: + "@octokit/types" "^8.0.0" + +"@octokit/core@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@octokit/core/-/core-4.1.0.tgz#b6b03a478f1716de92b3f4ec4fd64d05ba5a9251" + integrity sha512-Czz/59VefU+kKDy+ZfDwtOIYIkFjExOKf+HA92aiTZJ6EfWpFzYQWw0l54ji8bVmyhc+mGaLUbSUmXazG7z5OQ== + dependencies: + "@octokit/auth-token" "^3.0.0" + "@octokit/graphql" "^5.0.0" + "@octokit/request" "^6.0.0" + "@octokit/request-error" "^3.0.0" + "@octokit/types" "^8.0.0" + before-after-hook "^2.2.0" + universal-user-agent "^6.0.0" + +"@octokit/endpoint@^7.0.0": + version "7.0.3" + resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-7.0.3.tgz#0b96035673a9e3bedf8bab8f7335de424a2147ed" + integrity sha512-57gRlb28bwTsdNXq+O3JTQ7ERmBTuik9+LelgcLIVfYwf235VHbN9QNo4kXExtp/h8T423cR5iJThKtFYxC7Lw== + dependencies: + "@octokit/types" "^8.0.0" + is-plain-object "^5.0.0" + universal-user-agent "^6.0.0" + +"@octokit/graphql@^5.0.0": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-5.0.4.tgz#519dd5c05123868276f3ae4e50ad565ed7dff8c8" + integrity sha512-amO1M5QUQgYQo09aStR/XO7KAl13xpigcy/kI8/N1PnZYSS69fgte+xA4+c2DISKqUZfsh0wwjc2FaCt99L41A== + dependencies: + "@octokit/request" "^6.0.0" + "@octokit/types" "^8.0.0" + universal-user-agent "^6.0.0" + +"@octokit/openapi-types@^14.0.0": + version "14.0.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-14.0.0.tgz#949c5019028c93f189abbc2fb42f333290f7134a" + integrity sha512-HNWisMYlR8VCnNurDU6os2ikx0s0VyEjDYHNS/h4cgb8DeOxQ0n72HyinUtdDVxJhFy3FWLGl0DJhfEWk3P5Iw== + +"@octokit/plugin-enterprise-rest@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-6.0.1.tgz#e07896739618dab8da7d4077c658003775f95437" + integrity sha512-93uGjlhUD+iNg1iWhUENAtJata6w5nE+V4urXOAlIXdco6xNZtUSfYY8dzp3Udy74aqO/B5UZL80x/YMa5PKRw== + +"@octokit/plugin-paginate-rest@^5.0.0": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-5.0.1.tgz#93d7e74f1f69d68ba554fa6b888c2a9cf1f99a83" + integrity sha512-7A+rEkS70pH36Z6JivSlR7Zqepz3KVucEFVDnSrgHXzG7WLAzYwcHZbKdfTXHwuTHbkT1vKvz7dHl1+HNf6Qyw== + dependencies: + "@octokit/types" "^8.0.0" + +"@octokit/plugin-request-log@^1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz#5e50ed7083a613816b1e4a28aeec5fb7f1462e85" + integrity sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA== + +"@octokit/plugin-rest-endpoint-methods@^6.7.0": + version "6.7.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.7.0.tgz#2f6f17f25b6babbc8b41d2bb0a95a8839672ce7c" + integrity sha512-orxQ0fAHA7IpYhG2flD2AygztPlGYNAdlzYz8yrD8NDgelPfOYoRPROfEyIe035PlxvbYrgkfUZIhSBKju/Cvw== + dependencies: + "@octokit/types" "^8.0.0" + deprecation "^2.3.1" + +"@octokit/request-error@^3.0.0": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-3.0.2.tgz#f74c0f163d19463b87528efe877216c41d6deb0a" + integrity sha512-WMNOFYrSaX8zXWoJg9u/pKgWPo94JXilMLb2VManNOby9EZxrQaBe/QSC4a1TzpAlpxofg2X/jMnCyZgL6y7eg== + dependencies: + "@octokit/types" "^8.0.0" + deprecation "^2.0.0" + once "^1.4.0" + +"@octokit/request@^6.0.0": + version "6.2.2" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-6.2.2.tgz#a2ba5ac22bddd5dcb3f539b618faa05115c5a255" + integrity sha512-6VDqgj0HMc2FUX2awIs+sM6OwLgwHvAi4KCK3mT2H2IKRt6oH9d0fej5LluF5mck1lRR/rFWN0YIDSYXYSylbw== + dependencies: + "@octokit/endpoint" "^7.0.0" + "@octokit/request-error" "^3.0.0" + "@octokit/types" "^8.0.0" + is-plain-object "^5.0.0" + node-fetch "^2.6.7" + universal-user-agent "^6.0.0" + +"@octokit/rest@^19.0.3": + version "19.0.5" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-19.0.5.tgz#4dbde8ae69b27dca04b5f1d8119d282575818f6c" + integrity sha512-+4qdrUFq2lk7Va+Qff3ofREQWGBeoTKNqlJO+FGjFP35ZahP+nBenhZiGdu8USSgmq4Ky3IJ/i4u0xbLqHaeow== + dependencies: + "@octokit/core" "^4.1.0" + "@octokit/plugin-paginate-rest" "^5.0.0" + "@octokit/plugin-request-log" "^1.0.4" + "@octokit/plugin-rest-endpoint-methods" "^6.7.0" + +"@octokit/types@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-8.0.0.tgz#93f0b865786c4153f0f6924da067fe0bb7426a9f" + integrity sha512-65/TPpOJP1i3K4lBJMnWqPUJ6zuOtzhtagDvydAWbEXpbFYA0oMKKyLb95NFZZP0lSh/4b6K+DQlzvYQJQQePg== + dependencies: + "@octokit/openapi-types" "^14.0.0" + +"@parcel/watcher@2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@parcel/watcher/-/watcher-2.0.4.tgz#f300fef4cc38008ff4b8c29d92588eced3ce014b" + integrity sha512-cTDi+FUDBIUOBKEtj+nhiJ71AZVlkAsQFuGQTun5tV9mwQBQgZvhCzG+URPQc8myeN32yRVZEfVAPCs1RW+Jvg== + dependencies: + node-addon-api "^3.2.1" + node-gyp-build "^4.3.0" + +"@phenomnomnominal/tsquery@4.1.1": + version "4.1.1" + resolved "https://registry.yarnpkg.com/@phenomnomnominal/tsquery/-/tsquery-4.1.1.tgz#42971b83590e9d853d024ddb04a18085a36518df" + integrity sha512-jjMmK1tnZbm1Jq5a7fBliM4gQwjxMU7TFoRNwIyzwlO+eHPRCFv/Nv+H/Gi1jc3WR7QURG8D5d0Tn12YGrUqBQ== + dependencies: + esquery "^1.0.1" + +"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" + integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== + +"@protobufjs/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" + integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== + +"@protobufjs/codegen@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" + integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== + +"@protobufjs/eventemitter@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" + integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== + +"@protobufjs/fetch@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" + integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== + dependencies: + "@protobufjs/aspromise" "^1.1.1" + "@protobufjs/inquire" "^1.1.0" + +"@protobufjs/float@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" + integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== + +"@protobufjs/inquire@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" + integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== + +"@protobufjs/path@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" + integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== + +"@protobufjs/pool@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" + integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== + +"@protobufjs/utf8@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" + integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== + +"@protobufs/cosmos@^0.0.11": + version "0.0.11" + resolved "https://registry.yarnpkg.com/@protobufs/cosmos/-/cosmos-0.0.11.tgz#68a1feaa044916a0f1fdf6a2922f08a6811e796f" + integrity sha512-r9XQikxQ3qaWVJ4EYePP7r/QL/lEEpgSeHiD0U5t4bOXux5gIWrz3AMLe5PIdFxBwkeqkF21Vz4JnVd3/XdC7Q== + dependencies: + "@protobufs/cosmos_proto" "^0.0.10" + "@protobufs/gogoproto" "^0.0.10" + "@protobufs/google" "^0.0.10" + "@protobufs/tendermint" "^0.0.10" + +"@protobufs/cosmos_proto@^0.0.10": + version "0.0.10" + resolved "https://registry.yarnpkg.com/@protobufs/cosmos_proto/-/cosmos_proto-0.0.10.tgz#622726ee227f220f608df180f938e5d8ebb1534a" + integrity sha512-4nMopXxN23udy1HEe+vS49zD9dxrA7i0E3n15QUz1x0tbrowYLHzJKeyCUNlsh5PKpEIXGxHXpPZWXs7vVCwUw== + dependencies: + "@protobufs/google" "^0.0.10" + +"@protobufs/gogoproto@^0.0.10": + version "0.0.10" + resolved "https://registry.yarnpkg.com/@protobufs/gogoproto/-/gogoproto-0.0.10.tgz#0181e17142c800b60c7ca5f92c76a614d86c5c54" + integrity sha512-u3eK1aSO3KOuX4RVFpqKPTaT/WLV50GFLuIC3slVGfD7Z1CfZ5ivHbFYUib96gihu1Mq2OZpNVj3dNws9YsVoQ== + dependencies: + "@protobufs/google" "^0.0.10" + +"@protobufs/google@^0.0.10": + version "0.0.10" + resolved "https://registry.yarnpkg.com/@protobufs/google/-/google-0.0.10.tgz#820f741b0c53f688550c74c7ddb25a5ee131a6bf" + integrity sha512-3yo+liabFM1519smwwfzh1C535CntXVsS7zT98xmo21tZUX7vxeFpQDMx38EzMGYSy/Reo8wEMWJUHqZzYsCUw== + +"@protobufs/tendermint@^0.0.10": + version "0.0.10" + resolved "https://registry.yarnpkg.com/@protobufs/tendermint/-/tendermint-0.0.10.tgz#816b27410afcecd8b6d403df149f3c2b9b80655e" + integrity sha512-hAAMLFhKdAovslKeWnLTp2gGn5bxSTDVcQLKs4C4cC91R/KfHOh+Klt4PqSGUv/APINAmREzsX2LDUbIQ2dCpg== + dependencies: + "@protobufs/gogoproto" "^0.0.10" + "@protobufs/google" "^0.0.10" + +"@randlabs/communication-bridge@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@randlabs/communication-bridge/-/communication-bridge-1.0.1.tgz#d1ecfc29157afcbb0ca2d73122d67905eecb5bf3" + integrity sha512-CzS0U8IFfXNK7QaJFE4pjbxDGfPjbXBEsEaCn9FN15F+ouSAEUQkva3Gl66hrkBZOGexKFEWMwUHIDKpZ2hfVg== + +"@randlabs/myalgo-connect@^1.1.2": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@randlabs/myalgo-connect/-/myalgo-connect-1.4.1.tgz#39426fce797611a431907325d365c65bcab4820b" + integrity sha512-vHg/Xu9UCPl1+HELx9fSXTYmrQm5MAy+NiVnBEhW1D+9cdIfISF41VZ1RdRs+6gzux2mK4dIga63gI/s2VhCVA== + dependencies: + "@randlabs/communication-bridge" "1.0.1" + +"@sinclair/typebox@^0.24.1": + version "0.24.51" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.51.tgz#645f33fe4e02defe26f2f5c0410e1c094eac7f5f" + integrity sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA== + +"@sindresorhus/is@^0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd" + integrity sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow== + +"@sinonjs/commons@^1.7.0": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.5.tgz#e280c94c95f206dcfd5aca00a43f2156b758c764" + integrity sha512-rTpCA0wG1wUxglBSFdMMY0oTrKYvgf4fNgv/sXbfCVAdf+FnPBdKJR/7XbpTCwbCrvCbdPYnlWaUUYz4V2fPDA== + dependencies: + type-detect "4.0.8" + +"@sinonjs/fake-timers@^9.1.2": + version "9.1.2" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz#4eaab737fab77332ab132d396a3c0d364bd0ea8c" + integrity sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw== + dependencies: + "@sinonjs/commons" "^1.7.0" + +"@solana/buffer-layout@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@solana/buffer-layout/-/buffer-layout-4.0.0.tgz#75b1b11adc487234821c81dfae3119b73a5fd734" + integrity sha512-lR0EMP2HC3+Mxwd4YcnZb0smnaDw7Bl2IQWZiTevRH5ZZBZn6VRWn3/92E3qdU4SSImJkA6IDHawOHAnx/qUvQ== + dependencies: + buffer "~6.0.3" + +"@solana/wallet-adapter-base@^0.9.2": + version "0.9.18" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-base/-/wallet-adapter-base-0.9.18.tgz#9365304a76977b4446a1167b240d588f2c5448d5" + integrity sha512-5HQFytLmb64j1Nzc6dwddZx+IUePN/PYqVMyf/ok7fN3z8Vw3EIFS8b+RFfBpj4HWbc2kqv5fpnLlaAH7q67pA== + dependencies: + eventemitter3 "^4.0.0" + +"@solana/web3.js@^1.36.0": + version "1.66.2" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.66.2.tgz#80b43c5868b846124fe3ebac7d3943930c3fa60c" + integrity sha512-RyaHMR2jGmaesnYP045VLeBGfR/gAW3cvZHzMFGg7bkO+WOYOYp1nEllf0/la4U4qsYGKCsO9eEevR5fhHiVHg== + dependencies: + "@babel/runtime" "^7.12.5" + "@noble/ed25519" "^1.7.0" + "@noble/hashes" "^1.1.2" + "@noble/secp256k1" "^1.6.3" + "@solana/buffer-layout" "^4.0.0" + bigint-buffer "^1.1.5" + bn.js "^5.0.0" + borsh "^0.7.0" + bs58 "^4.0.1" + buffer "6.0.1" + fast-stable-stringify "^1.0.0" + jayson "^3.4.4" + node-fetch "2" + rpc-websockets "^7.5.0" + superstruct "^0.14.2" + +"@supercharge/promise-pool@^2.1.0": + version "2.3.2" + resolved "https://registry.yarnpkg.com/@supercharge/promise-pool/-/promise-pool-2.3.2.tgz#6366894a7e7bc699bb65e58d8c828113729cf481" + integrity sha512-f5+C7zv+QQivcUO1FH5lXi7GcuJ3CFuJF3Eg06iArhUs5ma0szCLEQwIY4+VQyh7m/RLVZdzvr4E4ZDnLe9MNg== + +"@tootallnate/once@2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" + integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== + +"@tsconfig/node10@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" + integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" + integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== + +"@types/babel__core@^7.1.14": + version "7.1.20" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.20.tgz#e168cdd612c92a2d335029ed62ac94c95b362359" + integrity sha512-PVb6Bg2QuscZ30FvOU7z4guG6c926D9YRvOxEaelzndpMsvP+YM74Q/dAFASpg2l6+XLalxSGxcq/lrgYWZtyQ== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7" + integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.4.1" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" + integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.18.2" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.2.tgz#235bf339d17185bdec25e024ca19cce257cc7309" + integrity sha512-FcFaxOr2V5KZCviw1TnutEMVUVsGt4D2hP1TAfXZAMKuHYW3xQhe3jTxNPWutgCJ3/X1c5yX8ZoGVEItxKbwBg== + dependencies: + "@babel/types" "^7.3.0" + +"@types/cli-progress@^3.9.2": + version "3.11.0" + resolved "https://registry.yarnpkg.com/@types/cli-progress/-/cli-progress-3.11.0.tgz#ec79df99b26757c3d1c7170af8422e0fc95eef7e" + integrity sha512-XhXhBv1R/q2ahF3BM7qT5HLzJNlIL0wbcGyZVjqOTqAybAnsLisd7gy1UCyIqpL+5Iv6XhlSyzjLCnI2sIdbCg== + dependencies: + "@types/node" "*" + +"@types/connect@^3.4.33": + version "3.4.35" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.35.tgz#5fcf6ae445e4021d1fc2219a4873cc73a3bb2ad1" + integrity sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ== + dependencies: + "@types/node" "*" + +"@types/decompress@*": + version "4.2.4" + resolved "https://registry.yarnpkg.com/@types/decompress/-/decompress-4.2.4.tgz#dd2715d3ac1f566d03e6e302d1a26ffab59f8c5c" + integrity sha512-/C8kTMRTNiNuWGl5nEyKbPiMv6HA+0RbEXzFhFBEzASM6+oa4tJro9b8nj7eRlOFfuLdzUU+DS/GPDlvvzMOhA== + dependencies: + "@types/node" "*" + +"@types/download@^8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@types/download/-/download-8.0.1.tgz#9653e0deb52f1b47f659e8e8be1651c8515bc0a7" + integrity sha512-t5DjMD6Y1DxjXtEHl7Kt+nQn9rOmVLYD8p4Swrcc5QpgyqyqR2gXTIK6RwwMnNeFJ+ZIiIW789fQKzCrK7AOFA== + dependencies: + "@types/decompress" "*" + "@types/got" "^8" + "@types/node" "*" + +"@types/fs-extra@^9.0.13": + version "9.0.13" + resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-9.0.13.tgz#7594fbae04fe7f1918ce8b3d213f74ff44ac1f45" + integrity sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA== + dependencies: + "@types/node" "*" + +"@types/got@^8": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@types/got/-/got-8.3.6.tgz#1d8762605818ae8b1ae320f9d7ca5247b6767da7" + integrity sha512-nvLlj+831dhdm4LR2Ly+HTpdLyBaMynoOr6wpIxS19d/bPeHQxFU5XQ6Gp6ohBpxvCWZM1uHQIC2+ySRH1rGrQ== + dependencies: + "@types/node" "*" + +"@types/graceful-fs@^4.1.3": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" + integrity sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw== + dependencies: + "@types/node" "*" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" + integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== + +"@types/istanbul-lib-report@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" + integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/jest@^28.1.3", "@types/jest@^28.1.7": + version "28.1.8" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-28.1.8.tgz#6936409f3c9724ea431efd412ea0238a0f03b09b" + integrity sha512-8TJkV++s7B6XqnDrzR1m/TT0A0h948Pnl/097veySPN67VRAgQ4gZ7n2KfJo2rVq6njQjdxU3GCCyDvAeuHoiw== + dependencies: + expect "^28.0.0" + pretty-format "^28.0.0" + +"@types/json-schema@^7.0.9": + version "7.0.11" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" + integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== + +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== + +"@types/jsonfile@^6.0.1": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@types/jsonfile/-/jsonfile-6.1.0.tgz#c413d113ae28619f418b8a6ce7a1dec29e8f8a1c" + integrity sha512-zQPywzif9EycCkvECjYT9dbbttT0dkk657zcLb/803ZOXHsBA963jzEPF/Jnh1zOdBbgFJvUE8kcvZverAoK1w== + dependencies: + "@types/node" "*" + +"@types/long@^4.0.1": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" + integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== + +"@types/minimatch@^3.0.3": + version "3.0.5" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" + integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== + +"@types/minimist@^1.2.0": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" + integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== + +"@types/node-fetch@^2.6.2": + version "2.6.2" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.2.tgz#d1a9c5fd049d9415dce61571557104dec3ec81da" + integrity sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A== + dependencies: + "@types/node" "*" + form-data "^3.0.0" + +"@types/node@*", "@types/node@>=13.7.0", "@types/node@^18.11.9": + version "18.11.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4" + integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg== + +"@types/node@10.12.18": + version "10.12.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" + integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== + +"@types/node@11.11.6": + version "11.11.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a" + integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ== + +"@types/node@^12.12.54": + version "12.20.55" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" + integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== + +"@types/node@^13.7.0": + version "13.13.52" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.52.tgz#03c13be70b9031baaed79481c0c0cfb0045e53f7" + integrity sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ== + +"@types/node@^16.9.2": + version "16.18.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.3.tgz#d7f7ba828ad9e540270f01ce00d391c54e6e0abc" + integrity sha512-jh6m0QUhIRcZpNv7Z/rpN+ZWXOicUUQbSoWks7Htkbb9IjFQj4kzcX/xFCkjstCj5flMsN8FiSvt+q+Tcs4Llg== + +"@types/normalize-package-data@^2.4.0": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" + integrity sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw== + +"@types/object-hash@^1.3.0": + version "1.3.4" + resolved "https://registry.yarnpkg.com/@types/object-hash/-/object-hash-1.3.4.tgz#079ba142be65833293673254831b5e3e847fe58b" + integrity sha512-xFdpkAkikBgqBdG9vIlsqffDV8GpvnPEzs0IUtr1v3BEB97ijsFQ4RXVbUZwjFThhB4MDSTUfvmxUD5PGx0wXA== + +"@types/object-hash@^2.2.1": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@types/object-hash/-/object-hash-2.2.1.tgz#67c169f8f033e0b62abbf81df2d00f4598d540b9" + integrity sha512-i/rtaJFCsPljrZvP/akBqEwUP2y5cZLOmvO+JaYnz01aPknrQ+hB5MRcO7iqCUsFaYfTG8kGfKUyboA07xeDHQ== + +"@types/parse-json@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" + integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== + +"@types/prettier@^2.1.5": + version "2.7.1" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.1.tgz#dfd20e2dc35f027cdd6c1908e80a5ddc7499670e" + integrity sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow== + +"@types/prompts@^2.0.14": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@types/prompts/-/prompts-2.4.1.tgz#d47adcb608a0afcd48121ff7c75244694a3a04c5" + integrity sha512-1Mqzhzi9W5KlooNE4o0JwSXGUDeQXKldbGn9NO4tpxwZbHXYd+WcKpCksG2lbhH7U9I9LigfsdVsP2QAY0lNPA== + dependencies: + "@types/node" "*" + +"@types/qs@^6.9.7": + version "6.9.7" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.7.tgz#63bb7d067db107cc1e457c303bc25d511febf6cb" + integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw== + +"@types/seedrandom@^3.0.2": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-3.0.2.tgz#7f30db28221067a90b02e73ffd46b6685b18df1a" + integrity sha512-YPLqEOo0/X8JU3rdiq+RgUKtQhQtrppE766y7vMTu8dGML7TVtZNiiiaC/hhU9Zqw9UYopXxhuWWENclMVBwKQ== + +"@types/semver@^7.3.12", "@types/semver@^7.3.9": + version "7.3.13" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" + integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== + +"@types/stack-utils@^2.0.0": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" + integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== + +"@types/ws@^7.4.4": + version "7.4.7" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.7.tgz#f7c390a36f7a0679aa69de2d501319f4f8d9b702" + integrity sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww== + dependencies: + "@types/node" "*" + +"@types/yargs-parser@*": + version "21.0.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" + integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== + +"@types/yargs@^17.0.8": + version "17.0.13" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.13.tgz#34cced675ca1b1d51fcf4d34c3c6f0fa142a5c76" + integrity sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg== + dependencies: + "@types/yargs-parser" "*" + +"@types/yauzl@^2.9.1": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.10.0.tgz#b3248295276cf8c6f153ebe6a9aba0c988cb2599" + integrity sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw== + dependencies: + "@types/node" "*" + +"@typescript-eslint/eslint-plugin@^5.42.1": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.45.0.tgz#ffa505cf961d4844d38cfa19dcec4973a6039e41" + integrity sha512-CXXHNlf0oL+Yg021cxgOdMHNTXD17rHkq7iW6RFHoybdFgQBjU3yIXhhcPpGwr1CjZlo6ET8C6tzX5juQoXeGA== + dependencies: + "@typescript-eslint/scope-manager" "5.45.0" + "@typescript-eslint/type-utils" "5.45.0" + "@typescript-eslint/utils" "5.45.0" + debug "^4.3.4" + ignore "^5.2.0" + natural-compare-lite "^1.4.0" + regexpp "^3.2.0" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/parser@^5.42.1": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.45.0.tgz#b18a5f6b3cf1c2b3e399e9d2df4be40d6b0ddd0e" + integrity sha512-brvs/WSM4fKUmF5Ot/gEve6qYiCMjm6w4HkHPfS6ZNmxTS0m0iNN4yOChImaCkqc1hRwFGqUyanMXuGal6oyyQ== + dependencies: + "@typescript-eslint/scope-manager" "5.45.0" + "@typescript-eslint/types" "5.45.0" + "@typescript-eslint/typescript-estree" "5.45.0" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.45.0.tgz#7a4ac1bfa9544bff3f620ab85947945938319a96" + integrity sha512-noDMjr87Arp/PuVrtvN3dXiJstQR1+XlQ4R1EvzG+NMgXi8CuMCXpb8JqNtFHKceVSQ985BZhfRdowJzbv4yKw== + dependencies: + "@typescript-eslint/types" "5.45.0" + "@typescript-eslint/visitor-keys" "5.45.0" + +"@typescript-eslint/type-utils@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.45.0.tgz#aefbc954c40878fcebeabfb77d20d84a3da3a8b2" + integrity sha512-DY7BXVFSIGRGFZ574hTEyLPRiQIvI/9oGcN8t1A7f6zIs6ftbrU0nhyV26ZW//6f85avkwrLag424n+fkuoJ1Q== + dependencies: + "@typescript-eslint/typescript-estree" "5.45.0" + "@typescript-eslint/utils" "5.45.0" + debug "^4.3.4" + tsutils "^3.21.0" + +"@typescript-eslint/types@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.45.0.tgz#794760b9037ee4154c09549ef5a96599621109c5" + integrity sha512-QQij+u/vgskA66azc9dCmx+rev79PzX8uDHpsqSjEFtfF2gBUTRCpvYMh2gw2ghkJabNkPlSUCimsyBEQZd1DA== + +"@typescript-eslint/typescript-estree@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.45.0.tgz#f70a0d646d7f38c0dfd6936a5e171a77f1e5291d" + integrity sha512-maRhLGSzqUpFcZgXxg1qc/+H0bT36lHK4APhp0AEUVrpSwXiRAomm/JGjSG+kNUio5kAa3uekCYu/47cnGn5EQ== + dependencies: + "@typescript-eslint/types" "5.45.0" + "@typescript-eslint/visitor-keys" "5.45.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/utils@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.45.0.tgz#9cca2996eee1b8615485a6918a5c763629c7acf5" + integrity sha512-OUg2JvsVI1oIee/SwiejTot2OxwU8a7UfTFMOdlhD2y+Hl6memUSL4s98bpUTo8EpVEr0lmwlU7JSu/p2QpSvA== + dependencies: + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.45.0" + "@typescript-eslint/types" "5.45.0" + "@typescript-eslint/typescript-estree" "5.45.0" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + semver "^7.3.7" + +"@typescript-eslint/visitor-keys@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.45.0.tgz#e0d160e9e7fdb7f8da697a5b78e7a14a22a70528" + integrity sha512-jc6Eccbn2RtQPr1s7th6jJWQHBHI6GBVQkCHoJFQ5UreaKm59Vxw+ynQUPPY2u2Amquc+7tmEoC2G52ApsGNNg== + dependencies: + "@typescript-eslint/types" "5.45.0" + eslint-visitor-keys "^3.3.0" + +"@yarnpkg/lockfile@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + +"@yarnpkg/parsers@^3.0.0-rc.18": + version "3.0.0-rc.31" + resolved "https://registry.yarnpkg.com/@yarnpkg/parsers/-/parsers-3.0.0-rc.31.tgz#fbcce77c3783b2be8a381edf70bea3182e0b8b16" + integrity sha512-7M67TPmTM5OmtoypK0KHV3vIY9z0v4qZ6zF7flH8THLgjGuoA7naop8pEfL9x5vCtid1PDC4A4COrcym4WAZpQ== + dependencies: + js-yaml "^3.10.0" + tslib "^2.4.0" + +"@zkochan/js-yaml@0.0.6": + version "0.0.6" + resolved "https://registry.yarnpkg.com/@zkochan/js-yaml/-/js-yaml-0.0.6.tgz#975f0b306e705e28b8068a07737fa46d3fc04826" + integrity sha512-nzvgl3VfhcELQ8LyVrYOru+UtAy1nrygk2+AGbTm8a5YcO6o8lSjAT+pfg3vJWxIoZKOUhrK6UU7xW/+00kQrg== + dependencies: + argparse "^2.0.1" + +JSONStream@^1.0.4, JSONStream@^1.3.5: + version "1.3.5" + resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" + integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== + dependencies: + jsonparse "^1.2.0" + through ">=2.2.7 <3" + +abbrev@1, abbrev@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + +abstract-level@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/abstract-level/-/abstract-level-1.0.3.tgz#78a67d3d84da55ee15201486ab44c09560070741" + integrity sha512-t6jv+xHy+VYwc4xqZMn2Pa9DjcdzvzZmQGRjTFc8spIbRGHgBrEKbPq+rYXc7CCo0lxgYvSgKVg9qZAhpVQSjA== + dependencies: + buffer "^6.0.3" + catering "^2.1.0" + is-buffer "^2.0.5" + level-supports "^4.0.0" + level-transcoder "^1.0.1" + module-error "^1.0.1" + queue-microtask "^1.2.3" + +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + +acorn@^8.4.1, acorn@^8.8.0: + version "8.8.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" + integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== + +add-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa" + integrity sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ== + +aes-js@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" + integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== + +agent-base@6, agent-base@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +agentkeepalive@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.2.1.tgz#a7975cbb9f83b367f06c90cc51ff28fe7d499717" + integrity sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA== + dependencies: + debug "^4.1.0" + depd "^1.1.2" + humanize-ms "^1.2.1" + +aggregate-error@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" + integrity sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA== + dependencies: + clean-stack "^2.0.0" + indent-string "^4.0.0" + +ajv@^6.10.0, ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ajv@^8.11.0: + version "8.11.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.11.2.tgz#aecb20b50607acf2569b6382167b65a96008bb78" + integrity sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + +algo-msgpack-with-bigint@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/algo-msgpack-with-bigint/-/algo-msgpack-with-bigint-2.1.1.tgz#38bb717220525b3ff42232eefdcd9efb9ad405d6" + integrity sha512-F1tGh056XczEaEAqu7s+hlZUDWwOBT70Eq0lfMpBP2YguSQVyxRbprLq5rELXKQOyOaixTWYhMeMQMzP0U5FoQ== + +algosdk@^1.13.1: + version "1.23.2" + resolved "https://registry.yarnpkg.com/algosdk/-/algosdk-1.23.2.tgz#1fda2b537d832687da64bf708f10a69086f02b43" + integrity sha512-ZDq71Kq+e3bvHxnTi/hWqom2/YHeTrbkxenOOCvPidRQuwkaOQAs92c4fqImdn7+Y+MfLhdtQspBLFR1hQTE4A== + dependencies: + algo-msgpack-with-bigint "^2.1.1" + buffer "^6.0.2" + cross-fetch "^3.1.5" + hi-base32 "^0.5.1" + js-sha256 "^0.9.0" + js-sha3 "^0.8.0" + js-sha512 "^0.8.0" + json-bigint "^1.0.0" + tweetnacl "^1.0.3" + vlq "^2.0.4" + +ansi-colors@^4.1.1: + version "4.1.3" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" + integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== + +ansi-escapes@^4.2.1: + version "4.3.2" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== + dependencies: + type-fest "^0.21.3" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA== + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + +anymatch@^3.0.3, anymatch@~3.1.2: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +"aproba@^1.0.3 || ^2.0.0", aproba@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc" + integrity sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ== + +arbundles@^0.6.21: + version "0.6.22" + resolved "https://registry.yarnpkg.com/arbundles/-/arbundles-0.6.22.tgz#0fd58ec76514f1d6c2db7c5870a6232314f52de6" + integrity sha512-QlSavBHk59mNqgQ6ScxlqaBJlDbSmSrK/uTcF3HojLAZ/4aufTkVTBjl1hSfZ/ZN45oIPgJC05R8SmVARF+8VA== + dependencies: + "@noble/ed25519" "^1.6.1" + "@randlabs/myalgo-connect" "^1.1.2" + "@solana/wallet-adapter-base" "^0.9.2" + algosdk "^1.13.1" + arweave "^1.11.4" + arweave-stream-tx "^1.1.0" + avsc "https://github.com/Bundlr-Network/avsc#csp-fixes" + axios "^0.21.3" + base64url "^3.0.1" + bs58 "^4.0.1" + ethers "^5.5.1" + keccak "^3.0.2" + multistream "^4.1.0" + process "^0.11.10" + secp256k1 "^4.0.2" + tmp-promise "^3.0.2" + +archive-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/archive-type/-/archive-type-4.0.0.tgz#f92e72233056dfc6969472749c267bdb046b1d70" + integrity sha512-zV4Ky0v1F8dBrdYElwTvQhweQ0P7Kwc1aluqJsYtOBP01jXcWCyW2IEfI1YiqsG+Iy7ZR+o5LF1N+PGECBxHWA== + dependencies: + file-type "^4.2.0" + +arconnect@^0.4.2: + version "0.4.2" + resolved "https://registry.yarnpkg.com/arconnect/-/arconnect-0.4.2.tgz#83de7638fb46183e82d7ec7efb5594c5f7cdc806" + integrity sha512-Jkpd4QL3TVqnd3U683gzXmZUVqBUy17DdJDuL/3D9rkysLgX6ymJ2e+sR+xyZF5Rh42CBqDXWNMmCjBXeP7Gbw== + dependencies: + arweave "^1.10.13" + +are-we-there-yet@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz#679df222b278c64f2cdba1175cdc00b0d96164bd" + integrity sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg== + dependencies: + delegates "^1.0.0" + readable-stream "^3.6.0" + +are-we-there-yet@~1.1.2: + version "1.1.7" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz#b15474a932adab4ff8a50d9adfa7e4e926f21146" + integrity sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + +array-differ@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b" + integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== + +array-ify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" + integrity sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng== + +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + +arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== + +arrify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" + integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== + +arweave-stream-tx@^1.1.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/arweave-stream-tx/-/arweave-stream-tx-1.2.1.tgz#be731f05b6aa4fdee78627635734eec05b4804d6" + integrity sha512-xnN9Eop2kRaja/dvbw9Wzrx/TX/NUYCL8yL4hpZXMMrUxg633RUQYCbkfAQsYSvh1GmuAf4+NR6BloufCYBbFA== + dependencies: + exponential-backoff "^3.1.0" + +arweave@^1.10.13, arweave@^1.10.17, arweave@^1.11.4: + version "1.11.6" + resolved "https://registry.yarnpkg.com/arweave/-/arweave-1.11.6.tgz#5afcded201c6f123dd62e5bfae1b72ca793ec7c2" + integrity sha512-D6N6e2z7oZoxFhu/qElLwQ2T8DxZ8xIqDB+Y16KHvZbassIrrS9iALwxLdaFYNInuyElg6i7qotBMcShWbFSTw== + dependencies: + arconnect "^0.4.2" + asn1.js "^5.4.1" + axios "^0.27.2" + base64-js "^1.5.1" + bignumber.js "^9.0.2" + util "^0.12.4" + +asap@^2.0.0: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== + +asn1.js@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" + integrity sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA== + dependencies: + bn.js "^4.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + safer-buffer "^2.1.0" + +async-retry@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.3.3.tgz#0e7f36c04d8478e7a58bdbed80cedf977785f280" + integrity sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw== + dependencies: + retry "0.13.1" + +async@^3.2.3: + version "3.2.4" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c" + integrity sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ== + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + +available-typed-arrays@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" + integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== + +"avsc@https://github.com/Bundlr-Network/avsc#csp-fixes": + version "5.4.7" + resolved "https://github.com/Bundlr-Network/avsc#a730cc8018b79e114b6a3381bbb57760a24c6cef" + +axios@0.21.1: + version "0.21.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" + integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== + dependencies: + follow-redirects "^1.10.0" + +axios@0.25.0, axios@^0.25.0: + version "0.25.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.25.0.tgz#349cfbb31331a9b4453190791760a8d35b093e0a" + integrity sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g== + dependencies: + follow-redirects "^1.14.7" + +axios@^0.21.1, axios@^0.21.2, axios@^0.21.3, axios@^0.21.4: + version "0.21.4" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" + integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== + dependencies: + follow-redirects "^1.14.0" + +axios@^0.24.0: + version "0.24.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.24.0.tgz#804e6fa1e4b9c5288501dd9dff56a7a0940d20d6" + integrity sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA== + dependencies: + follow-redirects "^1.14.4" + +axios@^0.26.1: + version "0.26.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" + integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== + dependencies: + follow-redirects "^1.14.8" + +axios@^0.27.2: + version "0.27.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" + integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== + dependencies: + follow-redirects "^1.14.9" + form-data "^4.0.0" + +axios@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.0.tgz#1cb65bd75162c70e9f8d118a905126c4a201d383" + integrity sha512-zT7wZyNYu3N5Bu0wuZ6QccIf93Qk1eV8LOewxgjOZFd2DenOs98cJ7+Y6703d0wkaXGY6/nZd4EweJaHz9uzQw== + dependencies: + follow-redirects "^1.15.0" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + +babel-jest@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-28.1.3.tgz#c1187258197c099072156a0a121c11ee1e3917d5" + integrity sha512-epUaPOEWMk3cWX0M/sPvCHHCe9fMFAa/9hXEgKP8nFfNl/jlGkE9ucq9NqkZGXLDduCJYS0UvSlPUwC0S+rH6Q== + dependencies: + "@jest/transform" "^28.1.3" + "@types/babel__core" "^7.1.14" + babel-plugin-istanbul "^6.1.1" + babel-preset-jest "^28.1.3" + chalk "^4.0.0" + graceful-fs "^4.2.9" + slash "^3.0.0" + +babel-plugin-istanbul@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" + integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@istanbuljs/load-nyc-config" "^1.0.0" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-instrument "^5.0.4" + test-exclude "^6.0.0" + +babel-plugin-jest-hoist@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-28.1.3.tgz#1952c4d0ea50f2d6d794353762278d1d8cca3fbe" + integrity sha512-Ys3tUKAmfnkRUpPdpa98eYrAR0nV+sSFUZZEGuQ2EbFd1y4SOLtD5QDNHAq+bb9a+bbXvYQC4b+ID/THIMcU6Q== + dependencies: + "@babel/template" "^7.3.3" + "@babel/types" "^7.3.3" + "@types/babel__core" "^7.1.14" + "@types/babel__traverse" "^7.0.6" + +babel-preset-current-node-syntax@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" + integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== + dependencies: + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-bigint" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.8.3" + "@babel/plugin-syntax-import-meta" "^7.8.3" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.8.3" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-top-level-await" "^7.8.3" + +babel-preset-jest@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-28.1.3.tgz#5dfc20b99abed5db994406c2b9ab94c73aaa419d" + integrity sha512-L+fupJvlWAHbQfn74coNX3zf60LXMJsezNvvx8eIh7iOR1luJ1poxYgQk1F8PYtNq/6QODDHCqsSnTFSWC491A== + dependencies: + babel-plugin-jest-hoist "^28.1.3" + babel-preset-current-node-syntax "^1.0.0" + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +base-x@^3.0.2: + version "3.0.9" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" + integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== + dependencies: + safe-buffer "^5.0.1" + +base64-js@^1.0.2, base64-js@^1.3.0, base64-js@^1.3.1, base64-js@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +base64url@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/base64url/-/base64url-3.0.1.tgz#6399d572e2bc3f90a9a8b22d5dbb0a32d33f788d" + integrity sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A== + +bech32@1.1.4, bech32@^1.1.3, bech32@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" + integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== + +bech32@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/bech32/-/bech32-2.0.0.tgz#078d3686535075c8c79709f054b1b226a133b355" + integrity sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg== + +before-after-hook@^2.2.0: + version "2.2.3" + resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.3.tgz#c51e809c81a4e354084422b9b26bad88249c517c" + integrity sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ== + +big-integer@^1.6.48: + version "1.6.51" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686" + integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg== + +bigint-buffer@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/bigint-buffer/-/bigint-buffer-1.1.5.tgz#d038f31c8e4534c1f8d0015209bf34b4fa6dd442" + integrity sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA== + dependencies: + bindings "^1.3.0" + +bignumber.js@9.0.2: + version "9.0.2" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.2.tgz#71c6c6bed38de64e24a65ebe16cfcf23ae693673" + integrity sha512-GAcQvbpsM0pUb0zw1EI0KhQEZ+lRwR5fYaAp3vPOYuP7aDvGy6cVN6XHLauvF8SOga2y0dcLcjt3iQDTSEliyw== + +bignumber.js@^9.0.0, bignumber.js@^9.0.1, bignumber.js@^9.0.2, bignumber.js@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.0.tgz#8d340146107fe3a6cb8d40699643c302e8773b62" + integrity sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A== + +bin-links@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-3.0.3.tgz#3842711ef3db2cd9f16a5f404a996a12db355a6e" + integrity sha512-zKdnMPWEdh4F5INR07/eBrodC7QrF5JKvqskjz/ZZRXg5YSAZIbn8zGhbhUrElzHBZ2fvEQdOU59RHcTG3GiwA== + dependencies: + cmd-shim "^5.0.0" + mkdirp-infer-owner "^2.0.0" + npm-normalize-package-bin "^2.0.0" + read-cmd-shim "^3.0.0" + rimraf "^3.0.0" + write-file-atomic "^4.0.0" + +binary-extensions@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + +bindings@^1.3.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + +bintrees@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bintrees/-/bintrees-1.0.2.tgz#49f896d6e858a4a499df85c38fb399b9aff840f8" + integrity sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw== + +bip32@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/bip32/-/bip32-2.0.6.tgz#6a81d9f98c4cd57d05150c60d8f9e75121635134" + integrity sha512-HpV5OMLLGTjSVblmrtYRfFFKuQB+GArM0+XP8HGWfJ5vxYBqo+DesvJwOdC2WJ3bCkZShGf0QIfoIpeomVzVdA== + dependencies: + "@types/node" "10.12.18" + bs58check "^2.1.1" + create-hash "^1.2.0" + create-hmac "^1.1.7" + tiny-secp256k1 "^1.1.3" + typeforce "^1.11.5" + wif "^2.0.6" + +bip39-light@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/bip39-light/-/bip39-light-1.0.7.tgz#06a72f251b89389a136d3f177f29b03342adc5ba" + integrity sha512-WDTmLRQUsiioBdTs9BmSEmkJza+8xfJmptsNJjxnoq3EydSa/ZBXT6rm66KoT3PJIRYMnhSKNR7S9YL1l7R40Q== + dependencies: + create-hash "^1.1.0" + pbkdf2 "^3.0.9" + +bip39@3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.0.2.tgz#2baf42ff3071fc9ddd5103de92e8f80d9257ee32" + integrity sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ== + dependencies: + "@types/node" "11.11.6" + create-hash "^1.1.0" + pbkdf2 "^3.0.9" + randombytes "^2.0.1" + +bip39@^3.0.2, bip39@^3.0.3: + version "3.0.4" + resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.0.4.tgz#5b11fed966840b5e1b8539f0f54ab6392969b2a0" + integrity sha512-YZKQlb752TrUWqHWj7XAwCSjYEgGAk+/Aas3V7NyjQeZYsztO8JnQUaCWhcnL4T+jL8nvB8typ2jRPzTlgugNw== + dependencies: + "@types/node" "11.11.6" + create-hash "^1.1.0" + pbkdf2 "^3.0.9" + randombytes "^2.0.1" + +bl@^1.0.0: + version "1.2.3" + resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.3.tgz#1e8dd80142eac80d7158c9dccc047fb620e035e7" + integrity sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww== + dependencies: + readable-stream "^2.3.5" + safe-buffer "^5.1.1" + +bl@^4.0.3, bl@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" + integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== + dependencies: + buffer "^5.5.0" + inherits "^2.0.4" + readable-stream "^3.4.0" + +bn.js@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" + integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== + +bn.js@^4.0.0, bn.js@^4.11.8, bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== + +bn.js@^5.0.0, bn.js@^5.2.0, bn.js@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== + +borsh@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.6.0.tgz#a7c9eeca6a31ca9e0607cb49f329cb659eb791e1" + integrity sha512-sl5k89ViqsThXQpYa9XDtz1sBl3l1lI313cFUY1HKr+wvMILnb+58xpkqTNrYbelh99dY7K8usxoCusQmqix9Q== + dependencies: + bn.js "^5.2.0" + bs58 "^4.0.0" + text-encoding-utf-8 "^1.0.2" + +borsh@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.7.0.tgz#6e9560d719d86d90dc589bca60ffc8a6c51fec2a" + integrity sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA== + dependencies: + bn.js "^5.2.0" + bs58 "^4.0.0" + text-encoding-utf-8 "^1.0.2" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +braces@^3.0.2, braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +brorand@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== + +browser-level@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/browser-level/-/browser-level-1.0.1.tgz#36e8c3183d0fe1c405239792faaab5f315871011" + integrity sha512-XECYKJ+Dbzw0lbydyQuJzwNXtOpbMSq737qxJN11sIRTErOMShvDpbzTlgju7orJKvx4epULolZAuJGLzCmWRQ== + dependencies: + abstract-level "^1.0.2" + catering "^2.1.1" + module-error "^1.0.2" + run-parallel-limit "^1.1.0" + +browserslist@^4.21.3: + version "4.21.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987" + integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw== + dependencies: + caniuse-lite "^1.0.30001400" + electron-to-chromium "^1.4.251" + node-releases "^2.0.6" + update-browserslist-db "^1.0.9" + +bs-logger@0.x: + version "0.2.6" + resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" + integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== + dependencies: + fast-json-stable-stringify "2.x" + +bs58@^4.0.0, bs58@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== + dependencies: + base-x "^3.0.2" + +bs58check@<3.0.0, bs58check@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" + +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== + dependencies: + node-int64 "^0.4.0" + +buffer-alloc-unsafe@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" + integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg== + +buffer-alloc@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" + integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow== + dependencies: + buffer-alloc-unsafe "^1.1.0" + buffer-fill "^1.0.0" + +buffer-crc32@~0.2.3: + version "0.2.13" + resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" + integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ== + +buffer-fill@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" + integrity sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ== + +buffer-from@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== + +buffer@6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.1.tgz#3cbea8c1463e5a0779e30b66d4c88c6ffa182ac2" + integrity sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + +buffer@6.0.3, buffer@^6.0.2, buffer@^6.0.3, buffer@~6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + +buffer@^5.2.1, buffer@^5.5.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + +buffer@~5.4.3: + version "5.4.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.4.3.tgz#3fbc9c69eb713d323e3fc1a895eee0710c072115" + integrity sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A== + dependencies: + base64-js "^1.0.2" + ieee754 "^1.1.4" + +bufferutil@^4.0.1: + version "4.0.7" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz#60c0d19ba2c992dd8273d3f73772ffc894c153ad" + integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw== + dependencies: + node-gyp-build "^4.3.0" + +builtins@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" + integrity sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ== + +builtins@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/builtins/-/builtins-5.0.1.tgz#87f6db9ab0458be728564fa81d876d8d74552fa9" + integrity sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ== + dependencies: + semver "^7.0.0" + +byte-size@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-7.0.1.tgz#b1daf3386de7ab9d706b941a748dbfc71130dee3" + integrity sha512-crQdqyCwhokxwV1UyDzLZanhkugAgft7vt0qbbdt60C6Zf3CAiGmtUCylbtYwrU6loOUw3euGrNtW1J651ot1A== + +cacache@^16.0.0, cacache@^16.0.6, cacache@^16.1.0: + version "16.1.3" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-16.1.3.tgz#a02b9f34ecfaf9a78c9f4bc16fceb94d5d67a38e" + integrity sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ== + dependencies: + "@npmcli/fs" "^2.1.0" + "@npmcli/move-file" "^2.0.0" + chownr "^2.0.0" + fs-minipass "^2.1.0" + glob "^8.0.1" + infer-owner "^1.0.4" + lru-cache "^7.7.1" + minipass "^3.1.6" + minipass-collect "^1.0.2" + minipass-flush "^1.0.5" + minipass-pipeline "^1.2.4" + mkdirp "^1.0.4" + p-map "^4.0.0" + promise-inflight "^1.0.1" + rimraf "^3.0.2" + ssri "^9.0.0" + tar "^6.1.11" + unique-filename "^2.0.0" + +cacheable-request@^2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-2.1.4.tgz#0d808801b6342ad33c91df9d0b44dc09b91e5c3d" + integrity sha512-vag0O2LKZ/najSoUwDbVlnlCFvhBE/7mGTY2B5FgCBDcRD+oVV1HYTOwM6JZfMg/hIcM6IwnTZ1uQQL5/X3xIQ== + dependencies: + clone-response "1.0.2" + get-stream "3.0.0" + http-cache-semantics "3.8.1" + keyv "3.0.0" + lowercase-keys "1.0.0" + normalize-url "2.0.1" + responselike "1.0.2" + +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase-keys@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0" + integrity sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg== + dependencies: + camelcase "^5.3.1" + map-obj "^4.0.0" + quick-lru "^4.0.1" + +camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +camelcase@^6.2.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +caniuse-lite@^1.0.30001400: + version "1.0.30001434" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001434.tgz#ec1ec1cfb0a93a34a0600d37903853030520a4e5" + integrity sha512-aOBHrLmTQw//WFa2rcF1If9fa3ypkC1wzqqiKHgfdrXTWcU8C4gKVZT77eQAPWN1APys3+uQ0Df07rKauXGEYA== + +capability@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/capability/-/capability-0.2.5.tgz#51ad87353f1936ffd77f2f21c74633a4dea88801" + integrity sha512-rsJZYVCgXd08sPqwmaIqjAd5SUTfonV0z/gDJ8D6cN8wQphky1kkAYEqQ+hmDxTw7UihvBfjUVUSY+DBEe44jg== + +catering@^2.1.0, catering@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/catering/-/catering-2.1.1.tgz#66acba06ed5ee28d5286133982a927de9a04b510" + integrity sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w== + +chalk@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +chalk@^2.0.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +char-regex@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" + integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== + +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + +charenc@~0.0.1: + version "0.0.2" + resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" + integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA== + +chokidar@^3.5.1: + version "3.5.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" + integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + +chownr@^1.1.1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" + integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== + +chownr@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" + integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== + +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + +ci-info@^3.2.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.6.2.tgz#362ea15378f1c39378ba786affbc1c9ef015ecfd" + integrity sha512-lVZdhvbEudris15CLytp2u6Y0p5EKfztae9Fqa189MfNmln9F33XuH69v5fvNfiRN5/0eAUz2yJL3mo+nhaRKg== + +cipher-base@^1.0.1, cipher-base@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +cjs-module-lexer@^1.0.0: + version "1.2.2" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" + integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== + +classic-level@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/classic-level/-/classic-level-1.2.0.tgz#2d52bdec8e7a27f534e67fdeb890abef3e643c27" + integrity sha512-qw5B31ANxSluWz9xBzklRWTUAJ1SXIdaVKTVS7HcTGKOAmExx65Wo5BUICW+YGORe2FOUaDghoI9ZDxj82QcFg== + dependencies: + abstract-level "^1.0.2" + catering "^2.1.0" + module-error "^1.0.1" + napi-macros "~2.0.0" + node-gyp-build "^4.3.0" + +clean-stack@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" + integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== + +cli-cursor@3.1.0, cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + +cli-spinners@2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.6.1.tgz#adc954ebe281c37a6319bfa401e6dd2488ffb70d" + integrity sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g== + +cli-spinners@^2.5.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.7.0.tgz#f815fd30b5f9eaac02db604c7a231ed7cb2f797a" + integrity sha512-qu3pN8Y3qHNgE2AFweciB1IfMnmZ/fsNTEE+NOFjmGB2F/7rLhnhzppvpCnN4FovtP26k8lHyy9ptEbNwWFLzw== + +cli-width@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" + integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== + +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" + +clone-deep@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" + +clone-response@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b" + integrity sha512-yjLXh88P599UOyPTFX0POsd7WxnbsVsGohcwzHOLspIhhpalPw1BcqED8NblyZLKcGrL8dTgMlcaZxV2jAD41Q== + dependencies: + mimic-response "^1.0.0" + +clone@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" + integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== + +cmd-shim@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-5.0.0.tgz#8d0aaa1a6b0708630694c4dbde070ed94c707724" + integrity sha512-qkCtZ59BidfEwHltnJwkyVZn+XQojdAySM1D1gSeh11Z4pW1Kpolkyo53L5noc0nrxmIvyFwTmJRo4xs7FFLPw== + dependencies: + mkdirp-infer-owner "^2.0.0" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA== + +collect-v8-coverage@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59" + integrity sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg== + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +color-support@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" + integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== + +columnify@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.6.0.tgz#6989531713c9008bb29735e61e37acf5bd553cf3" + integrity sha512-lomjuFZKfM6MSAnV9aCZC9sc0qGbmZdfygNv+nCpqVkSKdCxCklLtd16O0EILGkImHw9ZpHkAnHaB+8Zxq5W6Q== + dependencies: + strip-ansi "^6.0.1" + wcwidth "^1.0.0" + +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@^2.20.3, commander@^2.8.1: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +commander@^8.2.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + +commander@^9.4.0, commander@^9.4.1: + version "9.4.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd" + integrity sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw== + +common-ancestor-path@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz#4f7d2d1394d91b7abdf51871c62f71eadb0182a7" + integrity sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w== + +compare-func@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-2.0.0.tgz#fb65e75edbddfd2e568554e8b5b05fff7a51fcb3" + integrity sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA== + dependencies: + array-ify "^1.0.0" + dot-prop "^5.1.0" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +concat-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-2.0.0.tgz#414cf5af790a48c60ab9be4527d56d5e41133cb1" + integrity sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A== + dependencies: + buffer-from "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.0.2" + typedarray "^0.0.6" + +config-chain@^1.1.12: + version "1.1.13" + resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.13.tgz#fad0795aa6a6cdaff9ed1b68e9dff94372c232f4" + integrity sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ== + dependencies: + ini "^1.3.4" + proto-list "~1.2.1" + +console-control-strings@^1.0.0, console-control-strings@^1.1.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== + +content-disposition@^0.5.2: + version "0.5.4" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" + integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== + dependencies: + safe-buffer "5.2.1" + +conventional-changelog-angular@^5.0.12: + version "5.0.13" + resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz#896885d63b914a70d4934b59d2fe7bde1832b28c" + integrity sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA== + dependencies: + compare-func "^2.0.0" + q "^1.5.1" + +conventional-changelog-core@^4.2.4: + version "4.2.4" + resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-4.2.4.tgz#e50d047e8ebacf63fac3dc67bf918177001e1e9f" + integrity sha512-gDVS+zVJHE2v4SLc6B0sLsPiloR0ygU7HaDW14aNJE1v4SlqJPILPl/aJC7YdtRE4CybBf8gDwObBvKha8Xlyg== + dependencies: + add-stream "^1.0.0" + conventional-changelog-writer "^5.0.0" + conventional-commits-parser "^3.2.0" + dateformat "^3.0.0" + get-pkg-repo "^4.0.0" + git-raw-commits "^2.0.8" + git-remote-origin-url "^2.0.0" + git-semver-tags "^4.1.1" + lodash "^4.17.15" + normalize-package-data "^3.0.0" + q "^1.5.1" + read-pkg "^3.0.0" + read-pkg-up "^3.0.0" + through2 "^4.0.0" + +conventional-changelog-preset-loader@^2.3.4: + version "2.3.4" + resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.4.tgz#14a855abbffd59027fd602581f1f34d9862ea44c" + integrity sha512-GEKRWkrSAZeTq5+YjUZOYxdHq+ci4dNwHvpaBC3+ENalzFWuCWa9EZXSuZBpkr72sMdKB+1fyDV4takK1Lf58g== + +conventional-changelog-writer@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-5.0.1.tgz#e0757072f045fe03d91da6343c843029e702f359" + integrity sha512-5WsuKUfxW7suLblAbFnxAcrvf6r+0b7GvNaWUwUIk0bXMnENP/PEieGKVUQrjPqwPT4o3EPAASBXiY6iHooLOQ== + dependencies: + conventional-commits-filter "^2.0.7" + dateformat "^3.0.0" + handlebars "^4.7.7" + json-stringify-safe "^5.0.1" + lodash "^4.17.15" + meow "^8.0.0" + semver "^6.0.0" + split "^1.0.0" + through2 "^4.0.0" + +conventional-commits-filter@^2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-2.0.7.tgz#f8d9b4f182fce00c9af7139da49365b136c8a0b3" + integrity sha512-ASS9SamOP4TbCClsRHxIHXRfcGCnIoQqkvAzCSbZzTFLfcTqJVugB0agRgsEELsqaeWgsXv513eS116wnlSSPA== + dependencies: + lodash.ismatch "^4.4.0" + modify-values "^1.0.0" + +conventional-commits-parser@^3.2.0: + version "3.2.4" + resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.2.4.tgz#a7d3b77758a202a9b2293d2112a8d8052c740972" + integrity sha512-nK7sAtfi+QXbxHCYfhpZsfRtaitZLIA6889kFIouLvz6repszQDgxBu7wf2WbU+Dco7sAnNCJYERCwt54WPC2Q== + dependencies: + JSONStream "^1.0.4" + is-text-path "^1.0.1" + lodash "^4.17.15" + meow "^8.0.0" + split2 "^3.0.0" + through2 "^4.0.0" + +conventional-recommended-bump@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-6.1.0.tgz#cfa623285d1de554012f2ffde70d9c8a22231f55" + integrity sha512-uiApbSiNGM/kkdL9GTOLAqC4hbptObFo4wW2QRyHsKciGAfQuLU1ShZ1BIVI/+K2BE/W1AWYQMCXAsv4dyKPaw== + dependencies: + concat-stream "^2.0.0" + conventional-changelog-preset-loader "^2.3.4" + conventional-commits-filter "^2.0.7" + conventional-commits-parser "^3.2.0" + git-raw-commits "^2.0.8" + git-semver-tags "^4.1.1" + meow "^8.0.0" + q "^1.5.1" + +convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" + integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== + +copyfiles@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/copyfiles/-/copyfiles-2.4.1.tgz#d2dcff60aaad1015f09d0b66e7f0f1c5cd3c5da5" + integrity sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg== + dependencies: + glob "^7.0.5" + minimatch "^3.0.3" + mkdirp "^1.0.4" + noms "0.0.0" + through2 "^2.0.1" + untildify "^4.0.0" + yargs "^16.1.0" + +core-util-is@~1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + +cosmiconfig@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz#1443b9afa596b670082ea46cbd8f6a62b84635f6" + integrity sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.2.1" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.10.0" + +cosmjs-types@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.4.1.tgz#3b2a53ba60d33159dd075596ce8267cfa7027063" + integrity sha512-I7E/cHkIgoJzMNQdFF0YVqPlaTqrqKHrskuSTIqlEyxfB5Lf3WKCajSXVK2yHOfOFfSux/RxEdpMzw/eO4DIog== + dependencies: + long "^4.0.0" + protobufjs "~6.11.2" + +create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +create-hmac@1.1.7, create-hmac@^1.1.4, create-hmac@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== + dependencies: + cipher-base "^1.0.3" + create-hash "^1.1.0" + inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + +cross-fetch@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" + integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw== + dependencies: + node-fetch "2.6.7" + +cross-spawn@^7.0.2, cross-spawn@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +crypt@~0.0.1: + version "0.0.2" + resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" + integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow== + +crypto-js@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.1.1.tgz#9e485bcf03521041bd85844786b83fb7619736cf" + integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw== + +csv-generate@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/csv-generate/-/csv-generate-4.2.1.tgz#2a0c5f0d9a5b6f7a0c1fee40f028707af048b31b" + integrity sha512-w6GFHjvApv6bcJ2xdi9JGsH6ZvUBfC+vUdfefnEzurXG6hMRwzkBLnhztU2H7v7+zfCk1I/knnQ+tGbgpxWrBw== + +csv-parse@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-5.3.2.tgz#a8ce2f8dec1b9c1013c9e73c6102fe0d2d436dbb" + integrity sha512-3jQ/JMs+voKxr4vwpmElS1d37J0o6rQdQyEKoPyA9HG8fYczpLaBJnmp5ykvkXL8ZeEGVP0qwLU645BZVykXKw== + +csv-stringify@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/csv-stringify/-/csv-stringify-6.2.2.tgz#3f398c79e14353f799c9d2583bafa06ebe68ac21" + integrity sha512-spGNdHxkAgoKk9ChAIR/k8JSFmvAyUQvODPUss5Djqgm/wBuU9qBRuGZ04LTAsGGnClQ8hD4TFz+hbBf1gpTMg== + +csv@^6.0.5: + version "6.2.3" + resolved "https://registry.yarnpkg.com/csv/-/csv-6.2.3.tgz#4d78de93fc5a3ff4a93dc752c1cc2af781991905" + integrity sha512-LwpMgclTH2T386Ug/QgpJGtvWdQrg7ARO2BoYkevQ4H/zhiRCaDol4W2RyGoCSj+yKTeIf866mUnQAnmH0KhHA== + dependencies: + csv-generate "^4.2.1" + csv-parse "^5.3.2" + csv-stringify "^6.2.2" + stream-transform "^3.2.1" + +curve25519-js@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/curve25519-js/-/curve25519-js-0.0.4.tgz#e6ad967e8cd284590d657bbfc90d8b50e49ba060" + integrity sha512-axn2UMEnkhyDUPWOwVKBMVIzSQy2ejH2xRGy1wq81dqRwApXfIzfbE3hIX0ZRFBIihf/KDqK158DLwESu4AK1w== + +dargs@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" + integrity sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg== + +dataloader@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-1.4.0.tgz#bca11d867f5d3f1b9ed9f737bd15970c65dff5c8" + integrity sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw== + +dateformat@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" + integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== + +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +debuglog@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" + integrity sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw== + +decamelize-keys@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.1.tgz#04a2d523b2f18d80d0158a43b895d56dff8d19d8" + integrity sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg== + dependencies: + decamelize "^1.1.0" + map-obj "^1.0.0" + +decamelize@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha512-hjf+xovcEn31w/EUYdTXQh/8smFL/dzYjohQGEIgjyNavaJfBY2p5F527Bo1VPATxv0VYTUC2bOcXvqFwk78Og== + +decompress-response@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" + integrity sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA== + dependencies: + mimic-response "^1.0.0" + +decompress-response@^4.2.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986" + integrity sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw== + dependencies: + mimic-response "^2.0.0" + +decompress-tar@^4.0.0, decompress-tar@^4.1.0, decompress-tar@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/decompress-tar/-/decompress-tar-4.1.1.tgz#718cbd3fcb16209716e70a26b84e7ba4592e5af1" + integrity sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ== + dependencies: + file-type "^5.2.0" + is-stream "^1.1.0" + tar-stream "^1.5.2" + +decompress-tarbz2@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz#3082a5b880ea4043816349f378b56c516be1a39b" + integrity sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A== + dependencies: + decompress-tar "^4.1.0" + file-type "^6.1.0" + is-stream "^1.1.0" + seek-bzip "^1.0.5" + unbzip2-stream "^1.0.9" + +decompress-targz@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/decompress-targz/-/decompress-targz-4.1.1.tgz#c09bc35c4d11f3de09f2d2da53e9de23e7ce1eee" + integrity sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w== + dependencies: + decompress-tar "^4.1.1" + file-type "^5.2.0" + is-stream "^1.1.0" + +decompress-unzip@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/decompress-unzip/-/decompress-unzip-4.0.1.tgz#deaaccdfd14aeaf85578f733ae8210f9b4848f69" + integrity sha512-1fqeluvxgnn86MOh66u8FjbtJpAFv5wgCT9Iw8rcBqQcCo5tO8eiJw7NNTrvt9n4CRBVq7CstiS922oPgyGLrw== + dependencies: + file-type "^3.8.0" + get-stream "^2.2.0" + pify "^2.3.0" + yauzl "^2.4.2" + +decompress@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/decompress/-/decompress-4.2.1.tgz#007f55cc6a62c055afa37c07eb6a4ee1b773f118" + integrity sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ== + dependencies: + decompress-tar "^4.0.0" + decompress-tarbz2 "^4.0.0" + decompress-targz "^4.0.0" + decompress-unzip "^4.0.1" + graceful-fs "^4.1.10" + make-dir "^1.0.0" + pify "^2.3.0" + strip-dirs "^2.0.0" + +dedent@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +deep-is@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== + +deepmerge@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" + integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== + +defaults@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.4.tgz#b0b02062c1e2aa62ff5d9528f0f98baa90978d7a" + integrity sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A== + dependencies: + clone "^1.0.2" + +define-lazy-prop@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" + integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og== + +define-properties@^1.1.3: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.4.tgz#0b14d7bd7fbeb2f3572c3a7eda80ea5d57fb05b1" + integrity sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA== + dependencies: + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" + +delay@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/delay/-/delay-5.0.0.tgz#137045ef1b96e5071060dd5be60bf9334436bd1d" + integrity sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw== + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ== + +depd@^1.1.2, depd@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== + +depd@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + +deprecation@^2.0.0, deprecation@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" + integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== + +detect-indent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" + integrity sha512-rlpvsxUtM0PQvy9iZe640/IWwWYyBsTApREbA1pHOpmOUIl9MkP/U4z7vTtg4Oaojvqhxt7sdufnT0EzGaR31g== + +detect-indent@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" + integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA== + +detect-libc@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg== + +detect-newline@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" + integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== + +dezalgo@^1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.4.tgz#751235260469084c132157dfa857f386d4c33d81" + integrity sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig== + dependencies: + asap "^2.0.0" + wrappy "1" + +diff-sequences@^28.1.1: + version "28.1.1" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-28.1.1.tgz#9989dc731266dc2903457a70e996f3a041913ac6" + integrity sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw== + +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +dot-prop@^5.1.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88" + integrity sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q== + dependencies: + is-obj "^2.0.0" + +dot-prop@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083" + integrity sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA== + dependencies: + is-obj "^2.0.0" + +dotenv@~10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" + integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== + +download@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/download/-/download-8.0.0.tgz#afc0b309730811731aae9f5371c9f46be73e51b1" + integrity sha512-ASRY5QhDk7FK+XrQtQyvhpDKanLluEEQtWl/J7Lxuf/b+i8RYh997QeXvL85xitrmRKVlx9c7eTrcRdq2GS4eA== + dependencies: + archive-type "^4.0.0" + content-disposition "^0.5.2" + decompress "^4.2.1" + ext-name "^5.0.0" + file-type "^11.1.0" + filenamify "^3.0.0" + get-stream "^4.1.0" + got "^8.3.1" + make-dir "^2.1.0" + p-event "^2.1.0" + pify "^4.0.1" + +dprint-node@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/dprint-node/-/dprint-node-1.0.7.tgz#f571eaf61affb3a696cff1bdde78a021875ba540" + integrity sha512-NTZOW9A7ipb0n7z7nC3wftvsbceircwVHSgzobJsEQa+7RnOMbhrfX5IflA6CtC4GA63DSAiHYXa4JKEy9F7cA== + dependencies: + detect-libc "^1.0.3" + +duplexer3@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.5.tgz#0b5e4d7bad5de8901ea4440624c8e1d20099217e" + integrity sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA== + +duplexer@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.2.tgz#3abe43aef3835f8ae077d136ddce0f276b0400e6" + integrity sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg== + +ejs@^3.1.7: + version "3.1.8" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.8.tgz#758d32910c78047585c7ef1f92f9ee041c1c190b" + integrity sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ== + dependencies: + jake "^10.8.5" + +electron-to-chromium@^1.4.251: + version "1.4.284" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592" + integrity sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA== + +elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.3, elliptic@^6.5.4: + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" + +emittery@^0.10.2: + version "0.10.2" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.10.2.tgz#902eec8aedb8c41938c46e9385e9db7e03182933" + integrity sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +encoding@^0.1.13: + version "0.1.13" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" + integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== + dependencies: + iconv-lite "^0.6.2" + +end-of-stream@^1.0.0, end-of-stream@^1.1.0, end-of-stream@^1.4.1: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +enquirer@~2.3.6: + version "2.3.6" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" + integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== + dependencies: + ansi-colors "^4.1.1" + +env-paths@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" + integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== + +envinfo@^7.7.4: + version "7.8.1" + resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475" + integrity sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw== + +err-code@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9" + integrity sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA== + +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +error-polyfill@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/error-polyfill/-/error-polyfill-0.1.3.tgz#df848b61ad8834f7a5db69a70b9913df86721d15" + integrity sha512-XHJk60ufE+TG/ydwp4lilOog549iiQF2OAPhkk9DdiYWMrltz5yhDz/xnKuenNwP7gy3dsibssO5QpVhkrSzzg== + dependencies: + capability "^0.2.5" + o3 "^1.0.3" + u3 "^0.1.1" + +es6-promise@^4.0.3: + version "4.2.8" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" + integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== + +es6-promisify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + integrity sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ== + dependencies: + es6-promise "^4.0.3" + +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +eslint-config-prettier@^8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz#5a81680ec934beca02c7b1a61cf8ca34b66feab1" + integrity sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q== + +eslint-plugin-prettier@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b" + integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ== + dependencies: + prettier-linter-helpers "^1.0.0" + +eslint-plugin-simple-import-sort@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-8.0.0.tgz#9d9a2372b0606e999ea841b10458a370a6ccc160" + integrity sha512-bXgJQ+lqhtQBCuWY/FUWdB27j4+lqcvXv5rUARkzbeWLwea+S5eBZEQrhnO+WgX3ZoJHVj0cn943iyXwByHHQw== + +eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +eslint-scope@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" + integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== + dependencies: + eslint-visitor-keys "^2.0.0" + +eslint-visitor-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== + +eslint-visitor-keys@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" + integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== + +eslint@^8.27.0: + version "8.29.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.29.0.tgz#d74a88a20fb44d59c51851625bc4ee8d0ec43f87" + integrity sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg== + dependencies: + "@eslint/eslintrc" "^1.3.3" + "@humanwhocodes/config-array" "^0.11.6" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.1.1" + eslint-utils "^3.0.0" + eslint-visitor-keys "^3.3.0" + espree "^9.4.0" + esquery "^1.4.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.15.0" + grapheme-splitter "^1.0.4" + ignore "^5.2.0" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-sdsl "^4.1.4" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.1" + regexpp "^3.2.0" + strip-ansi "^6.0.1" + strip-json-comments "^3.1.0" + text-table "^0.2.0" + +espree@^9.4.0: + version "9.4.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.1.tgz#51d6092615567a2c2cff7833445e37c28c0065bd" + integrity sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg== + dependencies: + acorn "^8.8.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.3.0" + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.0.1, esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +ethers@^5.5.1, ethers@^5.6.5, ethers@^5.6.9: + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== + dependencies: + "@ethersproject/abi" "5.7.0" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/address" "5.7.0" + "@ethersproject/base64" "5.7.0" + "@ethersproject/basex" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@ethersproject/bytes" "5.7.0" + "@ethersproject/constants" "5.7.0" + "@ethersproject/contracts" "5.7.0" + "@ethersproject/hash" "5.7.0" + "@ethersproject/hdnode" "5.7.0" + "@ethersproject/json-wallets" "5.7.0" + "@ethersproject/keccak256" "5.7.0" + "@ethersproject/logger" "5.7.0" + "@ethersproject/networks" "5.7.1" + "@ethersproject/pbkdf2" "5.7.0" + "@ethersproject/properties" "5.7.0" + "@ethersproject/providers" "5.7.2" + "@ethersproject/random" "5.7.0" + "@ethersproject/rlp" "5.7.0" + "@ethersproject/sha2" "5.7.0" + "@ethersproject/signing-key" "5.7.0" + "@ethersproject/solidity" "5.7.0" + "@ethersproject/strings" "5.7.0" + "@ethersproject/transactions" "5.7.0" + "@ethersproject/units" "5.7.0" + "@ethersproject/wallet" "5.7.0" + "@ethersproject/web" "5.7.1" + "@ethersproject/wordlists" "5.7.0" + +eventemitter3@^4.0.0, eventemitter3@^4.0.4, eventemitter3@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" + integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== + +execa@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +exit@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== + +expand-template@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" + integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== + +expect@^28.0.0, expect@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/expect/-/expect-28.1.3.tgz#90a7c1a124f1824133dd4533cce2d2bdcb6603ec" + integrity sha512-eEh0xn8HlsuOBxFgIss+2mX85VAS4Qy3OSkjV7rlBWljtA4oWH37glVGyOZSZvErDT/yBywZdPGwCXuTvSG85g== + dependencies: + "@jest/expect-utils" "^28.1.3" + jest-get-type "^28.0.2" + jest-matcher-utils "^28.1.3" + jest-message-util "^28.1.3" + jest-util "^28.1.3" + +exponential-backoff@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/exponential-backoff/-/exponential-backoff-3.1.0.tgz#9409c7e579131f8bd4b32d7d8094a911040f2e68" + integrity sha512-oBuz5SYz5zzyuHINoe9ooePwSu0xApKWgeNzok4hZ5YKXFh9zrQBEM15CXqoZkJJPuI2ArvqjPQd8UKJA753XA== + +ext-list@^2.0.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/ext-list/-/ext-list-2.2.2.tgz#0b98e64ed82f5acf0f2931babf69212ef52ddd37" + integrity sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA== + dependencies: + mime-db "^1.28.0" + +ext-name@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ext-name/-/ext-name-5.0.0.tgz#70781981d183ee15d13993c8822045c506c8f0a6" + integrity sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ== + dependencies: + ext-list "^2.0.0" + sort-keys-length "^1.0.0" + +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + +extract-zip@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a" + integrity sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg== + dependencies: + debug "^4.1.1" + get-stream "^5.1.0" + yauzl "^2.10.0" + optionalDependencies: + "@types/yauzl" "^2.9.1" + +eyes@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" + integrity sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ== + +fast-deep-equal@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" + integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + +fast-glob@3.2.7: + version "3.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" + integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-glob@^3.2.9: + version "3.2.12" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" + integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== + +fast-stable-stringify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz#5c5543462b22aeeefd36d05b34e51c78cb86d313" + integrity sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag== + +fastq@^1.6.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" + integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== + dependencies: + reusify "^1.0.4" + +fb-watchman@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" + integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== + dependencies: + bser "2.1.1" + +fd-slicer@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" + integrity sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g== + dependencies: + pend "~1.2.0" + +figures@3.2.0, figures@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" + integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + +file-type@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-11.1.0.tgz#93780f3fed98b599755d846b99a1617a2ad063b8" + integrity sha512-rM0UO7Qm9K7TWTtA6AShI/t7H5BPjDeGVDaNyg9BjHAj3PysKy7+8C8D137R88jnR3rFJZQB/tFgydl5sN5m7g== + +file-type@^3.8.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-3.9.0.tgz#257a078384d1db8087bc449d107d52a52672b9e9" + integrity sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA== + +file-type@^4.2.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-4.4.0.tgz#1b600e5fca1fbdc6e80c0a70c71c8dba5f7906c5" + integrity sha512-f2UbFQEk7LXgWpi5ntcO86OeA/cC80fuDDDaX/fZ2ZGel+AF7leRQqBBW1eJNiiQkrZlAoM6P+VYP5P6bOlDEQ== + +file-type@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-5.2.0.tgz#2ddbea7c73ffe36368dfae49dc338c058c2b8ad6" + integrity sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ== + +file-type@^6.1.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-6.2.0.tgz#e50cd75d356ffed4e306dc4f5bcf52a79903a919" + integrity sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg== + +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + +filelist@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.4.tgz#f78978a1e944775ff9e62e744424f215e58352b5" + integrity sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q== + dependencies: + minimatch "^5.0.1" + +filename-reserved-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz#abf73dfab735d045440abfea2d91f389ebbfa229" + integrity sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ== + +filenamify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/filenamify/-/filenamify-3.0.0.tgz#9603eb688179f8c5d40d828626dcbb92c3a4672c" + integrity sha512-5EFZ//MsvJgXjBAFJ+Bh2YaCTRF/VP1YOmGrgt+KJ4SFRLjI87EIdwLLuT6wQX0I4F9W41xutobzczjsOKlI/g== + dependencies: + filename-reserved-regex "^2.0.0" + strip-outer "^1.0.0" + trim-repeated "^1.0.0" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +find-up@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ== + dependencies: + locate-path "^2.0.0" + +find-up@^4.0.0, find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + dependencies: + flatted "^3.1.0" + rimraf "^3.0.2" + +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + +flatted@^3.1.0: + version "3.2.7" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" + integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== + +follow-redirects@^1.10.0, follow-redirects@^1.14.0, follow-redirects@^1.14.4, follow-redirects@^1.14.7, follow-redirects@^1.14.8, follow-redirects@^1.14.9, follow-redirects@^1.15.0: + version "1.15.2" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== + +for-each@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" + integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== + dependencies: + is-callable "^1.1.3" + +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +from2@^2.1.1, from2@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" + integrity sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g== + dependencies: + inherits "^2.0.1" + readable-stream "^2.0.0" + +fs-constants@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" + integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== + +fs-extra@^10.0.1, fs-extra@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + +fs-extra@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + +fs-minipass@^2.0.0, fs-minipass@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" + integrity sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg== + dependencies: + minipass "^3.0.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + +fsevents@^2.3.2, fsevents@~2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +gauge@^4.0.3: + version "4.0.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-4.0.4.tgz#52ff0652f2bbf607a989793d53b751bef2328dce" + integrity sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg== + dependencies: + aproba "^1.0.3 || ^2.0.0" + color-support "^1.1.3" + console-control-strings "^1.1.0" + has-unicode "^2.0.1" + signal-exit "^3.0.7" + string-width "^4.2.3" + strip-ansi "^6.0.1" + wide-align "^1.1.5" + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg== + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.3.tgz#063c84329ad93e83893c7f4f243ef63ffa351385" + integrity sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.3" + +get-package-type@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" + integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== + +get-pkg-repo@^4.0.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-4.2.1.tgz#75973e1c8050c73f48190c52047c4cee3acbf385" + integrity sha512-2+QbHjFRfGB74v/pYWjd5OhU3TDIC2Gv/YKUTk/tCvAz0pkn/Mz6P3uByuBimLOcPvN2jYdScl3xGFSrx0jEcA== + dependencies: + "@hutson/parse-repository-url" "^3.0.0" + hosted-git-info "^4.0.0" + through2 "^2.0.0" + yargs "^16.2.0" + +get-port@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193" + integrity sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ== + +get-stream@3.0.0, get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ== + +get-stream@^2.2.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-2.3.1.tgz#5f38f93f346009666ee0150a054167f91bdd95de" + integrity sha512-AUGhbbemXxrZJRD5cDvKtQxLuYaIbNtDTK8YqupCI393Q2KSTreEsLUN3ZxAWFGiKTzL6nKuzfcIvieflUX9qA== + dependencies: + object-assign "^4.0.1" + pinkie-promise "^2.0.0" + +get-stream@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + +get-stream@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" + integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== + dependencies: + pump "^3.0.0" + +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + +git-raw-commits@^2.0.8: + version "2.0.11" + resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.11.tgz#bc3576638071d18655e1cc60d7f524920008d723" + integrity sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A== + dependencies: + dargs "^7.0.0" + lodash "^4.17.15" + meow "^8.0.0" + split2 "^3.0.0" + through2 "^4.0.0" + +git-remote-origin-url@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz#5282659dae2107145a11126112ad3216ec5fa65f" + integrity sha512-eU+GGrZgccNJcsDH5LkXR3PB9M958hxc7sbA8DFJjrv9j4L2P/eZfKhM+QD6wyzpiv+b1BpK0XrYCxkovtjSLw== + dependencies: + gitconfiglocal "^1.0.0" + pify "^2.3.0" + +git-semver-tags@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-4.1.1.tgz#63191bcd809b0ec3e151ba4751c16c444e5b5780" + integrity sha512-OWyMt5zBe7xFs8vglMmhM9lRQzCWL3WjHtxNNfJTMngGym7pC1kh8sP6jevfydJ6LP3ZvGxfb6ABYgPUM0mtsA== + dependencies: + meow "^8.0.0" + semver "^6.0.0" + +git-up@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/git-up/-/git-up-7.0.0.tgz#bace30786e36f56ea341b6f69adfd83286337467" + integrity sha512-ONdIrbBCFusq1Oy0sC71F5azx8bVkvtZtMJAsv+a6lz5YAmbNnLD6HAB4gptHZVLPR8S2/kVN6Gab7lryq5+lQ== + dependencies: + is-ssh "^1.4.0" + parse-url "^8.1.0" + +git-url-parse@^13.1.0: + version "13.1.0" + resolved "https://registry.yarnpkg.com/git-url-parse/-/git-url-parse-13.1.0.tgz#07e136b5baa08d59fabdf0e33170de425adf07b4" + integrity sha512-5FvPJP/70WkIprlUZ33bm4UAaFdjcLkJLpWft1BeZKqwR0uhhNGoKwlUaPtVb4LxCSQ++erHapRak9kWGj+FCA== + dependencies: + git-up "^7.0.0" + +gitconfiglocal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz#41d045f3851a5ea88f03f24ca1c6178114464b9b" + integrity sha512-spLUXeTAVHxDtKsJc8FkFVgFtMdEN9qPGpL23VfSHx4fP4+Ds097IXLvymbnDH8FnmxX5Nr9bPw3A+AQ6mWEaQ== + dependencies: + ini "^1.3.2" + +github-from-package@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" + integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw== + +glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + +glob@7.1.4: + version "7.1.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" + integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.0.5, glob@^7.1.3, glob@^7.1.4, glob@^7.1.7: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^8.0.1, glob@^8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" + integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globals@^13.15.0: + version "13.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.18.0.tgz#fb224daeeb2bb7d254cd2c640f003528b8d0c1dc" + integrity sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A== + dependencies: + type-fest "^0.20.2" + +globalthis@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" + integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== + dependencies: + define-properties "^1.1.3" + +globby@^11.0.2, globby@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + +got@^8.3.1: + version "8.3.2" + resolved "https://registry.yarnpkg.com/got/-/got-8.3.2.tgz#1d23f64390e97f776cac52e5b936e5f514d2e937" + integrity sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw== + dependencies: + "@sindresorhus/is" "^0.7.0" + cacheable-request "^2.1.1" + decompress-response "^3.3.0" + duplexer3 "^0.1.4" + get-stream "^3.0.0" + into-stream "^3.1.0" + is-retry-allowed "^1.1.0" + isurl "^1.0.0-alpha5" + lowercase-keys "^1.0.0" + mimic-response "^1.0.0" + p-cancelable "^0.4.0" + p-timeout "^2.0.1" + pify "^3.0.0" + safe-buffer "^5.1.1" + timed-out "^4.0.1" + url-parse-lax "^3.0.0" + url-to-options "^1.0.1" + +graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: + version "4.2.10" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== + +grapheme-splitter@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" + integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== + +handlebars@^4.7.7: + version "4.7.7" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" + integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== + dependencies: + minimist "^1.2.5" + neo-async "^2.6.0" + source-map "^0.6.1" + wordwrap "^1.0.0" + optionalDependencies: + uglify-js "^3.1.4" + +hard-rejection@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" + integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-property-descriptors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz#610708600606d36961ed04c196193b6a607fa861" + integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== + dependencies: + get-intrinsic "^1.1.1" + +has-symbol-support-x@^1.4.1: + version "1.4.2" + resolved "https://registry.yarnpkg.com/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz#1409f98bc00247da45da67cee0a36f282ff26455" + integrity sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw== + +has-symbols@^1.0.2, has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + +has-to-string-tag-x@^1.2.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz#a045ab383d7b4b2012a00148ab0aa5f290044d4d" + integrity sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw== + dependencies: + has-symbol-support-x "^1.4.1" + +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== + dependencies: + has-symbols "^1.0.2" + +has-unicode@^2.0.0, has-unicode@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ== + +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + +hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@~1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + +hi-base32@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/hi-base32/-/hi-base32-0.5.1.tgz#1279f2ddae2673219ea5870c2121d2a33132857e" + integrity sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA== + +hmac-drbg@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + +hosted-git-info@^2.1.4: + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== + +hosted-git-info@^3.0.6: + version "3.0.8" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-3.0.8.tgz#6e35d4cc87af2c5f816e4cb9ce350ba87a3f370d" + integrity sha512-aXpmwoOhRBrw6X3j0h5RloK4x1OzsxMPyxqIHyNfSe2pypkVTZFpEiRoSipPEPlMrh0HW/XsjkJ5WgnCirpNUw== + dependencies: + lru-cache "^6.0.0" + +hosted-git-info@^4.0.0, hosted-git-info@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-4.1.0.tgz#827b82867e9ff1c8d0c4d9d53880397d2c86d224" + integrity sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA== + dependencies: + lru-cache "^6.0.0" + +hosted-git-info@^5.0.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-5.2.1.tgz#0ba1c97178ef91f3ab30842ae63d6a272341156f" + integrity sha512-xIcQYMnhcx2Nr4JTjsFmwwnr9vldugPy9uVm0o87bjqqWMv9GaqsTeT+i99wTl0mk1uLxJtHxLb8kymqTENQsw== + dependencies: + lru-cache "^7.5.1" + +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + +http-cache-semantics@3.8.1: + version "3.8.1" + resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" + integrity sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== + +http-cache-semantics@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" + integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ== + +http-errors@^1.7.2: + version "1.8.1" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.8.1.tgz#7c3f28577cbc8a207388455dbd62295ed07bd68c" + integrity sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g== + dependencies: + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.1" + +http-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" + integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== + dependencies: + "@tootallnate/once" "2" + agent-base "6" + debug "4" + +https-proxy-agent@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + +humanize-ms@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ== + dependencies: + ms "^2.0.0" + +humanize-number@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/humanize-number/-/humanize-number-0.0.2.tgz#11c0af6a471643633588588048f1799541489c18" + integrity sha512-un3ZAcNQGI7RzaWGZzQDH47HETM4Wrj6z6E4TId8Yeq9w5ZKUVB1nrT2jwFheTUjEmqcgTjXDc959jum+ai1kQ== + +iconv-lite@^0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +iconv-lite@^0.6.2: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + +ieee754@^1.1.13, ieee754@^1.1.4, ieee754@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +ignore-walk@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-5.0.1.tgz#5f199e23e1288f518d90358d461387788a154776" + integrity sha512-yemi4pMf51WKT7khInJqAvsIGzoqYXblnsz0ql8tM+yi1EKYTY1evX4NAbJrLL/Aanr2HyZeluqU+Oi7MGHokw== + dependencies: + minimatch "^5.0.1" + +ignore@^5.0.4, ignore@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" + integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== + +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +import-local@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" + integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== + dependencies: + pkg-dir "^4.2.0" + resolve-cwd "^3.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + +indent-string@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== + +infer-owner@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" + integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ini@^1.3.2, ini@^1.3.4, ini@~1.3.0: + version "1.3.8" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + +init-package-json@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/init-package-json/-/init-package-json-3.0.2.tgz#f5bc9bac93f2bdc005778bc2271be642fecfcd69" + integrity sha512-YhlQPEjNFqlGdzrBfDNRLhvoSgX7iQRgSxgsNknRQ9ITXFT7UMfVMWhBTOh2Y+25lRnGrv5Xz8yZwQ3ACR6T3A== + dependencies: + npm-package-arg "^9.0.1" + promzard "^0.3.0" + read "^1.0.7" + read-package-json "^5.0.0" + semver "^7.3.5" + validate-npm-package-license "^3.0.4" + validate-npm-package-name "^4.0.0" + +inquirer@^8.2.0, inquirer@^8.2.4: + version "8.2.5" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.5.tgz#d8654a7542c35a9b9e069d27e2df4858784d54f8" + integrity sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ== + dependencies: + ansi-escapes "^4.2.1" + chalk "^4.1.1" + cli-cursor "^3.1.0" + cli-width "^3.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.21" + mute-stream "0.0.8" + ora "^5.4.1" + run-async "^2.4.0" + rxjs "^7.5.5" + string-width "^4.1.0" + strip-ansi "^6.0.0" + through "^2.3.6" + wrap-ansi "^7.0.0" + +into-stream@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-3.1.0.tgz#96fb0a936c12babd6ff1752a17d05616abd094c6" + integrity sha512-TcdjPibTksa1NQximqep2r17ISRiNE9fwlfbg3F8ANdvP5/yrFTew86VcO//jk4QTaMlbjypPBq76HN2zaKfZQ== + dependencies: + from2 "^2.1.1" + p-is-promise "^1.1.0" + +into-stream@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-6.0.0.tgz#4bfc1244c0128224e18b8870e85b2de8e66c6702" + integrity sha512-XHbaOAvP+uFKUFsOgoNPRjLkwB+I22JFPFe5OjTkQ0nwgj6+pSjb4NmB6VMxaPshLiOf+zcpOCBQuLwC1KHhZA== + dependencies: + from2 "^2.3.0" + p-is-promise "^3.0.0" + +ip@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.0.tgz#4cf4ab182fee2314c75ede1276f8c80b479936da" + integrity sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ== + +is-arguments@^1.0.4: + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b" + integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-buffer@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" + integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== + +is-buffer@~1.1.1: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-callable@^1.1.3: + version "1.2.7" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" + integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== + +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + +is-core-module@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" + integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== + dependencies: + has "^1.0.3" + +is-core-module@^2.5.0, is-core-module@^2.8.1, is-core-module@^2.9.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" + integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== + dependencies: + has "^1.0.3" + +is-docker@^2.0.0, is-docker@^2.1.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" + integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw== + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + +is-generator-function@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72" + integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A== + dependencies: + has-tostringtag "^1.0.0" + +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-interactive@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" + integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== + +is-lambda@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-lambda/-/is-lambda-1.0.1.tgz#3d9877899e6a53efc0160504cde15f82e6f061d5" + integrity sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ== + +is-natural-number@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-natural-number/-/is-natural-number-4.0.1.tgz#ab9d76e1db4ced51e35de0c72ebecf09f734cde8" + integrity sha512-Y4LTamMe0DDQIIAlaer9eKebAlDSV6huy+TWhJVPlzZh2o4tRP5SQWFlLn5N0To4mDD22/qdOq+veo1cSISLgQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-obj@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" + integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== + +is-object@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.2.tgz#a56552e1c665c9e950b4a025461da87e72f86fcf" + integrity sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA== + +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + +is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg== + +is-plain-obj@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + +is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-plain-object@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" + integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== + +is-retry-allowed@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz#d778488bd0a4666a3be8a1482b9f2baafedea8b4" + integrity sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg== + +is-ssh@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/is-ssh/-/is-ssh-1.4.0.tgz#4f8220601d2839d8fa624b3106f8e8884f01b8b2" + integrity sha512-x7+VxdxOdlV3CYpjvRLBv5Lo9OJerlYanjwFrPR9fuGPjCiNiCzFgAWpiLAohSbsnH4ZAys3SBh+hq5rJosxUQ== + dependencies: + protocols "^2.0.1" + +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ== + +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + +is-text-path@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-text-path/-/is-text-path-1.0.1.tgz#4e1aa0fb51bfbcb3e92688001397202c1775b66e" + integrity sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w== + dependencies: + text-extensions "^1.0.0" + +is-typed-array@^1.1.10, is-typed-array@^1.1.3: + version "1.1.10" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.10.tgz#36a5b5cb4189b575d1a3e4b08536bfb485801e3f" + integrity sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.0" + +is-typedarray@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== + +is-unicode-supported@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" + integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== + +is-wsl@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" + integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== + dependencies: + is-docker "^2.0.0" + +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== + +isomorphic-ws@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" + integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== + +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz#189e7909d0a39fa5a3dfad5b03f71947770191d3" + integrity sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw== + +istanbul-lib-instrument@^5.0.4, istanbul-lib-instrument@^5.1.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" + integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== + dependencies: + "@babel/core" "^7.12.3" + "@babel/parser" "^7.14.7" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-coverage "^3.2.0" + semver "^6.3.0" + +istanbul-lib-report@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" + integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== + dependencies: + istanbul-lib-coverage "^3.0.0" + make-dir "^3.0.0" + supports-color "^7.1.0" + +istanbul-lib-source-maps@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" + source-map "^0.6.1" + +istanbul-reports@^3.1.3: + version "3.1.5" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.5.tgz#cc9a6ab25cb25659810e4785ed9d9fb742578bae" + integrity sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w== + dependencies: + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" + +isurl@^1.0.0-alpha5: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isurl/-/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67" + integrity sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w== + dependencies: + has-to-string-tag-x "^1.2.0" + is-object "^1.0.1" + +jake@^10.8.5: + version "10.8.5" + resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.5.tgz#f2183d2c59382cb274226034543b9c03b8164c46" + integrity sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw== + dependencies: + async "^3.2.3" + chalk "^4.0.2" + filelist "^1.0.1" + minimatch "^3.0.4" + +jayson@^3.4.4: + version "3.7.0" + resolved "https://registry.yarnpkg.com/jayson/-/jayson-3.7.0.tgz#b735b12d06d348639ae8230d7a1e2916cb078f25" + integrity sha512-tfy39KJMrrXJ+mFcMpxwBvFDetS8LAID93+rycFglIQM4kl3uNR3W4lBLE/FFhsoUCEox5Dt2adVpDm/XtebbQ== + dependencies: + "@types/connect" "^3.4.33" + "@types/node" "^12.12.54" + "@types/ws" "^7.4.4" + JSONStream "^1.3.5" + commander "^2.20.3" + delay "^5.0.0" + es6-promisify "^5.0.0" + eyes "^0.1.8" + isomorphic-ws "^4.0.1" + json-stringify-safe "^5.0.1" + lodash "^4.17.20" + uuid "^8.3.2" + ws "^7.4.5" + +jest-changed-files@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-28.1.3.tgz#d9aeee6792be3686c47cb988a8eaf82ff4238831" + integrity sha512-esaOfUWJXk2nfZt9SPyC8gA1kNfdKLkQWyzsMlqq8msYSlNKfmZxfRgZn4Cd4MGVUF+7v6dBs0d5TOAKa7iIiA== + dependencies: + execa "^5.0.0" + p-limit "^3.1.0" + +jest-circus@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-28.1.3.tgz#d14bd11cf8ee1a03d69902dc47b6bd4634ee00e4" + integrity sha512-cZ+eS5zc79MBwt+IhQhiEp0OeBddpc1n8MBo1nMB8A7oPMKEO+Sre+wHaLJexQUj9Ya/8NOBY0RESUgYjB6fow== + dependencies: + "@jest/environment" "^28.1.3" + "@jest/expect" "^28.1.3" + "@jest/test-result" "^28.1.3" + "@jest/types" "^28.1.3" + "@types/node" "*" + chalk "^4.0.0" + co "^4.6.0" + dedent "^0.7.0" + is-generator-fn "^2.0.0" + jest-each "^28.1.3" + jest-matcher-utils "^28.1.3" + jest-message-util "^28.1.3" + jest-runtime "^28.1.3" + jest-snapshot "^28.1.3" + jest-util "^28.1.3" + p-limit "^3.1.0" + pretty-format "^28.1.3" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-cli@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-28.1.3.tgz#558b33c577d06de55087b8448d373b9f654e46b2" + integrity sha512-roY3kvrv57Azn1yPgdTebPAXvdR2xfezaKKYzVxZ6It/5NCxzJym6tUI5P1zkdWhfUYkxEI9uZWcQdaFLo8mJQ== + dependencies: + "@jest/core" "^28.1.3" + "@jest/test-result" "^28.1.3" + "@jest/types" "^28.1.3" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + import-local "^3.0.2" + jest-config "^28.1.3" + jest-util "^28.1.3" + jest-validate "^28.1.3" + prompts "^2.0.1" + yargs "^17.3.1" + +jest-config@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-28.1.3.tgz#e315e1f73df3cac31447eed8b8740a477392ec60" + integrity sha512-MG3INjByJ0J4AsNBm7T3hsuxKQqFIiRo/AUqb1q9LRKI5UU6Aar9JHbr9Ivn1TVwfUD9KirRoM/T6u8XlcQPHQ== + dependencies: + "@babel/core" "^7.11.6" + "@jest/test-sequencer" "^28.1.3" + "@jest/types" "^28.1.3" + babel-jest "^28.1.3" + chalk "^4.0.0" + ci-info "^3.2.0" + deepmerge "^4.2.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-circus "^28.1.3" + jest-environment-node "^28.1.3" + jest-get-type "^28.0.2" + jest-regex-util "^28.0.2" + jest-resolve "^28.1.3" + jest-runner "^28.1.3" + jest-util "^28.1.3" + jest-validate "^28.1.3" + micromatch "^4.0.4" + parse-json "^5.2.0" + pretty-format "^28.1.3" + slash "^3.0.0" + strip-json-comments "^3.1.1" + +jest-diff@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-28.1.3.tgz#948a192d86f4e7a64c5264ad4da4877133d8792f" + integrity sha512-8RqP1B/OXzjjTWkqMX67iqgwBVJRgCyKD3L9nq+6ZqJMdvjE8RgHktqZ6jNrkdMT+dJuYNI3rhQpxaz7drJHfw== + dependencies: + chalk "^4.0.0" + diff-sequences "^28.1.1" + jest-get-type "^28.0.2" + pretty-format "^28.1.3" + +jest-docblock@^28.1.1: + version "28.1.1" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-28.1.1.tgz#6f515c3bf841516d82ecd57a62eed9204c2f42a8" + integrity sha512-3wayBVNiOYx0cwAbl9rwm5kKFP8yHH3d/fkEaL02NPTkDojPtheGB7HZSFY4wzX+DxyrvhXz0KSCVksmCknCuA== + dependencies: + detect-newline "^3.0.0" + +jest-each@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-28.1.3.tgz#bdd1516edbe2b1f3569cfdad9acd543040028f81" + integrity sha512-arT1z4sg2yABU5uogObVPvSlSMQlDA48owx07BDPAiasW0yYpYHYOo4HHLz9q0BVzDVU4hILFjzJw0So9aCL/g== + dependencies: + "@jest/types" "^28.1.3" + chalk "^4.0.0" + jest-get-type "^28.0.2" + jest-util "^28.1.3" + pretty-format "^28.1.3" + +jest-environment-node@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-28.1.3.tgz#7e74fe40eb645b9d56c0c4b70ca4357faa349be5" + integrity sha512-ugP6XOhEpjAEhGYvp5Xj989ns5cB1K6ZdjBYuS30umT4CQEETaxSiPcZ/E1kFktX4GkrcM4qu07IIlDYX1gp+A== + dependencies: + "@jest/environment" "^28.1.3" + "@jest/fake-timers" "^28.1.3" + "@jest/types" "^28.1.3" + "@types/node" "*" + jest-mock "^28.1.3" + jest-util "^28.1.3" + +jest-get-type@^28.0.2: + version "28.0.2" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-28.0.2.tgz#34622e628e4fdcd793d46db8a242227901fcf203" + integrity sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA== + +jest-haste-map@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-28.1.3.tgz#abd5451129a38d9841049644f34b034308944e2b" + integrity sha512-3S+RQWDXccXDKSWnkHa/dPwt+2qwA8CJzR61w3FoYCvoo3Pn8tvGcysmMF0Bj0EX5RYvAI2EIvC57OmotfdtKA== + dependencies: + "@jest/types" "^28.1.3" + "@types/graceful-fs" "^4.1.3" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.9" + jest-regex-util "^28.0.2" + jest-util "^28.1.3" + jest-worker "^28.1.3" + micromatch "^4.0.4" + walker "^1.0.8" + optionalDependencies: + fsevents "^2.3.2" + +jest-leak-detector@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-28.1.3.tgz#a6685d9b074be99e3adee816ce84fd30795e654d" + integrity sha512-WFVJhnQsiKtDEo5lG2mM0v40QWnBM+zMdHHyJs8AWZ7J0QZJS59MsyKeJHWhpBZBH32S48FOVvGyOFT1h0DlqA== + dependencies: + jest-get-type "^28.0.2" + pretty-format "^28.1.3" + +jest-matcher-utils@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-28.1.3.tgz#5a77f1c129dd5ba3b4d7fc20728806c78893146e" + integrity sha512-kQeJ7qHemKfbzKoGjHHrRKH6atgxMk8Enkk2iPQ3XwO6oE/KYD8lMYOziCkeSB9G4adPM4nR1DE8Tf5JeWH6Bw== + dependencies: + chalk "^4.0.0" + jest-diff "^28.1.3" + jest-get-type "^28.0.2" + pretty-format "^28.1.3" + +jest-message-util@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-28.1.3.tgz#232def7f2e333f1eecc90649b5b94b0055e7c43d" + integrity sha512-PFdn9Iewbt575zKPf1286Ht9EPoJmYT7P0kY+RibeYZ2XtOr53pDLEFoTWXbd1h4JiGiWpTBC84fc8xMXQMb7g== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^28.1.3" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^28.1.3" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-mock@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-28.1.3.tgz#d4e9b1fc838bea595c77ab73672ebf513ab249da" + integrity sha512-o3J2jr6dMMWYVH4Lh/NKmDXdosrsJgi4AviS8oXLujcjpCMBb1FMsblDnOXKZKfSiHLxYub1eS0IHuRXsio9eA== + dependencies: + "@jest/types" "^28.1.3" + "@types/node" "*" + +jest-pnp-resolver@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" + integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== + +jest-regex-util@^28.0.2: + version "28.0.2" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-28.0.2.tgz#afdc377a3b25fb6e80825adcf76c854e5bf47ead" + integrity sha512-4s0IgyNIy0y9FK+cjoVYoxamT7Zeo7MhzqRGx7YDYmaQn1wucY9rotiGkBzzcMXTtjrCAP/f7f+E0F7+fxPNdw== + +jest-resolve-dependencies@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-28.1.3.tgz#8c65d7583460df7275c6ea2791901fa975c1fe66" + integrity sha512-qa0QO2Q0XzQoNPouMbCc7Bvtsem8eQgVPNkwn9LnS+R2n8DaVDPL/U1gngC0LTl1RYXJU0uJa2BMC2DbTfFrHA== + dependencies: + jest-regex-util "^28.0.2" + jest-snapshot "^28.1.3" + +jest-resolve@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-28.1.3.tgz#cfb36100341ddbb061ec781426b3c31eb51aa0a8" + integrity sha512-Z1W3tTjE6QaNI90qo/BJpfnvpxtaFTFw5CDgwpyE/Kz8U/06N1Hjf4ia9quUhCh39qIGWF1ZuxFiBiJQwSEYKQ== + dependencies: + chalk "^4.0.0" + graceful-fs "^4.2.9" + jest-haste-map "^28.1.3" + jest-pnp-resolver "^1.2.2" + jest-util "^28.1.3" + jest-validate "^28.1.3" + resolve "^1.20.0" + resolve.exports "^1.1.0" + slash "^3.0.0" + +jest-runner@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-28.1.3.tgz#5eee25febd730b4713a2cdfd76bdd5557840f9a1" + integrity sha512-GkMw4D/0USd62OVO0oEgjn23TM+YJa2U2Wu5zz9xsQB1MxWKDOlrnykPxnMsN0tnJllfLPinHTka61u0QhaxBA== + dependencies: + "@jest/console" "^28.1.3" + "@jest/environment" "^28.1.3" + "@jest/test-result" "^28.1.3" + "@jest/transform" "^28.1.3" + "@jest/types" "^28.1.3" + "@types/node" "*" + chalk "^4.0.0" + emittery "^0.10.2" + graceful-fs "^4.2.9" + jest-docblock "^28.1.1" + jest-environment-node "^28.1.3" + jest-haste-map "^28.1.3" + jest-leak-detector "^28.1.3" + jest-message-util "^28.1.3" + jest-resolve "^28.1.3" + jest-runtime "^28.1.3" + jest-util "^28.1.3" + jest-watcher "^28.1.3" + jest-worker "^28.1.3" + p-limit "^3.1.0" + source-map-support "0.5.13" + +jest-runtime@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-28.1.3.tgz#a57643458235aa53e8ec7821949e728960d0605f" + integrity sha512-NU+881ScBQQLc1JHG5eJGU7Ui3kLKrmwCPPtYsJtBykixrM2OhVQlpMmFWJjMyDfdkGgBMNjXCGB/ebzsgNGQw== + dependencies: + "@jest/environment" "^28.1.3" + "@jest/fake-timers" "^28.1.3" + "@jest/globals" "^28.1.3" + "@jest/source-map" "^28.1.2" + "@jest/test-result" "^28.1.3" + "@jest/transform" "^28.1.3" + "@jest/types" "^28.1.3" + chalk "^4.0.0" + cjs-module-lexer "^1.0.0" + collect-v8-coverage "^1.0.0" + execa "^5.0.0" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-haste-map "^28.1.3" + jest-message-util "^28.1.3" + jest-mock "^28.1.3" + jest-regex-util "^28.0.2" + jest-resolve "^28.1.3" + jest-snapshot "^28.1.3" + jest-util "^28.1.3" + slash "^3.0.0" + strip-bom "^4.0.0" + +jest-snapshot@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-28.1.3.tgz#17467b3ab8ddb81e2f605db05583d69388fc0668" + integrity sha512-4lzMgtiNlc3DU/8lZfmqxN3AYD6GGLbl+72rdBpXvcV+whX7mDrREzkPdp2RnmfIiWBg1YbuFSkXduF2JcafJg== + dependencies: + "@babel/core" "^7.11.6" + "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/traverse" "^7.7.2" + "@babel/types" "^7.3.3" + "@jest/expect-utils" "^28.1.3" + "@jest/transform" "^28.1.3" + "@jest/types" "^28.1.3" + "@types/babel__traverse" "^7.0.6" + "@types/prettier" "^2.1.5" + babel-preset-current-node-syntax "^1.0.0" + chalk "^4.0.0" + expect "^28.1.3" + graceful-fs "^4.2.9" + jest-diff "^28.1.3" + jest-get-type "^28.0.2" + jest-haste-map "^28.1.3" + jest-matcher-utils "^28.1.3" + jest-message-util "^28.1.3" + jest-util "^28.1.3" + natural-compare "^1.4.0" + pretty-format "^28.1.3" + semver "^7.3.5" + +jest-util@^28.0.0, jest-util@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-28.1.3.tgz#f4f932aa0074f0679943220ff9cbba7e497028b0" + integrity sha512-XdqfpHwpcSRko/C35uLYFM2emRAltIIKZiJ9eAmhjsj0CqZMa0p1ib0R5fWIqGhn1a103DebTbpqIaP1qCQ6tQ== + dependencies: + "@jest/types" "^28.1.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + +jest-validate@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-28.1.3.tgz#e322267fd5e7c64cea4629612c357bbda96229df" + integrity sha512-SZbOGBWEsaTxBGCOpsRWlXlvNkvTkY0XxRfh7zYmvd8uL5Qzyg0CHAXiXKROflh801quA6+/DsT4ODDthOC/OA== + dependencies: + "@jest/types" "^28.1.3" + camelcase "^6.2.0" + chalk "^4.0.0" + jest-get-type "^28.0.2" + leven "^3.1.0" + pretty-format "^28.1.3" + +jest-watcher@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-28.1.3.tgz#c6023a59ba2255e3b4c57179fc94164b3e73abd4" + integrity sha512-t4qcqj9hze+jviFPUN3YAtAEeFnr/azITXQEMARf5cMwKY2SMBRnCQTXLixTl20OR6mLh9KLMrgVJgJISym+1g== + dependencies: + "@jest/test-result" "^28.1.3" + "@jest/types" "^28.1.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + emittery "^0.10.2" + jest-util "^28.1.3" + string-length "^4.0.1" + +jest-worker@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-28.1.3.tgz#7e3c4ce3fa23d1bb6accb169e7f396f98ed4bb98" + integrity sha512-CqRA220YV/6jCo8VWvAt1KKx6eek1VIHMPeLEbpcfSfkEeWyBNppynM/o6q+Wmw+sOhos2ml34wZbSX3G13//g== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest@^28.1.1, jest@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest/-/jest-28.1.3.tgz#e9c6a7eecdebe3548ca2b18894a50f45b36dfc6b" + integrity sha512-N4GT5on8UkZgH0O5LUavMRV1EDEhNTL0KEfRmDIeZHSV7p2XgLoY9t9VDUgL6o+yfdgYHVxuz81G8oB9VG5uyA== + dependencies: + "@jest/core" "^28.1.3" + "@jest/types" "^28.1.3" + import-local "^3.0.2" + jest-cli "^28.1.3" + +js-crypto-env@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/js-crypto-env/-/js-crypto-env-0.3.2.tgz#02195723469da14449338ca2789fd7ff6784c533" + integrity sha512-F1uHiCkSOo36qBuuZABA4sBf+xeFBzhJZ0Sd7af8FAruszIhm1Xxv+Zr5Ne90Zlh7/fnxCsrdkj0N8f0a3lVlQ== + +js-crypto-hash@^0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/js-crypto-hash/-/js-crypto-hash-0.6.3.tgz#748e3e1853f69dad714636db3290736825506641" + integrity sha512-SG8c9tM8y3sUb4k7WvpVfu5vU7zfPvX+eaYR5578TvehkehdaQbqAc+y+1FwxnqQ3WZ0gsYoOKp/mW+mqtNoWA== + dependencies: + buffer "~5.4.3" + hash.js "~1.1.7" + js-crypto-env "^0.3.2" + md5 "~2.2.1" + sha3 "~2.1.0" + +js-crypto-hkdf@0.7.3: + version "0.7.3" + resolved "https://registry.yarnpkg.com/js-crypto-hkdf/-/js-crypto-hkdf-0.7.3.tgz#537c394a2e65bca80032daa07d2ffe7e4f78d32f" + integrity sha512-eAaVArAjS2GCacWGXY4hjBiexrLQYlI0PMOcbwtrSEj84XU3kUfMYZm9bpTyaTXgdHC/eQoXe/Of6biG+RSEaQ== + dependencies: + js-crypto-env "^0.3.2" + js-crypto-hmac "^0.6.3" + js-crypto-random "^0.4.3" + js-encoding-utils "0.5.6" + +js-crypto-hmac@^0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/js-crypto-hmac/-/js-crypto-hmac-0.6.3.tgz#c33352c1ee6076b17b8f4cb0e2167814b2b77d6d" + integrity sha512-T0pKOaHACOSG6Xs6/06G8RDDeZouQwIQNBq9L/zoUGsd4F67gAjpT3q2lGigAGpUd1hiyy7vnhvLpz7VDt6DbA== + dependencies: + js-crypto-env "^0.3.2" + js-crypto-hash "^0.6.3" + +js-crypto-random@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/js-crypto-random/-/js-crypto-random-0.4.3.tgz#898c2d91991eead02b4e461005e878fa9827fd74" + integrity sha512-C3gzphPPfw9jfQ9Q/LjhJMZxQNp3AaoVRDvyZkiB+zYltfs8tKQPsskWkXACpg1Nzh01PtSRUvVijjptd2qGHQ== + dependencies: + js-crypto-env "^0.3.2" + +js-encoding-utils@0.5.6: + version "0.5.6" + resolved "https://registry.yarnpkg.com/js-encoding-utils/-/js-encoding-utils-0.5.6.tgz#517351d8f4a85b2ad121183d41df8319981bee03" + integrity sha512-qnAGsUIWrmzh5n+3AXqbxX1KsB9hkQmJZf3aA9DLAS7GpL/NEHCBreFFbW+imramoU+Q0TDyvkwhRbBRH1TVkg== + +js-sdsl@^4.1.4: + version "4.2.0" + resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.2.0.tgz#278e98b7bea589b8baaf048c20aeb19eb7ad09d0" + integrity sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ== + +js-sha256@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/js-sha256/-/js-sha256-0.9.0.tgz#0b89ac166583e91ef9123644bd3c5334ce9d0966" + integrity sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA== + +js-sha3@0.8.0, js-sha3@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" + integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== + +js-sha512@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/js-sha512/-/js-sha512-0.8.0.tgz#dd22db8d02756faccf19f218e3ed61ec8249f7d4" + integrity sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ== + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@4.1.0, js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + +js-yaml@^3.10.0, js-yaml@^3.13.1: + version "3.14.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +json-bigint@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" + integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== + dependencies: + bignumber.js "^9.0.0" + +json-buffer@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898" + integrity sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ== + +json-parse-better-errors@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== + +json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + +json-stringify-nice@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz#2c937962b80181d3f317dd39aa323e14f5a60a67" + integrity sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw== + +json-stringify-safe@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== + +json5@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" + integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + dependencies: + minimist "^1.2.0" + +json5@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" + integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== + +jsonc-parser@3.2.0, jsonc-parser@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" + integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== + +jsonfile@^6.0.1, jsonfile@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + +jsonparse@^1.2.0, jsonparse@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" + integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== + +just-diff-apply@^5.2.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/just-diff-apply/-/just-diff-apply-5.4.1.tgz#1debed059ad009863b4db0e8d8f333d743cdd83b" + integrity sha512-AAV5Jw7tsniWwih8Ly3fXxEZ06y+6p5TwQMsw0dzZ/wPKilzyDgdAnL0Ug4NNIquPUOh1vfFWEHbmXUqM5+o8g== + +just-diff@^5.0.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/just-diff/-/just-diff-5.1.1.tgz#8da6414342a5ed6d02ccd64f5586cbbed3146202" + integrity sha512-u8HXJ3HlNrTzY7zrYYKjNEfBlyjqhdBkoyTVdjtn7p02RJD5NvR8rIClzeGA7t+UYP1/7eAkWNLU0+P3QrEqKQ== + +keccak@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.2.tgz#4c2c6e8c54e04f2670ee49fa734eb9da152206e0" + integrity sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" + +keyv@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.0.0.tgz#44923ba39e68b12a7cec7df6c3268c031f2ef373" + integrity sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA== + dependencies: + json-buffer "3.0.0" + +kind-of@^6.0.2, kind-of@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + +lerna@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-6.1.0.tgz#693145393ec22fd3ca98d817deab2246c1e2b107" + integrity sha512-3qAjIj8dgBwHtCAiLbq4VU/C1V9D1tvTLm2owZubdGAN72aB5TxuCu2mcw+yeEorOcXuR9YWx7EXIkAf+G0N2w== + dependencies: + "@lerna/add" "6.1.0" + "@lerna/bootstrap" "6.1.0" + "@lerna/changed" "6.1.0" + "@lerna/clean" "6.1.0" + "@lerna/cli" "6.1.0" + "@lerna/command" "6.1.0" + "@lerna/create" "6.1.0" + "@lerna/diff" "6.1.0" + "@lerna/exec" "6.1.0" + "@lerna/import" "6.1.0" + "@lerna/info" "6.1.0" + "@lerna/init" "6.1.0" + "@lerna/link" "6.1.0" + "@lerna/list" "6.1.0" + "@lerna/publish" "6.1.0" + "@lerna/run" "6.1.0" + "@lerna/version" "6.1.0" + "@nrwl/devkit" ">=14.8.6 < 16" + import-local "^3.0.2" + inquirer "^8.2.4" + npmlog "^6.0.2" + nx ">=14.8.6 < 16" + typescript "^3 || ^4" + +level-supports@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-4.0.1.tgz#431546f9d81f10ff0fea0e74533a0e875c08c66a" + integrity sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA== + +level-transcoder@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/level-transcoder/-/level-transcoder-1.0.1.tgz#f8cef5990c4f1283d4c86d949e73631b0bc8ba9c" + integrity sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w== + dependencies: + buffer "^6.0.3" + module-error "^1.0.1" + +level@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/level/-/level-8.0.0.tgz#41b4c515dabe28212a3e881b61c161ffead14394" + integrity sha512-ypf0jjAk2BWI33yzEaaotpq7fkOPALKAgDBxggO6Q9HGX2MRXn0wbP1Jn/tJv1gtL867+YOjOB49WaUF3UoJNQ== + dependencies: + browser-level "^1.0.1" + classic-level "^1.2.0" + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + +libnpmaccess@^6.0.3: + version "6.0.4" + resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-6.0.4.tgz#2dd158bd8a071817e2207d3b201d37cf1ad6ae6b" + integrity sha512-qZ3wcfIyUoW0+qSFkMBovcTrSGJ3ZeyvpR7d5N9pEYv/kXs8sHP2wiqEIXBKLFrZlmM0kR0RJD7mtfLngtlLag== + dependencies: + aproba "^2.0.0" + minipass "^3.1.1" + npm-package-arg "^9.0.1" + npm-registry-fetch "^13.0.0" + +libnpmpublish@^6.0.4: + version "6.0.5" + resolved "https://registry.yarnpkg.com/libnpmpublish/-/libnpmpublish-6.0.5.tgz#5a894f3de2e267d62f86be2a508e362599b5a4b1" + integrity sha512-LUR08JKSviZiqrYTDfywvtnsnxr+tOvBU0BF8H+9frt7HMvc6Qn6F8Ubm72g5hDTHbq8qupKfDvDAln2TVPvFg== + dependencies: + normalize-package-data "^4.0.0" + npm-package-arg "^9.0.1" + npm-registry-fetch "^13.0.0" + semver "^7.3.7" + ssri "^9.0.0" + +libsodium-wrappers@^0.7.6: + version "0.7.10" + resolved "https://registry.yarnpkg.com/libsodium-wrappers/-/libsodium-wrappers-0.7.10.tgz#13ced44cacb0fc44d6ac9ce67d725956089ce733" + integrity sha512-pO3F1Q9NPLB/MWIhehim42b/Fwb30JNScCNh8TcQ/kIc+qGLQch8ag8wb0keK3EP5kbGakk1H8Wwo7v+36rNQg== + dependencies: + libsodium "^0.7.0" + +libsodium@^0.7.0: + version "0.7.10" + resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.10.tgz#c2429a7e4c0836f879d701fec2c8a208af024159" + integrity sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ== + +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +load-json-file@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + integrity sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw== + dependencies: + graceful-fs "^4.1.2" + parse-json "^4.0.0" + pify "^3.0.0" + strip-bom "^3.0.0" + +load-json-file@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-6.2.0.tgz#5c7770b42cafa97074ca2848707c61662f4251a1" + integrity sha512-gUD/epcRms75Cw8RT1pUdHugZYM5ce64ucs2GEISABwkRsOQr0q2wm/MV2TKThycIe5e0ytRweW2RZxclogCdQ== + dependencies: + graceful-fs "^4.1.15" + parse-json "^5.0.0" + strip-bom "^4.0.0" + type-fest "^0.6.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA== + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash.ismatch@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" + integrity sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g== + +lodash.memoize@4.x: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +log-symbols@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" + integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== + dependencies: + chalk "^4.1.0" + is-unicode-supported "^0.1.0" + +long@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + +lowercase-keys@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.0.tgz#4e3366b39e7f5457e35f1324bdf6f88d0bfc7306" + integrity sha512-RPlX0+PHuvxVDZ7xX+EBVAp4RsVxP/TdDSN2mJYdiq1Lc4Hz7EUSjUI7RZrKKlmrIzVhf6Jo2stj7++gVarS0A== + +lowercase-keys@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" + integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1: + version "7.14.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.14.1.tgz#8da8d2f5f59827edb388e63e459ac23d6d408fea" + integrity sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA== + +lunr@^2.3.9: + version "2.3.9" + resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" + integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== + +make-dir@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" + integrity sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ== + dependencies: + pify "^3.0.0" + +make-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== + dependencies: + pify "^4.0.1" + semver "^5.6.0" + +make-dir@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== + dependencies: + semver "^6.0.0" + +make-error@1.x, make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +make-fetch-happen@^10.0.3, make-fetch-happen@^10.0.6: + version "10.2.1" + resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz#f5e3835c5e9817b617f2770870d9492d28678164" + integrity sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w== + dependencies: + agentkeepalive "^4.2.1" + cacache "^16.1.0" + http-cache-semantics "^4.1.0" + http-proxy-agent "^5.0.0" + https-proxy-agent "^5.0.0" + is-lambda "^1.0.1" + lru-cache "^7.7.1" + minipass "^3.1.6" + minipass-collect "^1.0.2" + minipass-fetch "^2.0.3" + minipass-flush "^1.0.5" + minipass-pipeline "^1.2.4" + negotiator "^0.6.3" + promise-retry "^2.0.1" + socks-proxy-agent "^7.0.0" + ssri "^9.0.0" + +makeerror@1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" + integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== + dependencies: + tmpl "1.0.5" + +map-obj@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + integrity sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg== + +map-obj@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" + integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== + +marked@^4.0.16: + version "4.2.3" + resolved "https://registry.yarnpkg.com/marked/-/marked-4.2.3.tgz#bd76a5eb510ff1d8421bc6c3b2f0b93488c15bea" + integrity sha512-slWRdJkbTZ+PjkyJnE30Uid64eHwbwa1Q25INCAYfZlK4o6ylagBy/Le9eWntqJFoFT93ikUKMv47GZ4gTwHkw== + +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +md5@~2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9" + integrity sha512-PlGG4z5mBANDGCKsYQe0CaUYHdZYZt8ZPZLmEt+Urf0W4GlpTX4HescwHU+dc9+Z/G/vZKYZYFrwgm9VxK6QOQ== + dependencies: + charenc "~0.0.1" + crypt "~0.0.1" + is-buffer "~1.1.1" + +meow@^8.0.0: + version "8.1.2" + resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.2.tgz#bcbe45bda0ee1729d350c03cffc8395a36c4e897" + integrity sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q== + dependencies: + "@types/minimist" "^1.2.0" + camelcase-keys "^6.2.2" + decamelize-keys "^1.1.0" + hard-rejection "^2.1.0" + minimist-options "4.1.0" + normalize-package-data "^3.0.0" + read-pkg-up "^7.0.1" + redent "^3.0.0" + trim-newlines "^3.0.0" + type-fest "^0.18.0" + yargs-parser "^20.2.3" + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + +mime-db@1.52.0, mime-db@^1.28.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12, mime-types@^2.1.34: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +mimic-response@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" + integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== + +mimic-response@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.1.0.tgz#d13763d35f613d09ec37ebb30bac0469c0ee8f43" + integrity sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA== + +min-indent@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" + integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== + +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== + +minimatch@3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.5.tgz#4da8f1290ee0f0f8e83d60ca69f8f134068604a3" + integrity sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^3.0.3, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^5.0.1, minimatch@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7" + integrity sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg== + dependencies: + brace-expansion "^2.0.1" + +minimist-options@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" + integrity sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A== + dependencies: + arrify "^1.0.1" + is-plain-obj "^1.1.0" + kind-of "^6.0.3" + +minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5, minimist@^1.2.6: + version "1.2.7" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" + integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== + +minipass-collect@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/minipass-collect/-/minipass-collect-1.0.2.tgz#22b813bf745dc6edba2576b940022ad6edc8c617" + integrity sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA== + dependencies: + minipass "^3.0.0" + +minipass-fetch@^2.0.3: + version "2.1.2" + resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-2.1.2.tgz#95560b50c472d81a3bc76f20ede80eaed76d8add" + integrity sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA== + dependencies: + minipass "^3.1.6" + minipass-sized "^1.0.3" + minizlib "^2.1.2" + optionalDependencies: + encoding "^0.1.13" + +minipass-flush@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/minipass-flush/-/minipass-flush-1.0.5.tgz#82e7135d7e89a50ffe64610a787953c4c4cbb373" + integrity sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw== + dependencies: + minipass "^3.0.0" + +minipass-json-stream@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minipass-json-stream/-/minipass-json-stream-1.0.1.tgz#7edbb92588fbfc2ff1db2fc10397acb7b6b44aa7" + integrity sha512-ODqY18UZt/I8k+b7rl2AENgbWE8IDYam+undIJONvigAz8KR5GWblsFTEfQs0WODsjbSXWlm+JHEv8Gr6Tfdbg== + dependencies: + jsonparse "^1.3.1" + minipass "^3.0.0" + +minipass-pipeline@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz#68472f79711c084657c067c5c6ad93cddea8214c" + integrity sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A== + dependencies: + minipass "^3.0.0" + +minipass-sized@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/minipass-sized/-/minipass-sized-1.0.3.tgz#70ee5a7c5052070afacfbc22977ea79def353b70" + integrity sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g== + dependencies: + minipass "^3.0.0" + +minipass@^3.0.0, minipass@^3.1.1, minipass@^3.1.6: + version "3.3.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.4.tgz#ca99f95dd77c43c7a76bf51e6d200025eee0ffae" + integrity sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw== + dependencies: + yallist "^4.0.0" + +minizlib@^2.1.1, minizlib@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" + integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg== + dependencies: + minipass "^3.0.0" + yallist "^4.0.0" + +miscreant@0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/miscreant/-/miscreant-0.3.2.tgz#a91c046566cca70bd6b5e9fbdd3f67617fa85034" + integrity sha512-fL9KxsQz9BJB2KGPMHFrReioywkiomBiuaLk6EuChijK0BsJsIKJXdVomR+/bPj5mvbFD6wM0CM3bZio9g7OHA== + +mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" + integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== + +mkdirp-infer-owner@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mkdirp-infer-owner/-/mkdirp-infer-owner-2.0.0.tgz#55d3b368e7d89065c38f32fd38e638f0ab61d316" + integrity sha512-sdqtiFt3lkOaYvTXSRIUjkIdPTcxgv5+fgqYE/5qgwdw12cOrAuzzgzvVExIkH/ul1oeHN3bCLOWSG3XOqbKKw== + dependencies: + chownr "^2.0.0" + infer-owner "^1.0.4" + mkdirp "^1.0.3" + +mkdirp@^1.0.3, mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + +modify-values@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" + integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== + +module-error@^1.0.1, module-error@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/module-error/-/module-error-1.0.2.tgz#8d1a48897ca883f47a45816d4fb3e3c6ba404d86" + integrity sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA== + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +ms@^2.0.0: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +multimatch@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-5.0.0.tgz#932b800963cea7a31a033328fa1e0c3a1874dbe6" + integrity sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA== + dependencies: + "@types/minimatch" "^3.0.3" + array-differ "^3.0.0" + array-union "^2.1.0" + arrify "^2.0.1" + minimatch "^3.0.4" + +multistream@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/multistream/-/multistream-4.1.0.tgz#7bf00dfd119556fbc153cff3de4c6d477909f5a8" + integrity sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw== + dependencies: + once "^1.4.0" + readable-stream "^3.6.0" + +mustache@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" + integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== + +mute-stream@0.0.8, mute-stream@~0.0.4: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== + +nan@^2.13.2: + version "2.17.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" + integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== + +nanoid@^3.3.3: + version "3.3.4" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" + integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== + +napi-build-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806" + integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg== + +napi-macros@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" + integrity sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg== + +natural-compare-lite@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" + integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + +near-api-js@^0.44.2: + version "0.44.2" + resolved "https://registry.yarnpkg.com/near-api-js/-/near-api-js-0.44.2.tgz#e451f68f2c56bd885c7b918db5818a3e6e9423d0" + integrity sha512-eMnc4V+geggapEUa3nU2p8HSHn/njtloI4P2mceHQWO8vDE1NGpnAw8FuTBrLmXSgIv9m6oocgFc9t3VNf5zwg== + dependencies: + bn.js "5.2.0" + borsh "^0.6.0" + bs58 "^4.0.0" + depd "^2.0.0" + error-polyfill "^0.1.3" + http-errors "^1.7.2" + js-sha256 "^0.9.0" + mustache "^4.0.0" + node-fetch "^2.6.1" + text-encoding-utf-8 "^1.0.2" + tweetnacl "^1.0.1" + +near-hd-key@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/near-hd-key/-/near-hd-key-1.2.1.tgz#f508ff15436cf8a439b543220f3cc72188a46756" + integrity sha512-SIrthcL5Wc0sps+2e1xGj3zceEa68TgNZDLuCx0daxmfTP7sFTB3/mtE2pYhlFsCxWoMn+JfID5E1NlzvvbRJg== + dependencies: + bip39 "3.0.2" + create-hmac "1.1.7" + tweetnacl "1.0.3" + +near-seed-phrase@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/near-seed-phrase/-/near-seed-phrase-0.2.0.tgz#fb7cf89682112b1160ab68abb50dc821f49be18a" + integrity sha512-NpmrnejpY1AdlRpDZ0schJQJtfBaoUheRfiYtQpcq9TkwPgqKZCRULV5L3hHmLc0ep7KRtikbPQ9R2ztN/3cyQ== + dependencies: + bip39-light "^1.0.7" + bs58 "^4.0.1" + near-hd-key "^1.2.1" + tweetnacl "^1.0.2" + +negotiator@^0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" + integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== + +neo-async@^2.6.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== + +node-abi@^2.21.0: + version "2.30.1" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.30.1.tgz#c437d4b1fe0e285aaf290d45b45d4d7afedac4cf" + integrity sha512-/2D0wOQPgaUWzVSVgRMx+trKJRC2UG4SUc4oCJoXx9Uxjtp0Vy3/kt7zcbxHF8+Z/pK3UloLWzBISg72brfy1w== + dependencies: + semver "^5.4.1" + +node-addon-api@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" + integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== + +node-addon-api@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" + integrity sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A== + +node-fetch@2, node-fetch@2.6.7, node-fetch@^2.6.1, node-fetch@^2.6.6, node-fetch@^2.6.7: + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== + dependencies: + whatwg-url "^5.0.0" + +node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.5.0.tgz#7a64eefa0b21112f89f58379da128ac177f20e40" + integrity sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg== + +node-gyp@^9.0.0: + version "9.3.0" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-9.3.0.tgz#f8eefe77f0ad8edb3b3b898409b53e697642b319" + integrity sha512-A6rJWfXFz7TQNjpldJ915WFb1LnhO4lIve3ANPbWreuEoLoKlFT3sxIepPBkLhM27crW8YmN+pjlgbasH6cH/Q== + dependencies: + env-paths "^2.2.0" + glob "^7.1.4" + graceful-fs "^4.2.6" + make-fetch-happen "^10.0.3" + nopt "^6.0.0" + npmlog "^6.0.0" + rimraf "^3.0.2" + semver "^7.3.5" + tar "^6.1.2" + which "^2.0.2" + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== + +node-releases@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" + integrity sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg== + +noms@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/noms/-/noms-0.0.0.tgz#da8ebd9f3af9d6760919b27d9cdc8092a7332859" + integrity sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow== + dependencies: + inherits "^2.0.1" + readable-stream "~1.0.31" + +nopt@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88" + integrity sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ== + dependencies: + abbrev "1" + +nopt@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-6.0.0.tgz#245801d8ebf409c6df22ab9d95b65e1309cdb16d" + integrity sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g== + dependencies: + abbrev "^1.0.0" + +normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-package-data@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.3.tgz#dbcc3e2da59509a0983422884cd172eefdfa525e" + integrity sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA== + dependencies: + hosted-git-info "^4.0.1" + is-core-module "^2.5.0" + semver "^7.3.4" + validate-npm-package-license "^3.0.1" + +normalize-package-data@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-4.0.1.tgz#b46b24e0616d06cadf9d5718b29b6d445a82a62c" + integrity sha512-EBk5QKKuocMJhB3BILuKhmaPjI8vNRSpIfO9woLC6NyHVkKKdVEdAO1mrT0ZfxNR1lKwCcTkuZfmGIFdizZ8Pg== + dependencies: + hosted-git-info "^5.0.0" + is-core-module "^2.8.1" + semver "^7.3.5" + validate-npm-package-license "^3.0.4" + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +normalize-url@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-2.0.1.tgz#835a9da1551fa26f70e92329069a23aa6574d7e6" + integrity sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw== + dependencies: + prepend-http "^2.0.0" + query-string "^5.0.1" + sort-keys "^2.0.0" + +npm-bundled@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.2.tgz#944c78789bd739035b70baa2ca5cc32b8d860bc1" + integrity sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ== + dependencies: + npm-normalize-package-bin "^1.0.1" + +npm-bundled@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-2.0.1.tgz#94113f7eb342cd7a67de1e789f896b04d2c600f4" + integrity sha512-gZLxXdjEzE/+mOstGDqR6b0EkhJ+kM6fxM6vUuckuctuVPh80Q6pw/rSZj9s4Gex9GxWtIicO1pc8DB9KZWudw== + dependencies: + npm-normalize-package-bin "^2.0.0" + +npm-install-checks@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/npm-install-checks/-/npm-install-checks-5.0.0.tgz#5ff27d209a4e3542b8ac6b0c1db6063506248234" + integrity sha512-65lUsMI8ztHCxFz5ckCEC44DRvEGdZX5usQFriauxHEwt7upv1FKaQEmAtU0YnOAdwuNWCmk64xYiQABNrEyLA== + dependencies: + semver "^7.1.1" + +npm-normalize-package-bin@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" + integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== + +npm-normalize-package-bin@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-2.0.0.tgz#9447a1adaaf89d8ad0abe24c6c84ad614a675fff" + integrity sha512-awzfKUO7v0FscrSpRoogyNm0sajikhBWpU0QMrW09AMi9n1PoKU6WaIqUzuJSQnpciZZmJ/jMZ2Egfmb/9LiWQ== + +npm-package-arg@8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-8.1.1.tgz#00ebf16ac395c63318e67ce66780a06db6df1b04" + integrity sha512-CsP95FhWQDwNqiYS+Q0mZ7FAEDytDZAkNxQqea6IaAFJTAY9Lhhqyl0irU/6PMc7BGfUmnsbHcqxJD7XuVM/rg== + dependencies: + hosted-git-info "^3.0.6" + semver "^7.0.0" + validate-npm-package-name "^3.0.0" + +npm-package-arg@^9.0.0, npm-package-arg@^9.0.1: + version "9.1.2" + resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-9.1.2.tgz#fc8acecb00235f42270dda446f36926ddd9ac2bc" + integrity sha512-pzd9rLEx4TfNJkovvlBSLGhq31gGu2QDexFPWT19yCDh0JgnRhlBLNo5759N0AJmBk+kQ9Y/hXoLnlgFD+ukmg== + dependencies: + hosted-git-info "^5.0.0" + proc-log "^2.0.1" + semver "^7.3.5" + validate-npm-package-name "^4.0.0" + +npm-packlist@^5.1.0, npm-packlist@^5.1.1: + version "5.1.3" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-5.1.3.tgz#69d253e6fd664b9058b85005905012e00e69274b" + integrity sha512-263/0NGrn32YFYi4J533qzrQ/krmmrWwhKkzwTuM4f/07ug51odoaNjUexxO4vxlzURHcmYMH1QjvHjsNDKLVg== + dependencies: + glob "^8.0.1" + ignore-walk "^5.0.1" + npm-bundled "^2.0.0" + npm-normalize-package-bin "^2.0.0" + +npm-pick-manifest@^7.0.0: + version "7.0.2" + resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-7.0.2.tgz#1d372b4e7ea7c6712316c0e99388a73ed3496e84" + integrity sha512-gk37SyRmlIjvTfcYl6RzDbSmS9Y4TOBXfsPnoYqTHARNgWbyDiCSMLUpmALDj4jjcTZpURiEfsSHJj9k7EV4Rw== + dependencies: + npm-install-checks "^5.0.0" + npm-normalize-package-bin "^2.0.0" + npm-package-arg "^9.0.0" + semver "^7.3.5" + +npm-registry-fetch@^13.0.0, npm-registry-fetch@^13.0.1, npm-registry-fetch@^13.3.0: + version "13.3.1" + resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-13.3.1.tgz#bb078b5fa6c52774116ae501ba1af2a33166af7e" + integrity sha512-eukJPi++DKRTjSBRcDZSDDsGqRK3ehbxfFUcgaRd0Yp6kRwOwh2WVn0r+8rMB4nnuzvAk6rQVzl6K5CkYOmnvw== + dependencies: + make-fetch-happen "^10.0.6" + minipass "^3.1.6" + minipass-fetch "^2.0.3" + minipass-json-stream "^1.0.1" + minizlib "^2.1.2" + npm-package-arg "^9.0.1" + proc-log "^2.0.0" + +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +npmlog@^4.0.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +npmlog@^6.0.0, npmlog@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-6.0.2.tgz#c8166017a42f2dea92d6453168dd865186a70830" + integrity sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg== + dependencies: + are-we-there-yet "^3.0.0" + console-control-strings "^1.1.0" + gauge "^4.0.3" + set-blocking "^2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ== + +nx@14.8.6, nx@^14.4.3: + version "14.8.6" + resolved "https://registry.yarnpkg.com/nx/-/nx-14.8.6.tgz#50bdfde1638478c60d9646d1d23e984a09801d38" + integrity sha512-QLU3sip/g3JdNO8n5Nw2esN+0G26Jsy3u1LlrB9Giu4zf/+KsfN8CcXMbEVqOnPR1FkCS52xliaq7IBQfvvMQA== + dependencies: + "@nrwl/cli" "14.8.6" + "@nrwl/tao" "14.8.6" + "@parcel/watcher" "2.0.4" + "@yarnpkg/lockfile" "^1.1.0" + "@yarnpkg/parsers" "^3.0.0-rc.18" + "@zkochan/js-yaml" "0.0.6" + axios "^1.0.0" + chalk "4.1.0" + chokidar "^3.5.1" + cli-cursor "3.1.0" + cli-spinners "2.6.1" + cliui "^7.0.2" + dotenv "~10.0.0" + enquirer "~2.3.6" + fast-glob "3.2.7" + figures "3.2.0" + flat "^5.0.2" + fs-extra "^10.1.0" + glob "7.1.4" + ignore "^5.0.4" + js-yaml "4.1.0" + jsonc-parser "3.2.0" + minimatch "3.0.5" + npm-run-path "^4.0.1" + open "^8.4.0" + semver "7.3.4" + string-width "^4.2.3" + strong-log-transformer "^2.1.0" + tar-stream "~2.2.0" + tmp "~0.2.1" + tsconfig-paths "^3.9.0" + tslib "^2.3.0" + v8-compile-cache "2.3.0" + yargs "^17.4.0" + yargs-parser "21.0.1" + +nx@15.2.4, "nx@>=14.8.6 < 16": + version "15.2.4" + resolved "https://registry.yarnpkg.com/nx/-/nx-15.2.4.tgz#de55a1342deb3ff2f7b123fe2bbef46c8495f792" + integrity sha512-8rTLo5WGmM6hEo5R/u03Jllkyj4vIUbBk2MRAppCvVRXWLS4xJUEOityXJ5BAvaKoLYm6sWUP1gqU7xlldnT5A== + dependencies: + "@nrwl/cli" "15.2.4" + "@nrwl/tao" "15.2.4" + "@parcel/watcher" "2.0.4" + "@yarnpkg/lockfile" "^1.1.0" + "@yarnpkg/parsers" "^3.0.0-rc.18" + "@zkochan/js-yaml" "0.0.6" + axios "^1.0.0" + chalk "4.1.0" + chokidar "^3.5.1" + cli-cursor "3.1.0" + cli-spinners "2.6.1" + cliui "^7.0.2" + dotenv "~10.0.0" + enquirer "~2.3.6" + fast-glob "3.2.7" + figures "3.2.0" + flat "^5.0.2" + fs-extra "^10.1.0" + glob "7.1.4" + ignore "^5.0.4" + js-yaml "4.1.0" + jsonc-parser "3.2.0" + minimatch "3.0.5" + npm-run-path "^4.0.1" + open "^8.4.0" + semver "7.3.4" + string-width "^4.2.3" + strong-log-transformer "^2.1.0" + tar-stream "~2.2.0" + tmp "~0.2.1" + tsconfig-paths "^3.9.0" + tslib "^2.3.0" + v8-compile-cache "2.3.0" + yargs "^17.6.2" + yargs-parser "21.1.1" + +o3@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/o3/-/o3-1.0.3.tgz#192ce877a882dfa6751f0412a865fafb2da1dac0" + integrity sha512-f+4n+vC6s4ysy7YO7O2gslWZBUu8Qj2i2OUJOvjRxQva7jVjYjB29jrr9NCjmxZQR0gzrOcv1RnqoYOeMs5VRQ== + dependencies: + capability "^0.2.5" + +object-assign@^4.0.1, object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== + +object-hash@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df" + integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA== + +object-inspect@^1.9.0: + version "1.12.2" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" + integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== + +object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +onetime@^5.1.0, onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +open@^8.4.0: + version "8.4.0" + resolved "https://registry.yarnpkg.com/open/-/open-8.4.0.tgz#345321ae18f8138f82565a910fdc6b39e8c244f8" + integrity sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q== + dependencies: + define-lazy-prop "^2.0.0" + is-docker "^2.1.1" + is-wsl "^2.2.0" + +optionator@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" + integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.3" + +ora@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18" + integrity sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ== + dependencies: + bl "^4.1.0" + chalk "^4.1.0" + cli-cursor "^3.1.0" + cli-spinners "^2.5.0" + is-interactive "^1.0.0" + is-unicode-supported "^0.1.0" + log-symbols "^4.1.0" + strip-ansi "^6.0.0" + wcwidth "^1.0.1" + +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== + +p-cancelable@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.4.1.tgz#35f363d67d52081c8d9585e37bcceb7e0bbcb2a0" + integrity sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ== + +p-event@^2.1.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/p-event/-/p-event-2.3.1.tgz#596279ef169ab2c3e0cae88c1cfbb08079993ef6" + integrity sha512-NQCqOFhbpVTMX4qMe8PF8lbGtzZ+LCiN7pcNrb/413Na7+TRoe1xkKUzuWa/YEJdGQ0FvKtj35EEbDoVPO2kbA== + dependencies: + p-timeout "^2.0.1" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow== + +p-is-promise@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-1.1.0.tgz#9c9456989e9f6588017b0434d56097675c3da05e" + integrity sha512-zL7VE4JVS2IFSkR2GQKDSPEVxkoH43/p7oEnwpdCndKYJO0HVeRB7fA8TJwuLOTBREtK0ea8eHaxdwcpob5dmg== + +p-is-promise@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-3.0.0.tgz#58e78c7dfe2e163cf2a04ff869e7c1dba64a5971" + integrity sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ== + +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== + dependencies: + p-try "^1.0.0" + +p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-limit@^3.0.2, p-limit@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg== + dependencies: + p-limit "^1.1.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +p-map-series@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-map-series/-/p-map-series-2.1.0.tgz#7560d4c452d9da0c07e692fdbfe6e2c81a2a91f2" + integrity sha512-RpYIIK1zXSNEOdwxcfe7FdvGcs7+y5n8rifMhMNWvaxRNMPINJHF5GDeuVxWqnfrcHPSCnp7Oo5yNXHId9Av2Q== + +p-map@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b" + integrity sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ== + dependencies: + aggregate-error "^3.0.0" + +p-pipe@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-pipe/-/p-pipe-3.1.0.tgz#48b57c922aa2e1af6a6404cb7c6bf0eb9cc8e60e" + integrity sha512-08pj8ATpzMR0Y80x50yJHn37NF6vjrqHutASaX5LiH5npS9XPvrUmscd9MF5R4fuYRHOxQR1FfMIlF7AzwoPqw== + +p-queue@^6.6.2: + version "6.6.2" + resolved "https://registry.yarnpkg.com/p-queue/-/p-queue-6.6.2.tgz#2068a9dcf8e67dd0ec3e7a2bcb76810faa85e426" + integrity sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ== + dependencies: + eventemitter3 "^4.0.4" + p-timeout "^3.2.0" + +p-reduce@^2.0.0, p-reduce@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-2.1.0.tgz#09408da49507c6c274faa31f28df334bc712b64a" + integrity sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw== + +p-timeout@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-2.0.1.tgz#d8dd1979595d2dc0139e1fe46b8b646cb3cdf038" + integrity sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA== + dependencies: + p-finally "^1.0.0" + +p-timeout@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-3.2.0.tgz#c7e17abc971d2a7962ef83626b35d635acf23dfe" + integrity sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg== + dependencies: + p-finally "^1.0.0" + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww== + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +p-waterfall@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/p-waterfall/-/p-waterfall-2.1.1.tgz#63153a774f472ccdc4eb281cdb2967fcf158b2ee" + integrity sha512-RRTnDb2TBG/epPRI2yYXsimO0v3BXC8Yd3ogr1545IaqKK17VGhbWVeGGN+XfCm/08OK8635nH31c8bATkHuSw== + dependencies: + p-reduce "^2.0.0" + +pacote@^13.0.3, pacote@^13.6.1: + version "13.6.2" + resolved "https://registry.yarnpkg.com/pacote/-/pacote-13.6.2.tgz#0d444ba3618ab3e5cd330b451c22967bbd0ca48a" + integrity sha512-Gu8fU3GsvOPkak2CkbojR7vjs3k3P9cA6uazKTHdsdV0gpCEQq2opelnEv30KRQWgVzP5Vd/5umjcedma3MKtg== + dependencies: + "@npmcli/git" "^3.0.0" + "@npmcli/installed-package-contents" "^1.0.7" + "@npmcli/promise-spawn" "^3.0.0" + "@npmcli/run-script" "^4.1.0" + cacache "^16.0.0" + chownr "^2.0.0" + fs-minipass "^2.1.0" + infer-owner "^1.0.4" + minipass "^3.1.6" + mkdirp "^1.0.4" + npm-package-arg "^9.0.0" + npm-packlist "^5.1.0" + npm-pick-manifest "^7.0.0" + npm-registry-fetch "^13.0.1" + proc-log "^2.0.0" + promise-retry "^2.0.1" + read-package-json "^5.0.0" + read-package-json-fast "^2.0.3" + rimraf "^3.0.2" + ssri "^9.0.0" + tar "^6.1.11" + +pako@1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" + integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-conflict-json@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/parse-conflict-json/-/parse-conflict-json-2.0.2.tgz#3d05bc8ffe07d39600dc6436c6aefe382033d323" + integrity sha512-jDbRGb00TAPFsKWCpZZOT93SxVP9nONOSgES3AevqRq/CHvavEBvKAjxX9p5Y5F0RZLxH9Ufd9+RwtCsa+lFDA== + dependencies: + json-parse-even-better-errors "^2.3.1" + just-diff "^5.0.1" + just-diff-apply "^5.2.0" + +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw== + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + +parse-json@^5.0.0, parse-json@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + +parse-path@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-7.0.0.tgz#605a2d58d0a749c8594405d8cc3a2bf76d16099b" + integrity sha512-Euf9GG8WT9CdqwuWJGdf3RkUcTBArppHABkO7Lm8IzRQp0e2r/kkFnmhu4TSK30Wcu5rVAZLmfPKSBBi9tWFog== + dependencies: + protocols "^2.0.0" + +parse-url@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/parse-url/-/parse-url-8.1.0.tgz#972e0827ed4b57fc85f0ea6b0d839f0d8a57a57d" + integrity sha512-xDvOoLU5XRrcOZvnI6b8zA6n9O9ejNk/GExuz1yBuWUGn9KA97GI6HTs6u02wKara1CeVmZhH+0TZFdWScR89w== + dependencies: + parse-path "^7.0.0" + +path-equal@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/path-equal/-/path-equal-1.1.2.tgz#260e7c449c4c2022f68cc5fa6e617e892858250d" + integrity sha512-p5kxPPwCdbf5AdXzT1bUBJomhgBlEjRBavYNr1XUpMFIE4Hnf2roueCMXudZK5tnaAu1tTmp3GPzqwJK45IHEA== + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ== + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +path-type@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== + dependencies: + pify "^3.0.0" + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +pbkdf2@^3.0.16, pbkdf2@^3.0.9, pbkdf2@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" + integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA== + dependencies: + create-hash "^1.1.2" + create-hmac "^1.1.4" + ripemd160 "^2.0.1" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +pend@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" + integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg== + +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +pify@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg== + +pify@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== + +pify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-5.0.0.tgz#1f5eca3f5e87ebec28cc6d54a0e4aaf00acc127f" + integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw== + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg== + +pirates@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" + integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ== + +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== + dependencies: + find-up "^4.0.0" + +pkg-fetch@3.4.2: + version "3.4.2" + resolved "https://registry.yarnpkg.com/pkg-fetch/-/pkg-fetch-3.4.2.tgz#6f68ebc54842b73f8c0808959a9df3739dcb28b7" + integrity sha512-0+uijmzYcnhC0hStDjm/cl2VYdrmVVBpe7Q8k9YBojxmR5tG8mvR9/nooQq3QSXiQqORDVOTY3XqMEqJVIzkHA== + dependencies: + chalk "^4.1.2" + fs-extra "^9.1.0" + https-proxy-agent "^5.0.0" + node-fetch "^2.6.6" + progress "^2.0.3" + semver "^7.3.5" + tar-fs "^2.1.1" + yargs "^16.2.0" + +pkg@^5.8.0: + version "5.8.0" + resolved "https://registry.yarnpkg.com/pkg/-/pkg-5.8.0.tgz#a77644aeff0b94a1656d7f76558837f7c754a4c0" + integrity sha512-8h9PUDYFi+LOMLbIyGRdP21g08mAtHidSpofSrf8LWhxUWGHymaRzcopEGiynB5EhQmZUKM6PQ9kCImV2TpdjQ== + dependencies: + "@babel/generator" "7.18.2" + "@babel/parser" "7.18.4" + "@babel/types" "7.18.4" + chalk "^4.1.2" + fs-extra "^9.1.0" + globby "^11.1.0" + into-stream "^6.0.0" + is-core-module "2.9.0" + minimist "^1.2.6" + multistream "^4.1.0" + pkg-fetch "3.4.2" + prebuild-install "6.1.4" + resolve "^1.22.0" + stream-meter "^1.0.4" + +prando@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/prando/-/prando-6.0.1.tgz#ffa8de84c2adc4975dd9df37ae4ada0458face53" + integrity sha512-ghUWxQ1T9IJmPu6eshc3VU0OwveUtXQ33ZLXYUcz1Oc5ppKLDXKp0TBDj6b0epwhEctzcQSNGR2iHyvQSn4W5A== + +prebuild-install@6.1.4: + version "6.1.4" + resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-6.1.4.tgz#ae3c0142ad611d58570b89af4986088a4937e00f" + integrity sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ== + dependencies: + detect-libc "^1.0.3" + expand-template "^2.0.3" + github-from-package "0.0.0" + minimist "^1.2.3" + mkdirp-classic "^0.5.3" + napi-build-utils "^1.0.1" + node-abi "^2.21.0" + npmlog "^4.0.1" + pump "^3.0.0" + rc "^1.2.7" + simple-get "^3.0.3" + tar-fs "^2.0.0" + tunnel-agent "^0.6.0" + +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + +prepend-http@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" + integrity sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA== + +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^2.3.0, prettier@^2.4.1, prettier@^2.5.1, prettier@^2.6.2, prettier@^2.7.1: + version "2.8.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.0.tgz#c7df58393c9ba77d6fba3921ae01faf994fb9dc9" + integrity sha512-9Lmg8hTFZKG0Asr/kW9Bp8tJjRVluO8EJQVfY2T7FMw9T5jy4I/Uvx0Rca/XWf50QQ1/SS48+6IJWnrb+2yemA== + +pretty-format@^28.0.0, pretty-format@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.3.tgz#c9fba8cedf99ce50963a11b27d982a9ae90970d5" + integrity sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q== + dependencies: + "@jest/schemas" "^28.1.3" + ansi-regex "^5.0.1" + ansi-styles "^5.0.0" + react-is "^18.0.0" + +proc-log@^2.0.0, proc-log@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-2.0.1.tgz#8f3f69a1f608de27878f91f5c688b225391cb685" + integrity sha512-Kcmo2FhfDTXdcbfDH76N7uBYHINxc/8GW7UAVuVP9I+Va3uHSerrnKV6dLooga/gh7GlgzuCCr/eoldnL1muGw== + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + +progress@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + +prom-client@^14.1.0: + version "14.1.0" + resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-14.1.0.tgz#049609859483d900844924df740722c76ed1fdbb" + integrity sha512-iFWCchQmi4170omLpFXbzz62SQTmPhtBL35v0qGEVRHKcqIeiexaoYeP0vfZTujxEq3tA87iqOdRbC9svS1B9A== + dependencies: + tdigest "^0.1.1" + +promise-all-reject-late@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz#f8ebf13483e5ca91ad809ccc2fcf25f26f8643c2" + integrity sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw== + +promise-call-limit@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/promise-call-limit/-/promise-call-limit-1.0.1.tgz#4bdee03aeb85674385ca934da7114e9bcd3c6e24" + integrity sha512-3+hgaa19jzCGLuSCbieeRsu5C2joKfYn8pY6JAuXFRVfF4IO+L7UPpFWNTeWT9pM7uhskvbPPd/oEOktCn317Q== + +promise-inflight@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" + integrity sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g== + +promise-retry@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/promise-retry/-/promise-retry-2.0.1.tgz#ff747a13620ab57ba688f5fc67855410c370da22" + integrity sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g== + dependencies: + err-code "^2.0.2" + retry "^0.12.0" + +prompts@^2.0.1, prompts@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" + integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.5" + +promzard@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/promzard/-/promzard-0.3.0.tgz#26a5d6ee8c7dee4cb12208305acfb93ba382a9ee" + integrity sha512-JZeYqd7UAcHCwI+sTOeUDYkvEU+1bQ7iE0UT1MgB/tERkAPkesW46MrpIySzODi+owTjZtiF8Ay5j9m60KmMBw== + dependencies: + read "1" + +proto-list@~1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + integrity sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA== + +protobufjs@6.11.3, protobufjs@^6.10.2, protobufjs@^6.11.2, protobufjs@^6.11.3, protobufjs@^6.8.8, protobufjs@~6.11.2: + version "6.11.3" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.3.tgz#637a527205a35caa4f3e2a9a4a13ddffe0e7af74" + integrity sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.1" + "@types/node" ">=13.7.0" + long "^4.0.0" + +protobufjs@~6.10.2: + version "6.10.3" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.10.3.tgz#11ed1dd02acbfcb330becf1611461d4b407f9eef" + integrity sha512-yvAslS0hNdBhlSKckI4R1l7wunVilX66uvrjzE4MimiAt7/qw1nLpMhZrn/ObuUTM/c3Xnfl01LYMdcSJe6dwg== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.1" + "@types/node" "^13.7.0" + long "^4.0.0" + +protocols@^2.0.0, protocols@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/protocols/-/protocols-2.0.1.tgz#8f155da3fc0f32644e83c5782c8e8212ccf70a86" + integrity sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q== + +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +q@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" + integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== + +qs@^6.10.5: + version "6.11.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" + integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== + dependencies: + side-channel "^1.0.4" + +query-string@^5.0.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" + integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== + dependencies: + decode-uri-component "^0.2.0" + object-assign "^4.1.0" + strict-uri-encode "^1.0.0" + +queue-microtask@^1.2.2, queue-microtask@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +quick-lru@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" + integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== + +randombytes@^2.0.1: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +react-is@^18.0.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" + integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + +read-cmd-shim@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-3.0.1.tgz#868c235ec59d1de2db69e11aec885bc095aea087" + integrity sha512-kEmDUoYf/CDy8yZbLTmhB1X9kkjf9Q80PCNsDMb7ufrGd6zZSQA1+UyjrO+pZm5K/S4OXCWJeiIt1JA8kAsa6g== + +read-package-json-fast@^2.0.2, read-package-json-fast@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/read-package-json-fast/-/read-package-json-fast-2.0.3.tgz#323ca529630da82cb34b36cc0b996693c98c2b83" + integrity sha512-W/BKtbL+dUjTuRL2vziuYhp76s5HZ9qQhd/dKfWIZveD0O40453QNyZhC0e63lqZrAQ4jiOapVoeJ7JrszenQQ== + dependencies: + json-parse-even-better-errors "^2.3.0" + npm-normalize-package-bin "^1.0.1" + +read-package-json@^5.0.0, read-package-json@^5.0.1: + version "5.0.2" + resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-5.0.2.tgz#b8779ccfd169f523b67208a89cc912e3f663f3fa" + integrity sha512-BSzugrt4kQ/Z0krro8zhTwV1Kd79ue25IhNN/VtHFy1mG/6Tluyi+msc0UpwaoQzxSHa28mntAjIZY6kEgfR9Q== + dependencies: + glob "^8.0.1" + json-parse-even-better-errors "^2.3.1" + normalize-package-data "^4.0.0" + npm-normalize-package-bin "^2.0.0" + +read-pkg-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07" + integrity sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw== + dependencies: + find-up "^2.0.0" + read-pkg "^3.0.0" + +read-pkg-up@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" + integrity sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg== + dependencies: + find-up "^4.1.0" + read-pkg "^5.2.0" + type-fest "^0.8.1" + +read-pkg@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + integrity sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA== + dependencies: + load-json-file "^4.0.0" + normalize-package-data "^2.3.2" + path-type "^3.0.0" + +read-pkg@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== + dependencies: + "@types/normalize-package-data" "^2.4.0" + normalize-package-data "^2.5.0" + parse-json "^5.0.0" + type-fest "^0.6.0" + +read@1, read@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" + integrity sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ== + dependencies: + mute-stream "~0.0.4" + +readable-stream@3, readable-stream@^3.0.0, readable-stream@^3.0.2, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readable-stream@^2.0.0, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.3.0, readable-stream@^2.3.5, readable-stream@~2.3.6: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@~1.0.31: + version "1.0.34" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + integrity sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +readdir-scoped-modules@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309" + integrity sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw== + dependencies: + debuglog "^1.0.1" + dezalgo "^1.0.0" + graceful-fs "^4.1.2" + once "^1.3.0" + +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + +readonly-date@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/readonly-date/-/readonly-date-1.0.0.tgz#5af785464d8c7d7c40b9d738cbde8c646f97dcd9" + integrity sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ== + +redent@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f" + integrity sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg== + dependencies: + indent-string "^4.0.0" + strip-indent "^3.0.0" + +regenerator-runtime@^0.13.10: + version "0.13.11" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" + integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== + +regexpp@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + +resolve-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== + dependencies: + resolve-from "^5.0.0" + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + +resolve.exports@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.0.tgz#5ce842b94b05146c0e03076985d1d0e7e48c90c9" + integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== + +resolve@^1.10.0, resolve@^1.20.0, resolve@^1.22.0: + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== + dependencies: + is-core-module "^2.9.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +responselike@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" + integrity sha512-/Fpe5guzJk1gPqdJLJR5u7eG/gNY4nImjbRDaVWVMRhne55TCmj2i9Q+54PBRfatRC8v/rIiv9BN0pMd9OV5EQ== + dependencies: + lowercase-keys "^1.0.0" + +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + +retry@0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" + integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg== + +retry@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" + integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^3.0.0, rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +ripemd160@^2.0.0, ripemd160@^2.0.1, ripemd160@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +rpc-websockets@^7.5.0: + version "7.5.0" + resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.5.0.tgz#bbeb87572e66703ff151e50af1658f98098e2748" + integrity sha512-9tIRi1uZGy7YmDjErf1Ax3wtqdSSLIlnmL5OtOzgd5eqPKbsPpwDP5whUDO2LQay3Xp0CcHlcNSGzacNRluBaQ== + dependencies: + "@babel/runtime" "^7.17.2" + eventemitter3 "^4.0.7" + uuid "^8.3.2" + ws "^8.5.0" + optionalDependencies: + bufferutil "^4.0.1" + utf-8-validate "^5.0.2" + +run-async@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" + integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== + +run-parallel-limit@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz#be80e936f5768623a38a963262d6bef8ff11e7ba" + integrity sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw== + dependencies: + queue-microtask "^1.2.2" + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + +rxjs@^7.5.5: + version "7.5.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39" + integrity sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA== + dependencies: + tslib "^2.1.0" + +safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-stable-stringify@^2.2.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.1.tgz#34694bd8a30575b7f94792aa51527551bd733d61" + integrity sha512-dVHE6bMtS/bnL2mwualjc6IxEv1F+OCUpA46pKUj6F8uDbUM0jCCulPqRNPSnWwGNKx5etqMjZYdXtrm5KJZGA== + +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +scrypt-js@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" + integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== + +secp256k1@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" + integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== + dependencies: + elliptic "^6.5.4" + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + +secretjs@^0.17.0: + version "0.17.8" + resolved "https://registry.yarnpkg.com/secretjs/-/secretjs-0.17.8.tgz#a7158ebf492727da8297f9b80cf9c83597e70cc9" + integrity sha512-PD/GUF52GjysBo8dDVK8KZXRXON1iPXkkyBNWIBVsaap3A1nZPbqynx/VUOjSpFx103KdjvzeA4+O0+EdWWWmw== + dependencies: + "@iov/crypto" "2.1.0" + "@iov/encoding" "2.1.0" + "@iov/utils" "2.0.2" + axios "0.21.1" + curve25519-js "0.0.4" + fast-deep-equal "3.1.1" + js-crypto-hkdf "0.7.3" + miscreant "0.3.2" + pako "1.0.11" + protobufjs "6.11.3" + secure-random "1.1.2" + +secure-random@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/secure-random/-/secure-random-1.1.2.tgz#ed103b460a851632d420d46448b2a900a41e7f7c" + integrity sha512-H2bdSKERKdBV1SwoqYm6C0y+9EA94v6SUBOWO8kDndc4NoUih7Dv6Tsgma7zO1lv27wIvjlD0ZpMQk7um5dheQ== + +seedrandom@^3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.5.tgz#54edc85c95222525b0c7a6f6b3543d8e0b3aa0a7" + integrity sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg== + +seek-bzip@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/seek-bzip/-/seek-bzip-1.0.6.tgz#35c4171f55a680916b52a07859ecf3b5857f21c4" + integrity sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ== + dependencies: + commander "^2.8.1" + +"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +semver@7.3.4: + version "7.3.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" + integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + dependencies: + lru-cache "^6.0.0" + +semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7: + version "7.3.8" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" + integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== + dependencies: + lru-cache "^6.0.0" + +semver@^6.0.0, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +set-blocking@^2.0.0, set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== + +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + +sha.js@^2.4.0, sha.js@^2.4.11, sha.js@^2.4.8: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +sha3@~2.1.0: + version "2.1.4" + resolved "https://registry.yarnpkg.com/sha3/-/sha3-2.1.4.tgz#000fac0fe7c2feac1f48a25e7a31b52a6492cc8f" + integrity sha512-S8cNxbyb0UGUM2VhRD4Poe5N58gJnJsLJ5vC7FYWGUmGhcsj4++WaIOBFVDxlG0W3To6xBuiRh+i0Qp2oNCOtg== + dependencies: + buffer "6.0.3" + +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +shiki@^0.10.1: + version "0.10.1" + resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.10.1.tgz#6f9a16205a823b56c072d0f1a0bcd0f2646bef14" + integrity sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng== + dependencies: + jsonc-parser "^3.0.0" + vscode-oniguruma "^1.6.1" + vscode-textmate "5.2.0" + +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + dependencies: + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" + +signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +simple-concat@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" + integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== + +simple-get@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.1.tgz#cc7ba77cfbe761036fbfce3d021af25fc5584d55" + integrity sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA== + dependencies: + decompress-response "^4.2.0" + once "^1.3.1" + simple-concat "^1.0.0" + +sisteransi@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" + integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +smart-buffer@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" + integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== + +snekfetch@^3.6.4: + version "3.6.4" + resolved "https://registry.yarnpkg.com/snekfetch/-/snekfetch-3.6.4.tgz#d13e80a616d892f3d38daae4289f4d258a645120" + integrity sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw== + +socks-proxy-agent@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz#dc069ecf34436621acb41e3efa66ca1b5fed15b6" + integrity sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww== + dependencies: + agent-base "^6.0.2" + debug "^4.3.3" + socks "^2.6.2" + +socks@^2.6.2: + version "2.7.1" + resolved "https://registry.yarnpkg.com/socks/-/socks-2.7.1.tgz#d8e651247178fde79c0663043e07240196857d55" + integrity sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ== + dependencies: + ip "^2.0.0" + smart-buffer "^4.2.0" + +sort-keys-length@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sort-keys-length/-/sort-keys-length-1.0.1.tgz#9cb6f4f4e9e48155a6aa0671edd336ff1479a188" + integrity sha512-GRbEOUqCxemTAk/b32F2xa8wDTs+Z1QHOkbhJDQTvv/6G3ZkbJ+frYWsTcc7cBB3Fu4wy4XlLCuNtJuMn7Gsvw== + dependencies: + sort-keys "^1.0.0" + +sort-keys@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad" + integrity sha512-vzn8aSqKgytVik0iwdBEi+zevbTYZogewTUM6dtpmGwEcdzbub/TX4bCzRhebDCRC3QzXgJsLRKB2V/Oof7HXg== + dependencies: + is-plain-obj "^1.0.0" + +sort-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-2.0.0.tgz#658535584861ec97d730d6cf41822e1f56684128" + integrity sha512-/dPCrG1s3ePpWm6yBbxZq5Be1dXGLyLn9Z791chDC3NFrpkVbWGzkBwPN1knaciexFXgRJ7hzdnwZ4stHSDmjg== + dependencies: + is-plain-obj "^1.0.0" + +sort-keys@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-4.2.0.tgz#6b7638cee42c506fff8c1cecde7376d21315be18" + integrity sha512-aUYIEU/UviqPgc8mHR6IW1EGxkAXpeRETYcrzg8cLAvUPZcpAlleSXHV2mY7G12GphSH6Gzv+4MMVSSkbdteHg== + dependencies: + is-plain-obj "^2.0.0" + +source-map-support@0.5.13: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-support@^0.5.21: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0, source-map@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +spdx-correct@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" + integrity sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" + integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.12" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz#69077835abe2710b65f03969898b6637b505a779" + integrity sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA== + +split2@^3.0.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" + integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== + dependencies: + readable-stream "^3.0.0" + +split@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" + integrity sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg== + dependencies: + through "2" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== + +ssri@^9.0.0, ssri@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/ssri/-/ssri-9.0.1.tgz#544d4c357a8d7b71a19700074b6883fcb4eae057" + integrity sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q== + dependencies: + minipass "^3.1.1" + +stack-utils@^2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + +"statuses@>= 1.5.0 < 2": + version "1.5.0" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" + integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== + +stream-meter@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/stream-meter/-/stream-meter-1.0.4.tgz#52af95aa5ea760a2491716704dbff90f73afdd1d" + integrity sha512-4sOEtrbgFotXwnEuzzsQBYEV1elAeFSO8rSGeTwabuX1RRn/kEq9JVH7I0MRBhKVRR0sJkr0M0QCH7yOLf9fhQ== + dependencies: + readable-stream "^2.1.4" + +stream-transform@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/stream-transform/-/stream-transform-3.2.1.tgz#4c8cbdd3e4fa7254c770ef34a962cec68349fcb0" + integrity sha512-ApK+WTJ5bCOf0A2tlec1qhvr8bGEBM/sgXXB7mysdCYgZJO5DZeaV3h3G+g0HnAQ372P5IhiGqnW29zoLOfTzQ== + +strict-uri-encode@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" + integrity sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ== + +string-length@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" + integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== + dependencies: + char-regex "^1.0.2" + strip-ansi "^6.0.0" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw== + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + integrity sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ== + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg== + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== + +strip-bom@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== + +strip-dirs@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/strip-dirs/-/strip-dirs-2.1.0.tgz#4987736264fc344cf20f6c34aca9d13d1d4ed6c5" + integrity sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g== + dependencies: + is-natural-number "^4.0.1" + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +strip-indent@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" + integrity sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ== + dependencies: + min-indent "^1.0.0" + +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== + +strip-outer@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/strip-outer/-/strip-outer-1.0.1.tgz#b2fd2abf6604b9d1e6013057195df836b8a9d631" + integrity sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg== + dependencies: + escape-string-regexp "^1.0.2" + +strong-log-transformer@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz#0f5ed78d325e0421ac6f90f7f10e691d6ae3ae10" + integrity sha512-B3Hgul+z0L9a236FAUC9iZsL+nVHgoCJnqCbN588DjYxvGXaXaaFbfmQ/JhvKjZwsOukuR72XbHv71Qkug0HxA== + dependencies: + duplexer "^0.1.1" + minimist "^1.2.0" + through "^2.3.4" + +superstruct@^0.14.2: + version "0.14.2" + resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-0.14.2.tgz#0dbcdf3d83676588828f1cf5ed35cda02f59025b" + integrity sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ== + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.0.0, supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +supports-color@^8.0.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + +supports-hyperlinks@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624" + integrity sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA== + dependencies: + has-flag "^4.0.0" + supports-color "^7.0.0" + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +symbol-observable@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-2.0.3.tgz#5b521d3d07a43c351055fa43b8355b62d33fd16a" + integrity sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA== + +tar-fs@^2.0.0, tar-fs@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784" + integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== + dependencies: + chownr "^1.1.1" + mkdirp-classic "^0.5.2" + pump "^3.0.0" + tar-stream "^2.1.4" + +tar-stream@^1.5.2: + version "1.6.2" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555" + integrity sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A== + dependencies: + bl "^1.0.0" + buffer-alloc "^1.2.0" + end-of-stream "^1.0.0" + fs-constants "^1.0.0" + readable-stream "^2.3.0" + to-buffer "^1.1.1" + xtend "^4.0.0" + +tar-stream@^2.1.4, tar-stream@~2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" + integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== + dependencies: + bl "^4.0.3" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + +tar@^6.1.0, tar@^6.1.11, tar@^6.1.2: + version "6.1.12" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.12.tgz#3b742fb05669b55671fb769ab67a7791ea1a62e6" + integrity sha512-jU4TdemS31uABHd+Lt5WEYJuzn+TJTCBLljvIAHZOz6M9Os5pJ4dD+vRFLxPa/n3T0iEFzpi+0x1UfuDZYbRMw== + dependencies: + chownr "^2.0.0" + fs-minipass "^2.0.0" + minipass "^3.0.0" + minizlib "^2.1.1" + mkdirp "^1.0.3" + yallist "^4.0.0" + +tdigest@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/tdigest/-/tdigest-0.1.2.tgz#96c64bac4ff10746b910b0e23b515794e12faced" + integrity sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA== + dependencies: + bintrees "1.0.2" + +temp-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d" + integrity sha512-xZFXEGbG7SNC3itwBzI3RYjq/cEhBkx2hJuKGIUOcEULmkQExXiHat2z/qkISYsuR+IKumhEfKKbV5qXmhICFQ== + +terminal-link@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" + integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== + dependencies: + ansi-escapes "^4.2.1" + supports-hyperlinks "^2.0.0" + +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== + dependencies: + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" + minimatch "^3.0.4" + +text-encoding-utf-8@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz#585b62197b0ae437e3c7b5d0af27ac1021e10d13" + integrity sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg== + +text-extensions@^1.0.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" + integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + +through2@^2.0.0, through2@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" + integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== + dependencies: + readable-stream "~2.3.6" + xtend "~4.0.1" + +through2@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764" + integrity sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw== + dependencies: + readable-stream "3" + +through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== + +timed-out@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" + integrity sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA== + +tiny-secp256k1@^1.1.3: + version "1.1.6" + resolved "https://registry.yarnpkg.com/tiny-secp256k1/-/tiny-secp256k1-1.1.6.tgz#7e224d2bee8ab8283f284e40e6b4acb74ffe047c" + integrity sha512-FmqJZGduTyvsr2cF3375fqGHUovSwDi/QytexX1Se4BPuPZpTE5Ftp5fg+EFSuEf3lhZqgCRjEG3ydUQ/aNiwA== + dependencies: + bindings "^1.3.0" + bn.js "^4.11.8" + create-hmac "^1.1.7" + elliptic "^6.4.0" + nan "^2.13.2" + +tmp-promise@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/tmp-promise/-/tmp-promise-3.0.3.tgz#60a1a1cc98c988674fcbfd23b6e3367bdeac4ce7" + integrity sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ== + dependencies: + tmp "^0.2.0" + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +tmp@^0.2.0, tmp@~0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" + integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== + dependencies: + rimraf "^3.0.0" + +tmpl@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== + +to-buffer@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80" + integrity sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg== + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +toidentifier@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + +treeverse@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/treeverse/-/treeverse-2.0.0.tgz#036dcef04bc3fd79a9b79a68d4da03e882d8a9ca" + integrity sha512-N5gJCkLu1aXccpOTtqV6ddSEi6ZmGkh3hjmbu1IjcavJK4qyOVQmi0myQKM7z5jVGmD68SJoliaVrMmVObhj6A== + +trim-newlines@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" + integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== + +trim-repeated@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/trim-repeated/-/trim-repeated-1.0.0.tgz#e3646a2ea4e891312bf7eace6cfb05380bc01c21" + integrity sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg== + dependencies: + escape-string-regexp "^1.0.2" + +ts-jest@^28.0.5, ts-jest@^28.0.8: + version "28.0.8" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-28.0.8.tgz#cd204b8e7a2f78da32cf6c95c9a6165c5b99cc73" + integrity sha512-5FaG0lXmRPzApix8oFG8RKjAz4ehtm8yMKOTy5HX3fY6W8kmvOrmcY0hKDElW52FJov+clhUbrKAqofnj4mXTg== + dependencies: + bs-logger "0.x" + fast-json-stable-stringify "2.x" + jest-util "^28.0.0" + json5 "^2.2.1" + lodash.memoize "4.x" + make-error "1.x" + semver "7.x" + yargs-parser "^21.0.1" + +ts-node@^10.2.1, ts-node@^10.8.1: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + +ts-poet@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/ts-poet/-/ts-poet-6.1.0.tgz#c5c3d679dfce1fe39acb5f5415275c5d6a598cb7" + integrity sha512-PFwbNJjGrb44wzHUGQicG2/nhjR+3+k7zYLDTa8D61NVUitl7K/JgIc9/P+8oMNenntKzLc8tjLDOkPrxIhm6A== + dependencies: + dprint-node "^1.0.7" + +ts-proto-descriptors@1.7.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/ts-proto-descriptors/-/ts-proto-descriptors-1.7.1.tgz#685d00305b06adfa929fd5a016a419382cd64c50" + integrity sha512-oIKUh3K4Xts4v29USGLfUG+2mEk32MsqpgZAOUyUlkrcIdv34yE+k2oZ2Nzngm6cV/JgFdOxRCqeyvmWHuYAyw== + dependencies: + long "^4.0.0" + protobufjs "^6.8.8" + +ts-proto@^1.115.4: + version "1.133.0" + resolved "https://registry.yarnpkg.com/ts-proto/-/ts-proto-1.133.0.tgz#7cf9bb98b0dc846d3785eb99911843e489bb6934" + integrity sha512-01cbHLUmRZuPCQvkA76hdZQqJQ65x/8NEBvHMaoYzL0lOMdoxWhvt6kubqmhr9dnUcveBb/pwxKH/f9pRSc2zw== + dependencies: + "@types/object-hash" "^1.3.0" + dataloader "^1.4.0" + object-hash "^1.3.1" + protobufjs "^6.11.3" + ts-poet "^6.1.0" + ts-proto-descriptors "1.7.1" + +tsconfig-paths@^3.9.0: + version "3.14.1" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz#ba0734599e8ea36c862798e920bcf163277b137a" + integrity sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.1" + minimist "^1.2.6" + strip-bom "^3.0.0" + +tslib@^1.8.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" + integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== + +tslog@^3.2.2, tslog@^3.3.3: + version "3.3.4" + resolved "https://registry.yarnpkg.com/tslog/-/tslog-3.3.4.tgz#083197a908c97b3b714a0576b9dac293f223f368" + integrity sha512-N0HHuHE0e/o75ALfkioFObknHR5dVchUad4F0XyFf3gXJYB++DewEzwGI/uIOM216E5a43ovnRNEeQIq9qgm4Q== + dependencies: + source-map-support "^0.5.21" + +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== + dependencies: + tslib "^1.8.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@1.0.3, tweetnacl@^1.0.1, tweetnacl@^1.0.2, tweetnacl@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" + integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + +type-detect@4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + +type-fest@^0.18.0: + version "0.18.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" + integrity sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw== + +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== + +type-fest@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.4.1.tgz#8bdf77743385d8a4f13ba95f610f5ccd68c728f8" + integrity sha512-IwzA/LSfD2vC1/YDYMv/zHP4rDF1usCwllsDpbolT3D4fUepIO7f9K70jjmUewU/LmGUKJcwcVtDCpnKk4BPMw== + +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== + +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + +type-tagger@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/type-tagger/-/type-tagger-1.0.0.tgz#dc6297e52e17097c1b92b42c16816a18f631e7f4" + integrity sha512-FIPqqpmDgdaulCnRoKv1/d3U4xVBUrYn42QXWNP3XYmgfPUDuBUsgFOb9ntT0aIe0UsUP+lknpQ5d9Kn36RssA== + +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== + +typedoc@^0.22.17: + version "0.22.18" + resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.22.18.tgz#1d000c33b66b88fd8cdfea14a26113a83b7e6591" + integrity sha512-NK9RlLhRUGMvc6Rw5USEYgT4DVAUFk7IF7Q6MYfpJ88KnTZP7EneEa4RcP+tX1auAcz7QT1Iy0bUSZBYYHdoyA== + dependencies: + glob "^8.0.3" + lunr "^2.3.9" + marked "^4.0.16" + minimatch "^5.1.0" + shiki "^0.10.1" + +typeforce@^1.11.5: + version "1.18.0" + resolved "https://registry.yarnpkg.com/typeforce/-/typeforce-1.18.0.tgz#d7416a2c5845e085034d70fcc5b6cc4a90edbfdc" + integrity sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g== + +typescript-json-schema@^0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/typescript-json-schema/-/typescript-json-schema-0.53.1.tgz#9204547f3e145169b40928998366ff6d28b81d32" + integrity sha512-Hg+RnOKUd38MOzC0rDft03a8xvwO+gCcj1F77smw2tCoZYQpFoLtrXWBGdvCX+REliko5WYel2kux17HPFqjLQ== + dependencies: + "@types/json-schema" "^7.0.9" + "@types/node" "^16.9.2" + glob "^7.1.7" + path-equal "1.1.2" + safe-stable-stringify "^2.2.0" + ts-node "^10.2.1" + typescript "~4.6.0" + yargs "^17.1.1" + +"typescript@^3 || ^4", typescript@^4.4.3, typescript@^4.5.5, typescript@^4.6.3, typescript@^4.6.4, typescript@^4.7.3, typescript@^4.7.4: + version "4.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db" + integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA== + +typescript@~4.6.0: + version "4.6.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" + integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== + +u3@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/u3/-/u3-0.1.1.tgz#5f52044f42ee76cd8de33148829e14528494b73b" + integrity sha512-+J5D5ir763y+Am/QY6hXNRlwljIeRMZMGs0cT6qqZVVzzT3X3nFPXVyPOFRMOR4kupB0T8JnCdpWdp6Q/iXn3w== + +uglify-js@^3.1.4: + version "3.17.4" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c" + integrity sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g== + +unbzip2-stream@^1.0.9: + version "1.4.3" + resolved "https://registry.yarnpkg.com/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz#b0da04c4371311df771cdc215e87f2130991ace7" + integrity sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg== + dependencies: + buffer "^5.2.1" + through "^2.3.8" + +unique-filename@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-2.0.1.tgz#e785f8675a9a7589e0ac77e0b5c34d2eaeac6da2" + integrity sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A== + dependencies: + unique-slug "^3.0.0" + +unique-names-generator@^4.6.0: + version "4.7.1" + resolved "https://registry.yarnpkg.com/unique-names-generator/-/unique-names-generator-4.7.1.tgz#966407b12ba97f618928f77322cfac8c80df5597" + integrity sha512-lMx9dX+KRmG8sq6gulYYpKWZc9RlGsgBR6aoO8Qsm3qvkSJ+3rAymr+TnV8EDMrIrwuFJ4kruzMWM/OpYzPoow== + +unique-slug@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-3.0.0.tgz#6d347cf57c8a7a7a6044aabd0e2d74e4d76dc7c9" + integrity sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w== + dependencies: + imurmurhash "^0.1.4" + +universal-user-agent@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee" + integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w== + +universalify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" + integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== + +unorm@^1.5.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.6.0.tgz#029b289661fba714f1a9af439eb51d9b16c205af" + integrity sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA== + +untildify@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" + integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw== + +upath@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/upath/-/upath-2.0.1.tgz#50c73dea68d6f6b990f51d279ce6081665d61a8b" + integrity sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w== + +update-browserslist-db@^1.0.9: + version "1.0.10" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz#0f54b876545726f17d00cd9a2561e6dade943ff3" + integrity sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +url-parse-lax@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-3.0.0.tgz#16b5cafc07dbe3676c1b1999177823d6503acb0c" + integrity sha512-NjFKA0DidqPa5ciFcSrXnAltTtzz84ogy+NebPvfEgAck0+TNg4UJ4IN+fB7zRZfbgUf0syOo9MDxFkDSMuFaQ== + dependencies: + prepend-http "^2.0.0" + +url-to-options@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9" + integrity sha512-0kQLIzG4fdk/G5NONku64rSH/x32NOA39LVQqlK8Le6lvTF6GGRJpqaQFGgU+CLwySIqBSMdwYM0sYcW9f6P4A== + +utf-8-validate@^5.0.2: + version "5.0.10" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" + integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== + dependencies: + node-gyp-build "^4.3.0" + +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + +util@^0.12.4: + version "0.12.5" + resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" + integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== + dependencies: + inherits "^2.0.3" + is-arguments "^1.0.4" + is-generator-function "^1.0.7" + is-typed-array "^1.1.3" + which-typed-array "^1.1.2" + +utility-types@^3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/utility-types/-/utility-types-3.10.0.tgz#ea4148f9a741015f05ed74fd615e1d20e6bed82b" + integrity sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg== + +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + +v8-compile-cache@2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" + integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== + +v8-to-istanbul@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz#b6f994b0b5d4ef255e17a0d17dc444a9f5132fa4" + integrity sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w== + dependencies: + "@jridgewell/trace-mapping" "^0.3.12" + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^1.6.0" + +validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + +validate-npm-package-name@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz#5fa912d81eb7d0c74afc140de7317f0ca7df437e" + integrity sha512-M6w37eVCMMouJ9V/sdPGnC5H4uDr73/+xdq0FBLO3TFFX1+7wiUY6Es328NN+y43tmY+doUdN9g9J21vqB7iLw== + dependencies: + builtins "^1.0.3" + +validate-npm-package-name@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz#fe8f1c50ac20afdb86f177da85b3600f0ac0d747" + integrity sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q== + dependencies: + builtins "^5.0.0" + +vlq@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-2.0.4.tgz#6057b85729245b9829e3cc7755f95b228d4fe041" + integrity sha512-aodjPa2wPQFkra1G8CzJBTHXhgk3EVSwxSWXNPr1fgdFLUb8kvLV1iEb6rFgasIsjP82HWI6dsb5Io26DDnasA== + +vscode-oniguruma@^1.6.1: + version "1.6.2" + resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz#aeb9771a2f1dbfc9083c8a7fdd9cccaa3f386607" + integrity sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA== + +vscode-textmate@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.2.0.tgz#01f01760a391e8222fe4f33fbccbd1ad71aed74e" + integrity sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ== + +walk-up-path@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/walk-up-path/-/walk-up-path-1.0.0.tgz#d4745e893dd5fd0dbb58dd0a4c6a33d9c9fec53e" + integrity sha512-hwj/qMDUEjCU5h0xr90KGCf0tg0/LgJbmOWgrWKYlcJZM7XvquvUJZ0G/HMGr7F7OQMOUuPHWP9JpriinkAlkg== + +walker@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" + integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== + dependencies: + makeerror "1.0.12" + +wcwidth@^1.0.0, wcwidth@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" + integrity sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg== + dependencies: + defaults "^1.0.3" + +webhook-discord@^3.7.8: + version "3.7.8" + resolved "https://registry.yarnpkg.com/webhook-discord/-/webhook-discord-3.7.8.tgz#856ce6928713ee7d1a05dbc8a64dfc233d0d816d" + integrity sha512-IDEvKmu83SIAPZD0efpEXj3ZEm+X8Q68iRuKEKtyXlGN9S9lVtdL7cp4I0AXqTapVj+eh+Wby7y9DaxP01Yk2g== + dependencies: + snekfetch "^3.6.4" + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +which-typed-array@^1.1.2: + version "1.1.9" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.9.tgz#307cf898025848cf995e795e8423c7f337efbde6" + integrity sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.0" + is-typed-array "^1.1.10" + +which@^2.0.1, which@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wide-align@^1.1.0, wide-align@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.5.tgz#df1d4c206854369ecf3c9a4898f1b23fbd9d15d3" + integrity sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg== + dependencies: + string-width "^1.0.2 || 2 || 3 || 4" + +wif@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/wif/-/wif-2.0.6.tgz#08d3f52056c66679299726fade0d432ae74b4704" + integrity sha512-HIanZn1zmduSF+BQhkE+YXIbEiH0xPr1012QbFEGB0xsKqJii0/SqJjyn8dFv6y36kOznMgMB+LGcbZTJ1xACQ== + dependencies: + bs58check "<3.0.0" + +word-wrap@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + +wordwrap@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== + +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +write-file-atomic@^2.4.2: + version "2.4.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" + integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +write-file-atomic@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" + integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== + dependencies: + imurmurhash "^0.1.4" + is-typedarray "^1.0.0" + signal-exit "^3.0.2" + typedarray-to-buffer "^3.1.5" + +write-file-atomic@^4.0.0, write-file-atomic@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" + integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== + dependencies: + imurmurhash "^0.1.4" + signal-exit "^3.0.7" + +write-json-file@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-3.2.0.tgz#65bbdc9ecd8a1458e15952770ccbadfcff5fe62a" + integrity sha512-3xZqT7Byc2uORAatYiP3DHUUAVEkNOswEWNs9H5KXiicRTvzYzYqKjYc4G7p+8pltvAw641lVByKVtMpf+4sYQ== + dependencies: + detect-indent "^5.0.0" + graceful-fs "^4.1.15" + make-dir "^2.1.0" + pify "^4.0.1" + sort-keys "^2.0.0" + write-file-atomic "^2.4.2" + +write-json-file@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-4.3.0.tgz#908493d6fd23225344af324016e4ca8f702dd12d" + integrity sha512-PxiShnxf0IlnQuMYOPPhPkhExoCQuTUNPOa/2JWCYTmBquU9njyyDuwRKN26IZBlp4yn1nt+Agh2HOOBl+55HQ== + dependencies: + detect-indent "^6.0.0" + graceful-fs "^4.1.15" + is-plain-obj "^2.0.0" + make-dir "^3.0.0" + sort-keys "^4.0.0" + write-file-atomic "^3.0.0" + +write-pkg@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/write-pkg/-/write-pkg-4.0.0.tgz#675cc04ef6c11faacbbc7771b24c0abbf2a20039" + integrity sha512-v2UQ+50TNf2rNHJ8NyWttfm/EJUBWMJcx6ZTYZr6Qp52uuegWw/lBkCtCbnYZEmPRNL61m+u67dAmGxo+HTULA== + dependencies: + sort-keys "^2.0.0" + type-fest "^0.4.1" + write-json-file "^3.2.0" + +ws@7.4.6: + version "7.4.6" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" + integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== + +ws@^7, ws@^7.4.5: + version "7.5.9" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" + integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== + +ws@^8.5.0: + version "8.11.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143" + integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg== + +xstream@^11.14.0: + version "11.14.0" + resolved "https://registry.yarnpkg.com/xstream/-/xstream-11.14.0.tgz#2c071d26b18310523b6877e86b4e54df068a9ae5" + integrity sha512-1bLb+kKKtKPbgTK6i/BaoAn03g47PpFstlbe1BA+y3pNS/LfvcaghS5BFf9+EE1J+KwSQsEpfJvFN5GqFtiNmw== + dependencies: + globalthis "^1.0.1" + symbol-observable "^2.0.3" + +xtend@^4.0.0, xtend@~4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yaml@^1.10.0: + version "1.10.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" + integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== + +yargs-parser@20.2.4: + version "20.2.4" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" + integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== + +yargs-parser@21.0.1: + version "21.0.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35" + integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg== + +yargs-parser@21.1.1, yargs-parser@^21.0.1, yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + +yargs-parser@^20.2.2, yargs-parser@^20.2.3: + version "20.2.9" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" + integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== + +yargs@^16.1.0, yargs@^16.2.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" + +yargs@^17.1.1, yargs@^17.3.1, yargs@^17.4.0, yargs@^17.6.2: + version "17.6.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.2.tgz#2e23f2944e976339a1ee00f18c77fedee8332541" + integrity sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + +yauzl@^2.10.0, yauzl@^2.4.2: + version "2.10.0" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" + integrity sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g== + dependencies: + buffer-crc32 "~0.2.3" + fd-slicer "~1.1.0" + +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==