From 5145fba5bd2011abd8bee47d3404f17c7a879f1b Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 19 Oct 2023 10:50:56 +0200 Subject: [PATCH] feat: add buf proto generation --- common/types/.gitignore | 4 +- common/types/buf/Dockerfile | 11 + common/types/buf/buf.gen.client.yaml | 6 + common/types/buf/buf.gen.lcd.yaml | 6 + common/types/buf/generate.sh | 3 + common/types/buf/proto/import.proto | 6 + common/types/package.json | 9 +- common/types/scripts/proto-gen.sh | 73 +- .../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 | 142 +- .../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 | 123 +- .../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 | 484 +- .../types/src/client/cosmos/gov/v1/query.ts | 571 ++- common/types/src/client/cosmos/gov/v1/tx.ts | 368 +- .../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 -- .../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 | 96 +- common/types/src/client/google/api/http.ts | 224 +- .../types/src/client/google/protobuf/any.ts | 82 +- .../src/client/google/protobuf/descriptor.ts | 3714 --------------- .../src/client/google/protobuf/duration.ts | 41 +- .../types/src/client/google/protobuf/empty.ts | 68 - .../src/client/google/protobuf/timestamp.ts | 49 +- .../client/kyve/bundles/v1beta1/bundles.ts | 853 +++- .../src/client/kyve/bundles/v1beta1/events.ts | 689 ++- .../client/kyve/bundles/v1beta1/genesis.ts | 81 +- .../src/client/kyve/bundles/v1beta1/params.ts | 63 +- .../src/client/kyve/bundles/v1beta1/query.ts | 44 +- .../src/client/kyve/bundles/v1beta1/tx.ts | 434 +- .../kyve/delegation/v1beta1/delegation.ts | 388 +- .../client/kyve/delegation/v1beta1/events.ts | 380 +- .../client/kyve/delegation/v1beta1/genesis.ts | 141 +- .../client/kyve/delegation/v1beta1/params.ts | 92 +- .../client/kyve/delegation/v1beta1/query.ts | 44 +- .../src/client/kyve/delegation/v1beta1/tx.ts | 304 +- .../src/client/kyve/global/v1beta1/events.ts | 57 +- .../src/client/kyve/global/v1beta1/genesis.ts | 27 +- .../src/client/kyve/global/v1beta1/global.ts | 154 +- .../src/client/kyve/global/v1beta1/query.ts | 44 +- .../src/client/kyve/global/v1beta1/tx.ts | 56 +- .../src/client/kyve/pool/v1beta1/events.ts | 751 ++- .../src/client/kyve/pool/v1beta1/genesis.ts | 55 +- .../src/client/kyve/pool/v1beta1/params.ts | 42 +- .../src/client/kyve/pool/v1beta1/pool.ts | 424 +- .../src/client/kyve/pool/v1beta1/query.ts | 44 +- .../types/src/client/kyve/pool/v1beta1/tx.ts | 686 ++- .../src/client/kyve/query/v1beta1/account.ts | 460 +- .../src/client/kyve/query/v1beta1/bundles.ts | 1180 +++-- .../client/kyve/query/v1beta1/delegation.ts | 381 +- .../src/client/kyve/query/v1beta1/params.ts | 120 +- .../src/client/kyve/query/v1beta1/pools.ts | 301 +- .../src/client/kyve/query/v1beta1/query.ts | 446 +- .../src/client/kyve/query/v1beta1/stakers.ts | 305 +- .../src/client/kyve/stakers/v1beta1/events.ts | 357 +- .../client/kyve/stakers/v1beta1/genesis.ts | 118 +- .../src/client/kyve/stakers/v1beta1/params.ts | 41 +- .../src/client/kyve/stakers/v1beta1/query.ts | 44 +- .../client/kyve/stakers/v1beta1/stakers.ts | 339 +- .../src/client/kyve/stakers/v1beta1/tx.ts | 442 +- .../src/client/kyve/team/v1beta1/events.ts | 291 +- .../src/client/kyve/team/v1beta1/genesis.ts | 56 +- .../src/client/kyve/team/v1beta1/query.ts | 707 ++- .../src/client/kyve/team/v1beta1/team.ts | 147 +- .../types/src/client/kyve/team/v1beta1/tx.ts | 344 +- .../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 | 142 +- .../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 | 123 +- .../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 | 484 +- common/types/src/lcd/cosmos/gov/v1/query.ts | 571 ++- common/types/src/lcd/cosmos/gov/v1/tx.ts | 368 +- .../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 -- .../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 | 96 +- common/types/src/lcd/google/api/http.ts | 224 +- common/types/src/lcd/google/protobuf/any.ts | 82 +- .../src/lcd/google/protobuf/descriptor.ts | 3844 --------------- .../types/src/lcd/google/protobuf/duration.ts | 41 +- common/types/src/lcd/google/protobuf/empty.ts | 68 - .../src/lcd/google/protobuf/timestamp.ts | 49 +- .../src/lcd/kyve/bundles/v1beta1/bundles.ts | 853 +++- .../src/lcd/kyve/bundles/v1beta1/events.ts | 689 ++- .../src/lcd/kyve/bundles/v1beta1/genesis.ts | 81 +- .../src/lcd/kyve/bundles/v1beta1/params.ts | 63 +- .../src/lcd/kyve/bundles/v1beta1/query.ts | 44 +- .../types/src/lcd/kyve/bundles/v1beta1/tx.ts | 434 +- .../lcd/kyve/delegation/v1beta1/delegation.ts | 388 +- .../src/lcd/kyve/delegation/v1beta1/events.ts | 380 +- .../lcd/kyve/delegation/v1beta1/genesis.ts | 141 +- .../src/lcd/kyve/delegation/v1beta1/params.ts | 92 +- .../src/lcd/kyve/delegation/v1beta1/query.ts | 44 +- .../src/lcd/kyve/delegation/v1beta1/tx.ts | 304 +- .../src/lcd/kyve/global/v1beta1/events.ts | 57 +- .../src/lcd/kyve/global/v1beta1/genesis.ts | 27 +- .../src/lcd/kyve/global/v1beta1/global.ts | 154 +- .../src/lcd/kyve/global/v1beta1/query.ts | 44 +- .../types/src/lcd/kyve/global/v1beta1/tx.ts | 56 +- .../types/src/lcd/kyve/pool/v1beta1/events.ts | 751 ++- .../src/lcd/kyve/pool/v1beta1/genesis.ts | 55 +- .../types/src/lcd/kyve/pool/v1beta1/params.ts | 42 +- .../types/src/lcd/kyve/pool/v1beta1/pool.ts | 424 +- .../types/src/lcd/kyve/pool/v1beta1/query.ts | 44 +- common/types/src/lcd/kyve/pool/v1beta1/tx.ts | 686 ++- .../src/lcd/kyve/query/v1beta1/account.ts | 460 +- .../src/lcd/kyve/query/v1beta1/bundles.ts | 1180 +++-- .../src/lcd/kyve/query/v1beta1/delegation.ts | 381 +- .../src/lcd/kyve/query/v1beta1/params.ts | 120 +- .../types/src/lcd/kyve/query/v1beta1/pools.ts | 301 +- .../types/src/lcd/kyve/query/v1beta1/query.ts | 446 +- .../src/lcd/kyve/query/v1beta1/stakers.ts | 305 +- .../src/lcd/kyve/stakers/v1beta1/events.ts | 357 +- .../src/lcd/kyve/stakers/v1beta1/genesis.ts | 118 +- .../src/lcd/kyve/stakers/v1beta1/params.ts | 41 +- .../src/lcd/kyve/stakers/v1beta1/query.ts | 44 +- .../src/lcd/kyve/stakers/v1beta1/stakers.ts | 339 +- .../types/src/lcd/kyve/stakers/v1beta1/tx.ts | 442 +- .../types/src/lcd/kyve/team/v1beta1/events.ts | 291 +- .../src/lcd/kyve/team/v1beta1/genesis.ts | 56 +- .../types/src/lcd/kyve/team/v1beta1/query.ts | 707 ++- .../types/src/lcd/kyve/team/v1beta1/team.ts | 147 +- common/types/src/lcd/kyve/team/v1beta1/tx.ts | 344 +- 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/src/version.ts | 2 +- yarn.lock | 11 + 312 files changed, 20496 insertions(+), 120224 deletions(-) create mode 100644 common/types/buf/Dockerfile create mode 100644 common/types/buf/buf.gen.client.yaml create mode 100644 common/types/buf/buf.gen.lcd.yaml create mode 100644 common/types/buf/generate.sh create mode 100644 common/types/buf/proto/import.proto delete mode 100644 common/types/src/client/cosmos/app/v1alpha1/config.ts delete mode 100644 common/types/src/client/cosmos/app/v1alpha1/module.ts delete mode 100644 common/types/src/client/cosmos/app/v1alpha1/query.ts delete mode 100644 common/types/src/client/cosmos/auth/v1beta1/auth.ts delete mode 100644 common/types/src/client/cosmos/auth/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/auth/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/authz/v1beta1/authz.ts delete mode 100644 common/types/src/client/cosmos/authz/v1beta1/event.ts delete mode 100644 common/types/src/client/cosmos/authz/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/authz/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/authz/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/bank/v1beta1/authz.ts delete mode 100644 common/types/src/client/cosmos/bank/v1beta1/bank.ts delete mode 100644 common/types/src/client/cosmos/bank/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/bank/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/bank/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/base/abci/v1beta1/abci.ts delete mode 100644 common/types/src/client/cosmos/base/kv/v1beta1/kv.ts delete mode 100644 common/types/src/client/cosmos/base/reflection/v1beta1/reflection.ts delete mode 100644 common/types/src/client/cosmos/base/reflection/v2alpha1/reflection.ts delete mode 100644 common/types/src/client/cosmos/base/snapshots/v1beta1/snapshot.ts delete mode 100644 common/types/src/client/cosmos/base/store/v1beta1/commit_info.ts delete mode 100644 common/types/src/client/cosmos/base/store/v1beta1/listening.ts delete mode 100644 common/types/src/client/cosmos/base/tendermint/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/capability/v1beta1/capability.ts delete mode 100644 common/types/src/client/cosmos/capability/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/crisis/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/crisis/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/crypto/ed25519/keys.ts delete mode 100644 common/types/src/client/cosmos/crypto/hd/v1/hd.ts delete mode 100644 common/types/src/client/cosmos/crypto/keyring/v1/record.ts delete mode 100644 common/types/src/client/cosmos/crypto/multisig/keys.ts delete mode 100644 common/types/src/client/cosmos/crypto/multisig/v1beta1/multisig.ts delete mode 100644 common/types/src/client/cosmos/crypto/secp256k1/keys.ts delete mode 100644 common/types/src/client/cosmos/crypto/secp256r1/keys.ts delete mode 100644 common/types/src/client/cosmos/distribution/v1beta1/distribution.ts delete mode 100644 common/types/src/client/cosmos/distribution/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/distribution/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/distribution/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/evidence/v1beta1/evidence.ts delete mode 100644 common/types/src/client/cosmos/evidence/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/evidence/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/evidence/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/feegrant/v1beta1/feegrant.ts delete mode 100644 common/types/src/client/cosmos/feegrant/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/feegrant/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/feegrant/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/genutil/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/gov/v1/genesis.ts delete mode 100644 common/types/src/client/cosmos/gov/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/gov/v1beta1/gov.ts delete mode 100644 common/types/src/client/cosmos/gov/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/gov/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/group/v1/events.ts delete mode 100644 common/types/src/client/cosmos/group/v1/genesis.ts delete mode 100644 common/types/src/client/cosmos/group/v1/query.ts delete mode 100644 common/types/src/client/cosmos/group/v1/tx.ts delete mode 100644 common/types/src/client/cosmos/group/v1/types.ts delete mode 100644 common/types/src/client/cosmos/mint/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/mint/v1beta1/mint.ts delete mode 100644 common/types/src/client/cosmos/mint/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/nft/v1beta1/event.ts delete mode 100644 common/types/src/client/cosmos/nft/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/nft/v1beta1/nft.ts delete mode 100644 common/types/src/client/cosmos/nft/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/nft/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/orm/v1/orm.ts delete mode 100644 common/types/src/client/cosmos/orm/v1alpha1/schema.ts delete mode 100644 common/types/src/client/cosmos/params/v1beta1/params.ts delete mode 100644 common/types/src/client/cosmos/params/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/slashing/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/slashing/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/slashing/v1beta1/slashing.ts delete mode 100644 common/types/src/client/cosmos/slashing/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/staking/v1beta1/authz.ts delete mode 100644 common/types/src/client/cosmos/staking/v1beta1/genesis.ts delete mode 100644 common/types/src/client/cosmos/staking/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/staking/v1beta1/staking.ts delete mode 100644 common/types/src/client/cosmos/staking/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/tx/signing/v1beta1/signing.ts delete mode 100644 common/types/src/client/cosmos/tx/v1beta1/service.ts delete mode 100644 common/types/src/client/cosmos/tx/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/upgrade/v1beta1/query.ts delete mode 100644 common/types/src/client/cosmos/upgrade/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/upgrade/v1beta1/upgrade.ts delete mode 100644 common/types/src/client/cosmos/vesting/v1beta1/tx.ts delete mode 100644 common/types/src/client/cosmos/vesting/v1beta1/vesting.ts delete mode 100644 common/types/src/client/google/protobuf/descriptor.ts delete mode 100644 common/types/src/client/google/protobuf/empty.ts delete mode 100644 common/types/src/client/tendermint/abci/types.ts delete mode 100644 common/types/src/client/tendermint/crypto/keys.ts delete mode 100644 common/types/src/client/tendermint/crypto/proof.ts delete mode 100644 common/types/src/client/tendermint/libs/bits/types.ts delete mode 100644 common/types/src/client/tendermint/p2p/types.ts delete mode 100644 common/types/src/client/tendermint/types/block.ts delete mode 100644 common/types/src/client/tendermint/types/evidence.ts delete mode 100644 common/types/src/client/tendermint/types/params.ts delete mode 100644 common/types/src/client/tendermint/types/types.ts delete mode 100644 common/types/src/client/tendermint/types/validator.ts delete mode 100644 common/types/src/client/tendermint/version/types.ts delete mode 100644 common/types/src/lcd/cosmos/app/v1alpha1/config.ts delete mode 100644 common/types/src/lcd/cosmos/app/v1alpha1/module.ts delete mode 100644 common/types/src/lcd/cosmos/app/v1alpha1/query.ts delete mode 100644 common/types/src/lcd/cosmos/auth/v1beta1/auth.ts delete mode 100644 common/types/src/lcd/cosmos/auth/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/auth/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/authz/v1beta1/authz.ts delete mode 100644 common/types/src/lcd/cosmos/authz/v1beta1/event.ts delete mode 100644 common/types/src/lcd/cosmos/authz/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/authz/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/authz/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/bank/v1beta1/authz.ts delete mode 100644 common/types/src/lcd/cosmos/bank/v1beta1/bank.ts delete mode 100644 common/types/src/lcd/cosmos/bank/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/bank/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/bank/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/base/abci/v1beta1/abci.ts delete mode 100644 common/types/src/lcd/cosmos/base/kv/v1beta1/kv.ts delete mode 100644 common/types/src/lcd/cosmos/base/reflection/v1beta1/reflection.ts delete mode 100644 common/types/src/lcd/cosmos/base/reflection/v2alpha1/reflection.ts delete mode 100644 common/types/src/lcd/cosmos/base/snapshots/v1beta1/snapshot.ts delete mode 100644 common/types/src/lcd/cosmos/base/store/v1beta1/commit_info.ts delete mode 100644 common/types/src/lcd/cosmos/base/store/v1beta1/listening.ts delete mode 100644 common/types/src/lcd/cosmos/base/tendermint/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/capability/v1beta1/capability.ts delete mode 100644 common/types/src/lcd/cosmos/capability/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/crisis/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/crisis/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/crypto/ed25519/keys.ts delete mode 100644 common/types/src/lcd/cosmos/crypto/hd/v1/hd.ts delete mode 100644 common/types/src/lcd/cosmos/crypto/keyring/v1/record.ts delete mode 100644 common/types/src/lcd/cosmos/crypto/multisig/keys.ts delete mode 100644 common/types/src/lcd/cosmos/crypto/multisig/v1beta1/multisig.ts delete mode 100644 common/types/src/lcd/cosmos/crypto/secp256k1/keys.ts delete mode 100644 common/types/src/lcd/cosmos/crypto/secp256r1/keys.ts delete mode 100644 common/types/src/lcd/cosmos/distribution/v1beta1/distribution.ts delete mode 100644 common/types/src/lcd/cosmos/distribution/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/distribution/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/distribution/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/evidence/v1beta1/evidence.ts delete mode 100644 common/types/src/lcd/cosmos/evidence/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/evidence/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/evidence/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/feegrant/v1beta1/feegrant.ts delete mode 100644 common/types/src/lcd/cosmos/feegrant/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/feegrant/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/feegrant/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/genutil/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/gov/v1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/gov/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/gov/v1beta1/gov.ts delete mode 100644 common/types/src/lcd/cosmos/gov/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/gov/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/group/v1/events.ts delete mode 100644 common/types/src/lcd/cosmos/group/v1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/group/v1/query.ts delete mode 100644 common/types/src/lcd/cosmos/group/v1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/group/v1/types.ts delete mode 100644 common/types/src/lcd/cosmos/mint/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/mint/v1beta1/mint.ts delete mode 100644 common/types/src/lcd/cosmos/mint/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/nft/v1beta1/event.ts delete mode 100644 common/types/src/lcd/cosmos/nft/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/nft/v1beta1/nft.ts delete mode 100644 common/types/src/lcd/cosmos/nft/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/nft/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/orm/v1/orm.ts delete mode 100644 common/types/src/lcd/cosmos/orm/v1alpha1/schema.ts delete mode 100644 common/types/src/lcd/cosmos/params/v1beta1/params.ts delete mode 100644 common/types/src/lcd/cosmos/params/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/slashing/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/slashing/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/slashing/v1beta1/slashing.ts delete mode 100644 common/types/src/lcd/cosmos/slashing/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/staking/v1beta1/authz.ts delete mode 100644 common/types/src/lcd/cosmos/staking/v1beta1/genesis.ts delete mode 100644 common/types/src/lcd/cosmos/staking/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/staking/v1beta1/staking.ts delete mode 100644 common/types/src/lcd/cosmos/staking/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/tx/signing/v1beta1/signing.ts delete mode 100644 common/types/src/lcd/cosmos/tx/v1beta1/service.ts delete mode 100644 common/types/src/lcd/cosmos/tx/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/upgrade/v1beta1/query.ts delete mode 100644 common/types/src/lcd/cosmos/upgrade/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/upgrade/v1beta1/upgrade.ts delete mode 100644 common/types/src/lcd/cosmos/vesting/v1beta1/tx.ts delete mode 100644 common/types/src/lcd/cosmos/vesting/v1beta1/vesting.ts delete mode 100644 common/types/src/lcd/google/protobuf/descriptor.ts delete mode 100644 common/types/src/lcd/google/protobuf/empty.ts delete mode 100644 common/types/src/lcd/tendermint/abci/types.ts delete mode 100644 common/types/src/lcd/tendermint/crypto/keys.ts delete mode 100644 common/types/src/lcd/tendermint/crypto/proof.ts delete mode 100644 common/types/src/lcd/tendermint/libs/bits/types.ts delete mode 100644 common/types/src/lcd/tendermint/p2p/types.ts delete mode 100644 common/types/src/lcd/tendermint/types/block.ts delete mode 100644 common/types/src/lcd/tendermint/types/evidence.ts delete mode 100644 common/types/src/lcd/tendermint/types/params.ts delete mode 100644 common/types/src/lcd/tendermint/types/types.ts delete mode 100644 common/types/src/lcd/tendermint/types/validator.ts delete mode 100644 common/types/src/lcd/tendermint/version/types.ts diff --git a/common/types/.gitignore b/common/types/.gitignore index 6196a904..a92c1e97 100644 --- a/common/types/.gitignore +++ b/common/types/.gitignore @@ -663,4 +663,6 @@ FodyWeavers.xsd ### 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 +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,macos,windows,node,webstorm+all + +tmp \ No newline at end of file diff --git a/common/types/buf/Dockerfile b/common/types/buf/Dockerfile new file mode 100644 index 00000000..e81543f2 --- /dev/null +++ b/common/types/buf/Dockerfile @@ -0,0 +1,11 @@ +FROM bufbuild/buf:latest as BUILDER + +RUN apk add --no-cache \ + nodejs \ + npm \ + git \ + make + +RUN npm install -g ts-proto + +COPY --from=BUILDER /usr/local/bin /usr/local/bin diff --git a/common/types/buf/buf.gen.client.yaml b/common/types/buf/buf.gen.client.yaml new file mode 100644 index 00000000..2d090203 --- /dev/null +++ b/common/types/buf/buf.gen.client.yaml @@ -0,0 +1,6 @@ +version: v1 +plugins: + - name: ts_proto + out: ../client + strategy: all + opt: esModuleInterop=true,forceLong=string,useOptionals=messages,snakeToCamel=false diff --git a/common/types/buf/buf.gen.lcd.yaml b/common/types/buf/buf.gen.lcd.yaml new file mode 100644 index 00000000..407dc6e2 --- /dev/null +++ b/common/types/buf/buf.gen.lcd.yaml @@ -0,0 +1,6 @@ +version: v1 +plugins: + - name: ts_proto + out: ../lcd + strategy: all + opt: esModuleInterop=true,forceLong=string,useOptionals=messages,snakeToCamel=false,stringEnums=true diff --git a/common/types/buf/generate.sh b/common/types/buf/generate.sh new file mode 100644 index 00000000..2256912d --- /dev/null +++ b/common/types/buf/generate.sh @@ -0,0 +1,3 @@ +cd proto +buf generate +cd .. diff --git a/common/types/buf/proto/import.proto b/common/types/buf/proto/import.proto new file mode 100644 index 00000000..73fe9996 --- /dev/null +++ b/common/types/buf/proto/import.proto @@ -0,0 +1,6 @@ +syntax = "proto3"; + +// Add imports here to generate the types from cosmos-sdk or any other proto files that you need + +import "cosmos/gov/v1/tx.proto"; + diff --git a/common/types/package.json b/common/types/package.json index 3fa72532..9aec5413 100644 --- a/common/types/package.json +++ b/common/types/package.json @@ -1,6 +1,6 @@ { "name": "@kyvejs/types", - "version": "1.0.3", + "version": "1.0.4", "main": "./dist/index.js", "types": "./dist/index.d.ts", "repository": { @@ -21,13 +21,6 @@ "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/proto-gen.sh b/common/types/scripts/proto-gen.sh index 1e0c0a9c..a86f57a5 100755 --- a/common/types/scripts/proto-gen.sh +++ b/common/types/scripts/proto-gen.sh @@ -1,37 +1,48 @@ #!/bin/bash -rm -rf temp -mkdir temp + +# Variables KYVE_CHAIN_REPO="git@github.com:KYVENetwork/chain.git" KYVE_CHAIN_VERSION="v1.3.0" -git -C ./temp clone -b ${KYVE_CHAIN_VERSION} --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/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 +echo "Cloning chain repo version ${KYVE_CHAIN_VERSION}" +mkdir -p ./tmp +git -C ./tmp clone -b ${KYVE_CHAIN_VERSION} --single-branch ${KYVE_CHAIN_REPO} + +# Setup protobuf docker image and build proto files +cd tmp/chain +cp ../../buf/Dockerfile ./proto/Dockerfile +cp ../../buf/generate.sh ./proto/generate.sh +cp ../../buf/proto/import.proto ./proto/kyve/import.proto +make proto-setup + +# Generate lcd proto files +echo "Generating proto files for lcd" +cp ../../buf/buf.gen.lcd.yaml ./proto/buf.gen.yaml +docker run --rm --volume "$(pwd)":/workspace --workdir /workspace kyve-proto sh ./proto/generate.sh + +# Generate client proto files +echo "Generating proto files for client" +cp ../../buf/buf.gen.client.yaml ./proto/buf.gen.yaml +docker run --rm --volume "$(pwd)":/workspace --workdir /workspace kyve-proto sh ./proto/generate.sh + +# Cleanup src folder +cd ../../ +rm -rf ./src/* + +# Copy generated files to src folder +cp -r tmp/chain/lcd ./src +cp -r tmp/chain/client ./src + +# Delete some files that cause problems (we don't need them anyway) +rm -rf ./src/lcd/google/protobuf/descriptor.ts +rm -rf ./src/lcd/kyve/import.ts +rm -rf ./src/client/google/protobuf/descriptor.ts +rm -rf ./src/client/kyve/import.ts + +# Set version echo "export const version = \"${KYVE_CHAIN_VERSION}\"" > ./src/version.ts +git add ./src + +# Cleanup +rm -rf ./tmp -git add ./src \ 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 deleted file mode 100644 index 2a4ecfb5..00000000 --- a/common/types/src/client/cosmos/app/v1alpha1/config.ts +++ /dev/null @@ -1,167 +0,0 @@ -/* 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 deleted file mode 100644 index eaebc57e..00000000 --- a/common/types/src/client/cosmos/app/v1alpha1/module.ts +++ /dev/null @@ -1,288 +0,0 @@ -/* 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 deleted file mode 100644 index bffe40f9..00000000 --- a/common/types/src/client/cosmos/app/v1alpha1/query.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* 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 deleted file mode 100644 index 7f0c9d19..00000000 --- a/common/types/src/client/cosmos/auth/v1beta1/auth.ts +++ /dev/null @@ -1,304 +0,0 @@ -/* 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 deleted file mode 100644 index c67683fe..00000000 --- a/common/types/src/client/cosmos/auth/v1beta1/genesis.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* 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 deleted file mode 100644 index 4fe0cbf9..00000000 --- a/common/types/src/client/cosmos/auth/v1beta1/query.ts +++ /dev/null @@ -1,900 +0,0 @@ -/* 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 deleted file mode 100644 index 13d9662e..00000000 --- a/common/types/src/client/cosmos/authz/v1beta1/authz.ts +++ /dev/null @@ -1,325 +0,0 @@ -/* 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 deleted file mode 100644 index 6a9f5469..00000000 --- a/common/types/src/client/cosmos/authz/v1beta1/event.ts +++ /dev/null @@ -1,175 +0,0 @@ -/* 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 deleted file mode 100644 index 5eb22427..00000000 --- a/common/types/src/client/cosmos/authz/v1beta1/genesis.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* 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 deleted file mode 100644 index f8fa6414..00000000 --- a/common/types/src/client/cosmos/authz/v1beta1/query.ts +++ /dev/null @@ -1,518 +0,0 @@ -/* 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 deleted file mode 100644 index 8341fcff..00000000 --- a/common/types/src/client/cosmos/authz/v1beta1/tx.ts +++ /dev/null @@ -1,495 +0,0 @@ -/* 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 deleted file mode 100644 index ddcc3b3f..00000000 --- a/common/types/src/client/cosmos/bank/v1beta1/authz.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* 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 deleted file mode 100644 index 6ad552cf..00000000 --- a/common/types/src/client/cosmos/bank/v1beta1/bank.ts +++ /dev/null @@ -1,604 +0,0 @@ -/* 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 deleted file mode 100644 index b0a000e9..00000000 --- a/common/types/src/client/cosmos/bank/v1beta1/genesis.ts +++ /dev/null @@ -1,201 +0,0 @@ -/* 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 deleted file mode 100644 index 5f7176bd..00000000 --- a/common/types/src/client/cosmos/bank/v1beta1/query.ts +++ /dev/null @@ -1,1356 +0,0 @@ -/* 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 deleted file mode 100644 index 034e8c6e..00000000 --- a/common/types/src/client/cosmos/bank/v1beta1/tx.ts +++ /dev/null @@ -1,291 +0,0 @@ -/* 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 deleted file mode 100644 index b3aaa489..00000000 --- a/common/types/src/client/cosmos/base/abci/v1beta1/abci.ts +++ /dev/null @@ -1,1035 +0,0 @@ -/* 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 deleted file mode 100644 index c9269e4c..00000000 --- a/common/types/src/client/cosmos/base/kv/v1beta1/kv.ts +++ /dev/null @@ -1,185 +0,0 @@ -/* 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 index f35cb45d..0c3902cf 100644 --- a/common/types/src/client/cosmos/base/query/v1beta1/pagination.ts +++ b/common/types/src/client/cosmos/base/query/v1beta1/pagination.ts @@ -70,7 +70,7 @@ export interface PageResponse { } function createBasePageRequest(): PageRequest { - return { key: new Uint8Array(), offset: "0", limit: "0", count_total: false, reverse: false }; + return { key: new Uint8Array(0), offset: "0", limit: "0", count_total: false, reverse: false }; } export const PageRequest = { @@ -94,59 +94,92 @@ export const PageRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.key = reader.bytes(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.offset = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.limit = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.count_total = reader.bool(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.reverse = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.String(object.offset) : "0", + limit: isSet(object.limit) ? globalThis.String(object.limit) : "0", + count_total: isSet(object.count_total) ? globalThis.Boolean(object.count_total) : false, + reverse: isSet(object.reverse) ? globalThis.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); + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== "0") { + obj.offset = message.offset; + } + if (message.limit !== "0") { + obj.limit = message.limit; + } + if (message.count_total === true) { + obj.count_total = message.count_total; + } + if (message.reverse === true) { + obj.reverse = message.reverse; + } return obj; }, + create, I>>(base?: I): PageRequest { + return PageRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): PageRequest { const message = createBasePageRequest(); - message.key = object.key ?? new Uint8Array(); + message.key = object.key ?? new Uint8Array(0); message.offset = object.offset ?? "0"; message.limit = object.limit ?? "0"; message.count_total = object.count_total ?? false; @@ -156,7 +189,7 @@ export const PageRequest = { }; function createBasePageResponse(): PageResponse { - return { next_key: new Uint8Array(), total: "0" }; + return { next_key: new Uint8Array(0), total: "0" }; } export const PageResponse = { @@ -171,68 +204,64 @@ export const PageResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.next_key = reader.bytes(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.total = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + next_key: isSet(object.next_key) ? bytesFromBase64(object.next_key) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.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); + if (message.next_key.length !== 0) { + obj.next_key = base64FromBytes(message.next_key); + } + if (message.total !== "0") { + obj.total = message.total; + } return obj; }, + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): PageResponse { const message = createBasePageResponse(); - message.next_key = object.next_key ?? new Uint8Array(); + message.next_key = object.next_key ?? new Uint8Array(0); 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")); @@ -252,7 +281,7 @@ function base64FromBytes(arr: Uint8Array): string { } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); return globalThis.btoa(bin.join("")); } @@ -261,7 +290,8 @@ function base64FromBytes(arr: Uint8Array): string { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/cosmos/base/reflection/v1beta1/reflection.ts b/common/types/src/client/cosmos/base/reflection/v1beta1/reflection.ts deleted file mode 100644 index b9491b68..00000000 --- a/common/types/src/client/cosmos/base/reflection/v1beta1/reflection.ts +++ /dev/null @@ -1,280 +0,0 @@ -/* 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 deleted file mode 100644 index 61d766d8..00000000 --- a/common/types/src/client/cosmos/base/reflection/v2alpha1/reflection.ts +++ /dev/null @@ -1,1750 +0,0 @@ -/* 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 deleted file mode 100644 index 236000e2..00000000 --- a/common/types/src/client/cosmos/base/snapshots/v1beta1/snapshot.ts +++ /dev/null @@ -1,734 +0,0 @@ -/* 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 deleted file mode 100644 index fad7da54..00000000 --- a/common/types/src/client/cosmos/base/store/v1beta1/commit_info.ts +++ /dev/null @@ -1,282 +0,0 @@ -/* 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 deleted file mode 100644 index aefc9d0f..00000000 --- a/common/types/src/client/cosmos/base/store/v1beta1/listening.ts +++ /dev/null @@ -1,157 +0,0 @@ -/* 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 deleted file mode 100644 index 1e02d7d7..00000000 --- a/common/types/src/client/cosmos/base/tendermint/v1beta1/query.ts +++ /dev/null @@ -1,1137 +0,0 @@ -/* 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 index b28eec03..70abf752 100644 --- a/common/types/src/client/cosmos/base/v1beta1/coin.ts +++ b/common/types/src/client/cosmos/base/v1beta1/coin.ts @@ -51,40 +51,56 @@ export const Coin = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.denom = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.amount = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Coin { return { - denom: isSet(object.denom) ? String(object.denom) : "", - amount: isSet(object.amount) ? String(object.amount) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", }; }, toJSON(message: Coin): unknown { const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.amount !== undefined && (obj.amount = message.amount); + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): Coin { + return Coin.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Coin { const message = createBaseCoin(); message.denom = object.denom ?? ""; @@ -109,40 +125,56 @@ export const DecCoin = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.denom = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.amount = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): DecCoin { return { - denom: isSet(object.denom) ? String(object.denom) : "", - amount: isSet(object.amount) ? String(object.amount) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", }; }, toJSON(message: DecCoin): unknown { const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.amount !== undefined && (obj.amount = message.amount); + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): DecCoin { + return DecCoin.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DecCoin { const message = createBaseDecCoin(); message.denom = object.denom ?? ""; @@ -164,33 +196,43 @@ export const IntProto = { }, decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.int = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): IntProto { - return { int: isSet(object.int) ? String(object.int) : "" }; + return { int: isSet(object.int) ? globalThis.String(object.int) : "" }; }, toJSON(message: IntProto): unknown { const obj: any = {}; - message.int !== undefined && (obj.int = message.int); + if (message.int !== "") { + obj.int = message.int; + } return obj; }, + create, I>>(base?: I): IntProto { + return IntProto.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): IntProto { const message = createBaseIntProto(); message.int = object.int ?? ""; @@ -211,33 +253,43 @@ export const DecProto = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.dec = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): DecProto { - return { dec: isSet(object.dec) ? String(object.dec) : "" }; + return { dec: isSet(object.dec) ? globalThis.String(object.dec) : "" }; }, toJSON(message: DecProto): unknown { const obj: any = {}; - message.dec !== undefined && (obj.dec = message.dec); + if (message.dec !== "") { + obj.dec = message.dec; + } return obj; }, + create, I>>(base?: I): DecProto { + return DecProto.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DecProto { const message = createBaseDecProto(); message.dec = object.dec ?? ""; @@ -248,7 +300,8 @@ export const DecProto = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/cosmos/capability/v1beta1/capability.ts b/common/types/src/client/cosmos/capability/v1beta1/capability.ts deleted file mode 100644 index db10e372..00000000 --- a/common/types/src/client/cosmos/capability/v1beta1/capability.ts +++ /dev/null @@ -1,210 +0,0 @@ -/* 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 deleted file mode 100644 index eab16eaa..00000000 --- a/common/types/src/client/cosmos/capability/v1beta1/genesis.ts +++ /dev/null @@ -1,172 +0,0 @@ -/* 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 deleted file mode 100644 index ea45d3e8..00000000 --- a/common/types/src/client/cosmos/crisis/v1beta1/genesis.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* 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 deleted file mode 100644 index 34aef3b9..00000000 --- a/common/types/src/client/cosmos/crisis/v1beta1/tx.ts +++ /dev/null @@ -1,161 +0,0 @@ -/* 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 deleted file mode 100644 index b774ec88..00000000 --- a/common/types/src/client/cosmos/crypto/ed25519/keys.ts +++ /dev/null @@ -1,178 +0,0 @@ -/* 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 deleted file mode 100644 index 622c613c..00000000 --- a/common/types/src/client/cosmos/crypto/hd/v1/hd.ts +++ /dev/null @@ -1,121 +0,0 @@ -/* 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 deleted file mode 100644 index 953bfbb9..00000000 --- a/common/types/src/client/cosmos/crypto/keyring/v1/record.ts +++ /dev/null @@ -1,357 +0,0 @@ -/* 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 deleted file mode 100644 index 22f0af90..00000000 --- a/common/types/src/client/cosmos/crypto/multisig/keys.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* 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 deleted file mode 100644 index 5eeeef5a..00000000 --- a/common/types/src/client/cosmos/crypto/multisig/v1beta1/multisig.ts +++ /dev/null @@ -1,195 +0,0 @@ -/* 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 deleted file mode 100644 index 379a8913..00000000 --- a/common/types/src/client/cosmos/crypto/secp256k1/keys.ts +++ /dev/null @@ -1,175 +0,0 @@ -/* 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 deleted file mode 100644 index 25234f80..00000000 --- a/common/types/src/client/cosmos/crypto/secp256r1/keys.ts +++ /dev/null @@ -1,176 +0,0 @@ -/* 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 deleted file mode 100644 index 9bec5691..00000000 --- a/common/types/src/client/cosmos/distribution/v1beta1/distribution.ts +++ /dev/null @@ -1,926 +0,0 @@ -/* 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 deleted file mode 100644 index c07645dd..00000000 --- a/common/types/src/client/cosmos/distribution/v1beta1/genesis.ts +++ /dev/null @@ -1,822 +0,0 @@ -/* 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 deleted file mode 100644 index 50a90ca0..00000000 --- a/common/types/src/client/cosmos/distribution/v1beta1/query.ts +++ /dev/null @@ -1,1269 +0,0 @@ -/* 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 deleted file mode 100644 index 5232c4d1..00000000 --- a/common/types/src/client/cosmos/distribution/v1beta1/tx.ts +++ /dev/null @@ -1,550 +0,0 @@ -/* 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 deleted file mode 100644 index 8ea296ed..00000000 --- a/common/types/src/client/cosmos/evidence/v1beta1/evidence.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* 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 deleted file mode 100644 index 1c72de38..00000000 --- a/common/types/src/client/cosmos/evidence/v1beta1/genesis.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 deleted file mode 100644 index 00a3f793..00000000 --- a/common/types/src/client/cosmos/evidence/v1beta1/query.ts +++ /dev/null @@ -1,345 +0,0 @@ -/* 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 deleted file mode 100644 index 1901a2ee..00000000 --- a/common/types/src/client/cosmos/evidence/v1beta1/tx.ts +++ /dev/null @@ -1,215 +0,0 @@ -/* 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 deleted file mode 100644 index d10f8c3d..00000000 --- a/common/types/src/client/cosmos/feegrant/v1beta1/feegrant.ts +++ /dev/null @@ -1,405 +0,0 @@ -/* 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 deleted file mode 100644 index ff8d4af5..00000000 --- a/common/types/src/client/cosmos/feegrant/v1beta1/genesis.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* 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 deleted file mode 100644 index d848ef96..00000000 --- a/common/types/src/client/cosmos/feegrant/v1beta1/query.ts +++ /dev/null @@ -1,477 +0,0 @@ -/* 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 deleted file mode 100644 index 52ae7023..00000000 --- a/common/types/src/client/cosmos/feegrant/v1beta1/tx.ts +++ /dev/null @@ -1,296 +0,0 @@ -/* 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 deleted file mode 100644 index 1c42d365..00000000 --- a/common/types/src/client/cosmos/genutil/v1beta1/genesis.ts +++ /dev/null @@ -1,116 +0,0 @@ -/* 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 deleted file mode 100644 index 196797c7..00000000 --- a/common/types/src/client/cosmos/gov/v1/genesis.ts +++ /dev/null @@ -1,182 +0,0 @@ -/* 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 index 8d54d031..5c2ba4fc 100644 --- a/common/types/src/client/cosmos/gov/v1/gov.ts +++ b/common/types/src/client/cosmos/gov/v1/gov.ts @@ -69,7 +69,7 @@ export function voteOptionToJSON(object: VoteOption): string { /** 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 defines the default proposal status. */ PROPOSAL_STATUS_UNSPECIFIED = 0, /** * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit @@ -172,12 +172,14 @@ export interface Proposal { * 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; + final_tally_result?: TallyResult | undefined; + submit_time?: Date | undefined; + deposit_end_time?: Date | undefined; total_deposit: Coin[]; - voting_start_time?: Date; - voting_end_time?: Date; + voting_start_time?: Date | undefined; + voting_end_time?: + | Date + | undefined; /** metadata is any arbitrary metadata attached to the proposal. */ metadata: string; } @@ -210,13 +212,13 @@ export interface DepositParams { * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 * months. */ - max_deposit_period?: Duration; + max_deposit_period?: Duration | undefined; } /** VotingParams defines the params for voting on governance proposals. */ export interface VotingParams { /** Length of the voting period. */ - voting_period?: Duration; + voting_period?: Duration | undefined; } /** TallyParams defines the params for tallying votes on governance proposals. */ @@ -251,22 +253,31 @@ export const WeightedVoteOption = { }, decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.option = reader.int32() as any; - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.weight = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -274,17 +285,24 @@ export const WeightedVoteOption = { fromJSON(object: any): WeightedVoteOption { return { option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, - weight: isSet(object.weight) ? String(object.weight) : "", + weight: isSet(object.weight) ? globalThis.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); + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.weight !== "") { + obj.weight = message.weight; + } return obj; }, + create, I>>(base?: I): WeightedVoteOption { + return WeightedVoteOption.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): WeightedVoteOption { const message = createBaseWeightedVoteOption(); message.option = object.option ?? 0; @@ -312,49 +330,67 @@ export const Deposit = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Deposit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.depositor = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.amount.push(Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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)) : [], + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + amount: globalThis.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 = []; + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); } return obj; }, + create, I>>(base?: I): Deposit { + return Deposit.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Deposit { const message = createBaseDeposit(); message.proposal_id = object.proposal_id ?? "0"; @@ -415,93 +451,148 @@ export const Proposal = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.messages.push(Any.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.status = reader.int32() as any; - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.final_tally_result = TallyResult.decode(reader, reader.uint32()); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.deposit_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.total_deposit.push(Coin.decode(reader, reader.uint32())); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.voting_start_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; + continue; case 9: + if (tag !== 74) { + break; + } + message.voting_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; + continue; case 10: + if (tag !== 82) { + break; + } + message.metadata = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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)) : [], + id: isSet(object.id) ? globalThis.String(object.id) : "0", + messages: globalThis.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)) : [], + total_deposit: globalThis.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) : "", + metadata: isSet(object.metadata) ? globalThis.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); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.final_tally_result !== undefined) { + obj.final_tally_result = TallyResult.toJSON(message.final_tally_result); + } + if (message.submit_time !== undefined) { + obj.submit_time = message.submit_time.toISOString(); + } + if (message.deposit_end_time !== undefined) { + obj.deposit_end_time = message.deposit_end_time.toISOString(); + } + if (message.total_deposit?.length) { + obj.total_deposit = message.total_deposit.map((e) => Coin.toJSON(e)); + } + if (message.voting_start_time !== undefined) { + obj.voting_start_time = message.voting_start_time.toISOString(); + } + if (message.voting_end_time !== undefined) { + obj.voting_end_time = message.voting_end_time.toISOString(); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } return obj; }, + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Proposal { const message = createBaseProposal(); message.id = object.id ?? "0"; @@ -542,50 +633,78 @@ export const TallyResult = { }, decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.yes_count = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.abstain_count = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.no_count = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.no_with_veto_count = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + yes_count: isSet(object.yes_count) ? globalThis.String(object.yes_count) : "", + abstain_count: isSet(object.abstain_count) ? globalThis.String(object.abstain_count) : "", + no_count: isSet(object.no_count) ? globalThis.String(object.no_count) : "", + no_with_veto_count: isSet(object.no_with_veto_count) ? globalThis.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); + if (message.yes_count !== "") { + obj.yes_count = message.yes_count; + } + if (message.abstain_count !== "") { + obj.abstain_count = message.abstain_count; + } + if (message.no_count !== "") { + obj.no_count = message.no_count; + } + if (message.no_with_veto_count !== "") { + obj.no_with_veto_count = message.no_with_veto_count; + } return obj; }, + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): TallyResult { const message = createBaseTallyResult(); message.yes_count = object.yes_count ?? ""; @@ -618,54 +737,80 @@ export const Vote = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Vote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.voter = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.metadata = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } return obj; }, + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Vote { const message = createBaseVote(); message.proposal_id = object.proposal_id ?? "0"; @@ -692,45 +837,58 @@ export const DepositParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.min_deposit.push(Coin.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.max_deposit_period = Duration.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): DepositParams { return { - min_deposit: Array.isArray(object?.min_deposit) ? object.min_deposit.map((e: any) => Coin.fromJSON(e)) : [], + min_deposit: globalThis.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 = []; + if (message.min_deposit?.length) { + obj.min_deposit = message.min_deposit.map((e) => Coin.toJSON(e)); + } + if (message.max_deposit_period !== undefined) { + obj.max_deposit_period = Duration.toJSON(message.max_deposit_period); } - message.max_deposit_period !== undefined && - (obj.max_deposit_period = message.max_deposit_period ? Duration.toJSON(message.max_deposit_period) : undefined); return obj; }, + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DepositParams { const message = createBaseDepositParams(); message.min_deposit = object.min_deposit?.map((e) => Coin.fromPartial(e)) || []; @@ -754,19 +912,24 @@ export const VotingParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.voting_period = Duration.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -777,11 +940,15 @@ export const VotingParams = { toJSON(message: VotingParams): unknown { const obj: any = {}; - message.voting_period !== undefined && - (obj.voting_period = message.voting_period ? Duration.toJSON(message.voting_period) : undefined); + if (message.voting_period !== undefined) { + obj.voting_period = Duration.toJSON(message.voting_period); + } return obj; }, + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): VotingParams { const message = createBaseVotingParams(); message.voting_period = (object.voting_period !== undefined && object.voting_period !== null) @@ -810,45 +977,67 @@ export const TallyParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.quorum = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.threshold = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.veto_threshold = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + veto_threshold: isSet(object.veto_threshold) ? globalThis.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); + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.veto_threshold !== "") { + obj.veto_threshold = message.veto_threshold; + } return obj; }, + create, I>>(base?: I): TallyParams { + return TallyParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): TallyParams { const message = createBaseTallyParams(); message.quorum = object.quorum ?? ""; @@ -861,7 +1050,8 @@ export const TallyParams = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -876,16 +1066,16 @@ function toTimestamp(date: Date): Timestamp { } function fromTimestamp(t: Timestamp): Date { - let millis = Number(t.seconds) * 1_000; - millis += t.nanos / 1_000_000; - return new Date(millis); + let millis = (globalThis.Number(t.seconds) || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); } function fromJsonTimestamp(o: any): Date { - if (o instanceof Date) { + if (o instanceof globalThis.Date) { return o; } else if (typeof o === "string") { - return new Date(o); + return new globalThis.Date(o); } else { return fromTimestamp(Timestamp.fromJSON(o)); } diff --git a/common/types/src/client/cosmos/gov/v1/query.ts b/common/types/src/client/cosmos/gov/v1/query.ts index a7f79aba..3f6ac41f 100644 --- a/common/types/src/client/cosmos/gov/v1/query.ts +++ b/common/types/src/client/cosmos/gov/v1/query.ts @@ -27,7 +27,7 @@ export interface QueryProposalRequest { /** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ export interface QueryProposalResponse { - proposal?: Proposal; + proposal?: Proposal | undefined; } /** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ @@ -39,7 +39,7 @@ export interface QueryProposalsRequest { /** depositor defines the deposit addresses from the proposals. */ depositor: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: PageRequest | undefined; } /** @@ -49,21 +49,21 @@ export interface QueryProposalsRequest { export interface QueryProposalsResponse { proposals: Proposal[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** 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 defines the voter 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; + vote?: Vote | undefined; } /** QueryVotesRequest is the request type for the Query/Votes RPC method. */ @@ -71,7 +71,7 @@ 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; + pagination?: PageRequest | undefined; } /** QueryVotesResponse is the response type for the Query/Votes RPC method. */ @@ -79,7 +79,7 @@ export interface QueryVotesResponse { /** votes defined the queried votes. */ votes: Vote[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ @@ -94,11 +94,15 @@ export interface QueryParamsRequest { /** 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; + voting_params?: + | VotingParams + | undefined; /** deposit_params defines the parameters related to deposit. */ - deposit_params?: DepositParams; + deposit_params?: + | DepositParams + | undefined; /** tally_params defines the parameters related to tally. */ - tally_params?: TallyParams; + tally_params?: TallyParams | undefined; } /** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ @@ -112,7 +116,7 @@ export interface QueryDepositRequest { /** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ export interface QueryDepositResponse { /** deposit defines the requested deposit. */ - deposit?: Deposit; + deposit?: Deposit | undefined; } /** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ @@ -120,14 +124,14 @@ 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; + pagination?: PageRequest | undefined; } /** 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; + pagination?: PageResponse | undefined; } /** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ @@ -139,7 +143,7 @@ export interface QueryTallyResultRequest { /** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ export interface QueryTallyResultResponse { /** tally defines the requested tally. */ - tally?: TallyResult; + tally?: TallyResult | undefined; } function createBaseQueryProposalRequest(): QueryProposalRequest { @@ -155,33 +159,43 @@ export const QueryProposalRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryProposalRequest { - return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + return { proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0" }; }, toJSON(message: QueryProposalRequest): unknown { const obj: any = {}; - message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } return obj; }, + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryProposalRequest { const message = createBaseQueryProposalRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -202,19 +216,24 @@ export const QueryProposalResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.proposal = Proposal.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -225,10 +244,15 @@ export const QueryProposalResponse = { toJSON(message: QueryProposalResponse): unknown { const obj: any = {}; - message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); + if (message.proposal !== undefined) { + obj.proposal = Proposal.toJSON(message.proposal); + } return obj; }, + create, I>>(base?: I): QueryProposalResponse { + return QueryProposalResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryProposalResponse { const message = createBaseQueryProposalResponse(); message.proposal = (object.proposal !== undefined && object.proposal !== null) @@ -260,28 +284,45 @@ export const QueryProposalsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_status = reader.int32() as any; - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.voter = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.depositor = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -289,22 +330,32 @@ export const QueryProposalsRequest = { 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) : "", + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + depositor: isSet(object.depositor) ? globalThis.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); + if (message.proposal_status !== 0) { + obj.proposal_status = proposalStatusToJSON(message.proposal_status); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryProposalsRequest { + return QueryProposalsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); message.proposal_status = object.proposal_status ?? 0; @@ -333,45 +384,58 @@ export const QueryProposalsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.proposals.push(Proposal.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryProposalsResponse { return { - proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + proposals: globalThis.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 = []; + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryProposalsResponse { + return QueryProposalsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryProposalsResponse { const message = createBaseQueryProposalsResponse(); message.proposals = object.proposals?.map((e) => Proposal.fromPartial(e)) || []; @@ -398,40 +462,56 @@ export const QueryVoteRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.voter = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + voter: isSet(object.voter) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.voter !== "") { + obj.voter = message.voter; + } return obj; }, + create, I>>(base?: I): QueryVoteRequest { + return QueryVoteRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVoteRequest { const message = createBaseQueryVoteRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -453,19 +533,24 @@ export const QueryVoteResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.vote = Vote.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -476,10 +561,15 @@ export const QueryVoteResponse = { toJSON(message: QueryVoteResponse): unknown { const obj: any = {}; - message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); + if (message.vote !== undefined) { + obj.vote = Vote.toJSON(message.vote); + } return obj; }, + create, I>>(base?: I): QueryVoteResponse { + return QueryVoteResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVoteResponse { const message = createBaseQueryVoteResponse(); message.vote = (object.vote !== undefined && object.vote !== null) ? Vote.fromPartial(object.vote) : undefined; @@ -503,41 +593,56 @@ export const QueryVotesRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryVotesRequest { return { - proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + proposal_id: isSet(object.proposal_id) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryVotesRequest { + return QueryVotesRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVotesRequest { const message = createBaseQueryVotesRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -564,45 +669,56 @@ export const QueryVotesResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.votes.push(Vote.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryVotesResponse { return { - votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + votes: globalThis.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 = []; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryVotesResponse { + return QueryVotesResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVotesResponse { const message = createBaseQueryVotesResponse(); message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; @@ -626,33 +742,43 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params_type = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryParamsRequest { - return { params_type: isSet(object.params_type) ? String(object.params_type) : "" }; + return { params_type: isSet(object.params_type) ? globalThis.String(object.params_type) : "" }; }, toJSON(message: QueryParamsRequest): unknown { const obj: any = {}; - message.params_type !== undefined && (obj.params_type = message.params_type); + if (message.params_type !== "") { + obj.params_type = message.params_type; + } return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); message.params_type = object.params_type ?? ""; @@ -679,25 +805,38 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.voting_params = VotingParams.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.deposit_params = DepositParams.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.tally_params = TallyParams.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -712,15 +851,21 @@ export const QueryParamsResponse = { 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); + if (message.voting_params !== undefined) { + obj.voting_params = VotingParams.toJSON(message.voting_params); + } + if (message.deposit_params !== undefined) { + obj.deposit_params = DepositParams.toJSON(message.deposit_params); + } + if (message.tally_params !== undefined) { + obj.tally_params = TallyParams.toJSON(message.tally_params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.voting_params = (object.voting_params !== undefined && object.voting_params !== null) @@ -752,40 +897,56 @@ export const QueryDepositRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.depositor = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } return obj; }, + create, I>>(base?: I): QueryDepositRequest { + return QueryDepositRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDepositRequest { const message = createBaseQueryDepositRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -807,19 +968,24 @@ export const QueryDepositResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.deposit = Deposit.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -830,10 +996,15 @@ export const QueryDepositResponse = { toJSON(message: QueryDepositResponse): unknown { const obj: any = {}; - message.deposit !== undefined && (obj.deposit = message.deposit ? Deposit.toJSON(message.deposit) : undefined); + if (message.deposit !== undefined) { + obj.deposit = Deposit.toJSON(message.deposit); + } return obj; }, + create, I>>(base?: I): QueryDepositResponse { + return QueryDepositResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDepositResponse { const message = createBaseQueryDepositResponse(); message.deposit = (object.deposit !== undefined && object.deposit !== null) @@ -859,41 +1030,56 @@ export const QueryDepositsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryDepositsRequest { return { - proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + proposal_id: isSet(object.proposal_id) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryDepositsRequest { + return QueryDepositsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDepositsRequest { const message = createBaseQueryDepositsRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -920,45 +1106,56 @@ export const QueryDepositsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.deposits.push(Deposit.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryDepositsResponse { return { - deposits: Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + deposits: globalThis.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 = []; + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryDepositsResponse { + return QueryDepositsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDepositsResponse { const message = createBaseQueryDepositsResponse(); message.deposits = object.deposits?.map((e) => Deposit.fromPartial(e)) || []; @@ -982,33 +1179,43 @@ export const QueryTallyResultRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTallyResultRequest { - return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + return { proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0" }; }, toJSON(message: QueryTallyResultRequest): unknown { const obj: any = {}; - message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } return obj; }, + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryTallyResultRequest { const message = createBaseQueryTallyResultRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -1029,19 +1236,24 @@ export const QueryTallyResultResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.tally = TallyResult.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -1052,10 +1264,15 @@ export const QueryTallyResultResponse = { toJSON(message: QueryTallyResultResponse): unknown { const obj: any = {}; - message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); + if (message.tally !== undefined) { + obj.tally = TallyResult.toJSON(message.tally); + } return obj; }, + create, I>>(base?: I): QueryTallyResultResponse { + return QueryTallyResultResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryTallyResultResponse { const message = createBaseQueryTallyResultResponse(); message.tally = (object.tally !== undefined && object.tally !== null) @@ -1085,11 +1302,12 @@ export interface Query { TallyResult(request: QueryTallyResultRequest): Promise; } +export const QueryServiceName = "cosmos.gov.v1.Query"; 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.service = opts?.service || QueryServiceName; this.rpc = rpc; this.Proposal = this.Proposal.bind(this); this.Proposals = this.Proposals.bind(this); @@ -1103,49 +1321,49 @@ export class QueryClientImpl implements Query { 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))); + return promise.then((data) => QueryProposalResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryProposalsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryVoteResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryVotesResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryDepositResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryDepositsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryTallyResultResponse.decode(_m0.Reader.create(data))); } } @@ -1156,7 +1374,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/cosmos/gov/v1/tx.ts b/common/types/src/client/cosmos/gov/v1/tx.ts index ca1144b9..b058c08e 100644 --- a/common/types/src/client/cosmos/gov/v1/tx.ts +++ b/common/types/src/client/cosmos/gov/v1/tx.ts @@ -32,7 +32,9 @@ export interface MsgSubmitProposalResponse { */ export interface MsgExecLegacyContent { /** content is the proposal's content. */ - content?: Any; + content?: + | Any + | undefined; /** authority must be the gov module address. */ authority: string; } @@ -98,60 +100,80 @@ export const MsgSubmitProposal = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.messages.push(Any.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.initial_deposit.push(Coin.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.proposer = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.metadata = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + initial_deposit: globalThis.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) : "", + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + metadata: isSet(object.metadata) ? globalThis.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); + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.initial_deposit?.length) { + obj.initial_deposit = message.initial_deposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } return obj; }, + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; @@ -175,33 +197,43 @@ export const MsgSubmitProposalResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgSubmitProposalResponse { - return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + return { proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0" }; }, toJSON(message: MsgSubmitProposalResponse): unknown { const obj: any = {}; - message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } return obj; }, + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgSubmitProposalResponse { const message = createBaseMsgSubmitProposalResponse(); message.proposal_id = object.proposal_id ?? "0"; @@ -225,22 +257,31 @@ export const MsgExecLegacyContent = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecLegacyContent { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.content = Any.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.authority = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -248,17 +289,24 @@ export const MsgExecLegacyContent = { fromJSON(object: any): MsgExecLegacyContent { return { content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, - authority: isSet(object.authority) ? String(object.authority) : "", + authority: isSet(object.authority) ? globalThis.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); + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.authority !== "") { + obj.authority = message.authority; + } return obj; }, + create, I>>(base?: I): MsgExecLegacyContent { + return MsgExecLegacyContent.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgExecLegacyContent { const message = createBaseMsgExecLegacyContent(); message.content = (object.content !== undefined && object.content !== null) @@ -279,16 +327,17 @@ export const MsgExecLegacyContentResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecLegacyContentResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -302,6 +351,9 @@ export const MsgExecLegacyContentResponse = { return obj; }, + create, I>>(base?: I): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgExecLegacyContentResponse { const message = createBaseMsgExecLegacyContentResponse(); return message; @@ -330,50 +382,78 @@ export const MsgVote = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.voter = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.option = reader.int32() as any; - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.metadata = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, - metadata: isSet(object.metadata) ? String(object.metadata) : "", + metadata: isSet(object.metadata) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } return obj; }, + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgVote { const message = createBaseMsgVote(); message.proposal_id = object.proposal_id ?? "0"; @@ -394,16 +474,17 @@ export const MsgVoteResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -417,6 +498,9 @@ export const MsgVoteResponse = { return obj; }, + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgVoteResponse { const message = createBaseMsgVoteResponse(); return message; @@ -445,54 +529,80 @@ export const MsgVoteWeighted = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeighted { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.voter = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.metadata = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } return obj; }, + create, I>>(base?: I): MsgVoteWeighted { + return MsgVoteWeighted.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgVoteWeighted { const message = createBaseMsgVoteWeighted(); message.proposal_id = object.proposal_id ?? "0"; @@ -513,16 +623,17 @@ export const MsgVoteWeightedResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeightedResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -536,6 +647,9 @@ export const MsgVoteWeightedResponse = { return obj; }, + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgVoteWeightedResponse { const message = createBaseMsgVoteWeightedResponse(); return message; @@ -561,49 +675,67 @@ export const MsgDeposit = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeposit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.depositor = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.amount.push(Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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)) : [], + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + amount: globalThis.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 = []; + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); } return obj; }, + create, I>>(base?: I): MsgDeposit { + return MsgDeposit.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgDeposit { const message = createBaseMsgDeposit(); message.proposal_id = object.proposal_id ?? "0"; @@ -623,16 +755,17 @@ export const MsgDepositResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -646,6 +779,9 @@ export const MsgDepositResponse = { return obj; }, + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgDepositResponse { const message = createBaseMsgDepositResponse(); return message; @@ -669,11 +805,12 @@ export interface Msg { Deposit(request: MsgDeposit): Promise; } +export const MsgServiceName = "cosmos.gov.v1.Msg"; 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.service = opts?.service || MsgServiceName; this.rpc = rpc; this.SubmitProposal = this.SubmitProposal.bind(this); this.ExecLegacyContent = this.ExecLegacyContent.bind(this); @@ -684,31 +821,31 @@ export class MsgClientImpl implements Msg { 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))); + return promise.then((data) => MsgSubmitProposalResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgExecLegacyContentResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgVoteResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgVoteWeightedResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgDepositResponse.decode(_m0.Reader.create(data))); } } @@ -719,7 +856,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/cosmos/gov/v1beta1/genesis.ts b/common/types/src/client/cosmos/gov/v1beta1/genesis.ts deleted file mode 100644 index 8ef52afc..00000000 --- a/common/types/src/client/cosmos/gov/v1beta1/genesis.ts +++ /dev/null @@ -1,180 +0,0 @@ -/* 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 deleted file mode 100644 index 95eb209a..00000000 --- a/common/types/src/client/cosmos/gov/v1beta1/gov.ts +++ /dev/null @@ -1,1016 +0,0 @@ -/* 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 deleted file mode 100644 index 15583967..00000000 --- a/common/types/src/client/cosmos/gov/v1beta1/query.ts +++ /dev/null @@ -1,1176 +0,0 @@ -/* 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 deleted file mode 100644 index 5d3956af..00000000 --- a/common/types/src/client/cosmos/gov/v1beta1/tx.ts +++ /dev/null @@ -1,592 +0,0 @@ -/* 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 deleted file mode 100644 index 9bfd5f8b..00000000 --- a/common/types/src/client/cosmos/group/v1/events.ts +++ /dev/null @@ -1,533 +0,0 @@ -/* 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 deleted file mode 100644 index d9da567e..00000000 --- a/common/types/src/client/cosmos/group/v1/genesis.ts +++ /dev/null @@ -1,204 +0,0 @@ -/* 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 deleted file mode 100644 index a8c76c01..00000000 --- a/common/types/src/client/cosmos/group/v1/query.ts +++ /dev/null @@ -1,1869 +0,0 @@ -/* 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 deleted file mode 100644 index 88c083b1..00000000 --- a/common/types/src/client/cosmos/group/v1/tx.ts +++ /dev/null @@ -1,2070 +0,0 @@ -/* 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 deleted file mode 100644 index b21cad7c..00000000 --- a/common/types/src/client/cosmos/group/v1/types.ts +++ /dev/null @@ -1,1394 +0,0 @@ -/* 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 deleted file mode 100644 index b1725bfe..00000000 --- a/common/types/src/client/cosmos/mint/v1beta1/genesis.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* 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 deleted file mode 100644 index 2606feac..00000000 --- a/common/types/src/client/cosmos/mint/v1beta1/mint.ts +++ /dev/null @@ -1,212 +0,0 @@ -/* 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 deleted file mode 100644 index 20642bf4..00000000 --- a/common/types/src/client/cosmos/mint/v1beta1/query.ts +++ /dev/null @@ -1,414 +0,0 @@ -/* 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/nft/v1beta1/event.ts b/common/types/src/client/cosmos/nft/v1beta1/event.ts deleted file mode 100644 index ce6086aa..00000000 --- a/common/types/src/client/cosmos/nft/v1beta1/event.ts +++ /dev/null @@ -1,251 +0,0 @@ -/* 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 deleted file mode 100644 index 6257458c..00000000 --- a/common/types/src/client/cosmos/nft/v1beta1/genesis.ts +++ /dev/null @@ -1,163 +0,0 @@ -/* 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 deleted file mode 100644 index d98d6e78..00000000 --- a/common/types/src/client/cosmos/nft/v1beta1/nft.ts +++ /dev/null @@ -1,240 +0,0 @@ -/* 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 deleted file mode 100644 index 53e32d15..00000000 --- a/common/types/src/client/cosmos/nft/v1beta1/query.ts +++ /dev/null @@ -1,944 +0,0 @@ -/* 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 deleted file mode 100644 index e0a8855a..00000000 --- a/common/types/src/client/cosmos/nft/v1beta1/tx.ts +++ /dev/null @@ -1,175 +0,0 @@ -/* 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 deleted file mode 100644 index 512affa0..00000000 --- a/common/types/src/client/cosmos/orm/v1/orm.ts +++ /dev/null @@ -1,356 +0,0 @@ -/* 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 deleted file mode 100644 index 87c69780..00000000 --- a/common/types/src/client/cosmos/orm/v1alpha1/schema.ts +++ /dev/null @@ -1,314 +0,0 @@ -/* 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 deleted file mode 100644 index ebcaa371..00000000 --- a/common/types/src/client/cosmos/params/v1beta1/params.ts +++ /dev/null @@ -1,174 +0,0 @@ -/* 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 deleted file mode 100644 index f70bdfcc..00000000 --- a/common/types/src/client/cosmos/params/v1beta1/query.ts +++ /dev/null @@ -1,356 +0,0 @@ -/* 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 deleted file mode 100644 index 01f795e0..00000000 --- a/common/types/src/client/cosmos/slashing/v1beta1/genesis.ts +++ /dev/null @@ -1,341 +0,0 @@ -/* 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 deleted file mode 100644 index 5150df45..00000000 --- a/common/types/src/client/cosmos/slashing/v1beta1/query.ts +++ /dev/null @@ -1,414 +0,0 @@ -/* 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 deleted file mode 100644 index 6f15c86e..00000000 --- a/common/types/src/client/cosmos/slashing/v1beta1/slashing.ts +++ /dev/null @@ -1,348 +0,0 @@ -/* 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 deleted file mode 100644 index 54d56e48..00000000 --- a/common/types/src/client/cosmos/slashing/v1beta1/tx.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* 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 deleted file mode 100644 index 14ea6f34..00000000 --- a/common/types/src/client/cosmos/staking/v1beta1/authz.ts +++ /dev/null @@ -1,244 +0,0 @@ -/* 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 deleted file mode 100644 index e4bad586..00000000 --- a/common/types/src/client/cosmos/staking/v1beta1/genesis.ts +++ /dev/null @@ -1,321 +0,0 @@ -/* 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 deleted file mode 100644 index d0d16cfe..00000000 --- a/common/types/src/client/cosmos/staking/v1beta1/query.ts +++ /dev/null @@ -1,2090 +0,0 @@ -/* 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 deleted file mode 100644 index 9a992ee3..00000000 --- a/common/types/src/client/cosmos/staking/v1beta1/staking.ts +++ /dev/null @@ -1,1787 +0,0 @@ -/* 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 deleted file mode 100644 index b38c9f5c..00000000 --- a/common/types/src/client/cosmos/staking/v1beta1/tx.ts +++ /dev/null @@ -1,818 +0,0 @@ -/* 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 deleted file mode 100644 index 37bf2ff5..00000000 --- a/common/types/src/client/cosmos/tx/signing/v1beta1/signing.ts +++ /dev/null @@ -1,532 +0,0 @@ -/* 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 deleted file mode 100644 index 7efc5371..00000000 --- a/common/types/src/client/cosmos/tx/v1beta1/service.ts +++ /dev/null @@ -1,1002 +0,0 @@ -/* 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 deleted file mode 100644 index b98d602d..00000000 --- a/common/types/src/client/cosmos/tx/v1beta1/tx.ts +++ /dev/null @@ -1,1338 +0,0 @@ -/* 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 deleted file mode 100644 index 108af104..00000000 --- a/common/types/src/client/cosmos/upgrade/v1beta1/query.ts +++ /dev/null @@ -1,723 +0,0 @@ -/* 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 deleted file mode 100644 index 0504de6b..00000000 --- a/common/types/src/client/cosmos/upgrade/v1beta1/tx.ts +++ /dev/null @@ -1,284 +0,0 @@ -/* 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 deleted file mode 100644 index db2b9503..00000000 --- a/common/types/src/client/cosmos/upgrade/v1beta1/upgrade.ts +++ /dev/null @@ -1,410 +0,0 @@ -/* 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 deleted file mode 100644 index c3fad147..00000000 --- a/common/types/src/client/cosmos/vesting/v1beta1/tx.ts +++ /dev/null @@ -1,506 +0,0 @@ -/* 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 deleted file mode 100644 index bf2ce510..00000000 --- a/common/types/src/client/cosmos/vesting/v1beta1/vesting.ts +++ /dev/null @@ -1,509 +0,0 @@ -/* 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 index 0d4074af..43670f8a 100644 --- a/common/types/src/client/cosmos_proto/cosmos.ts +++ b/common/types/src/client/cosmos_proto/cosmos.ts @@ -109,40 +109,56 @@ export const InterfaceDescriptor = { }, decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.name = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.description = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): InterfaceDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", }; }, toJSON(message: InterfaceDescriptor): unknown { const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.description !== undefined && (obj.description = message.description); + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } return obj; }, + create, I>>(base?: I): InterfaceDescriptor { + return InterfaceDescriptor.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): InterfaceDescriptor { const message = createBaseInterfaceDescriptor(); message.name = object.name ?? ""; @@ -172,56 +188,79 @@ export const ScalarDescriptor = { }, decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.name = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.description = reader.string(); - break; + continue; case 3: - if ((tag & 7) === 2) { + if (tag === 24) { + message.field_type.push(reader.int32() as any); + + continue; + } + + if (tag === 26) { 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); + + continue; } - break; - default: - reader.skipType(tag & 7); + break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + field_type: globalThis.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) { + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.field_type?.length) { obj.field_type = message.field_type.map((e) => scalarTypeToJSON(e)); - } else { - obj.field_type = []; } return obj; }, + create, I>>(base?: I): ScalarDescriptor { + return ScalarDescriptor.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): ScalarDescriptor { const message = createBaseScalarDescriptor(); message.name = object.name ?? ""; @@ -234,7 +273,8 @@ export const ScalarDescriptor = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/google/api/http.ts b/common/types/src/client/google/api/http.ts index 39f35c73..18b91749 100644 --- a/common/types/src/client/google/api/http.ts +++ b/common/types/src/client/google/api/http.ts @@ -195,15 +195,18 @@ export interface Http { * 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 + * - 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 + * 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 + * 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 @@ -300,7 +303,8 @@ export interface HttpRule { /** * Selects a method to which this rule applies. * - * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. */ selector: string; /** @@ -385,47 +389,58 @@ export const Http = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.rules.push(HttpRule.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.fully_decode_reserved_expansion = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Http { return { - rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], + rules: globalThis.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) + ? globalThis.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 = []; + if (message.rules?.length) { + obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); + } + if (message.fully_decode_reserved_expansion === true) { + obj.fully_decode_reserved_expansion = message.fully_decode_reserved_expansion; } - message.fully_decode_reserved_expansion !== undefined && - (obj.fully_decode_reserved_expansion = message.fully_decode_reserved_expansion); return obj; }, + create, I>>(base?: I): Http { + return Http.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Http { const message = createBaseHttp(); message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; @@ -485,62 +500,103 @@ export const HttpRule = { }, decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.selector = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.get = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.put = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.post = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.delete = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.patch = reader.string(); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.body = reader.string(); - break; + continue; case 12: + if (tag !== 98) { + break; + } + message.response_body = reader.string(); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.additional_bindings.push(HttpRule.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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, + selector: isSet(object.selector) ? globalThis.String(object.selector) : "", + get: isSet(object.get) ? globalThis.String(object.get) : undefined, + put: isSet(object.put) ? globalThis.String(object.put) : undefined, + post: isSet(object.post) ? globalThis.String(object.post) : undefined, + delete: isSet(object.delete) ? globalThis.String(object.delete) : undefined, + patch: isSet(object.patch) ? globalThis.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) + body: isSet(object.body) ? globalThis.String(object.body) : "", + response_body: isSet(object.response_body) ? globalThis.String(object.response_body) : "", + additional_bindings: globalThis.Array.isArray(object?.additional_bindings) ? object.additional_bindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -548,24 +604,42 @@ export const HttpRule = { 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 = []; + if (message.selector !== "") { + obj.selector = message.selector; + } + if (message.get !== undefined) { + obj.get = message.get; + } + if (message.put !== undefined) { + obj.put = message.put; + } + if (message.post !== undefined) { + obj.post = message.post; + } + if (message.delete !== undefined) { + obj.delete = message.delete; + } + if (message.patch !== undefined) { + obj.patch = message.patch; + } + if (message.custom !== undefined) { + obj.custom = CustomHttpPattern.toJSON(message.custom); + } + if (message.body !== "") { + obj.body = message.body; + } + if (message.response_body !== "") { + obj.response_body = message.response_body; + } + if (message.additional_bindings?.length) { + obj.additional_bindings = message.additional_bindings.map((e) => HttpRule.toJSON(e)); } return obj; }, + create, I>>(base?: I): HttpRule { + return HttpRule.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): HttpRule { const message = createBaseHttpRule(); message.selector = object.selector ?? ""; @@ -600,37 +674,56 @@ export const CustomHttpPattern = { }, decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.kind = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.path = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): CustomHttpPattern { - return { kind: isSet(object.kind) ? String(object.kind) : "", path: isSet(object.path) ? String(object.path) : "" }; + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + path: isSet(object.path) ? globalThis.String(object.path) : "", + }; }, toJSON(message: CustomHttpPattern): unknown { const obj: any = {}; - message.kind !== undefined && (obj.kind = message.kind); - message.path !== undefined && (obj.path = message.path); + if (message.kind !== "") { + obj.kind = message.kind; + } + if (message.path !== "") { + obj.path = message.path; + } return obj; }, + create, I>>(base?: I): CustomHttpPattern { + return CustomHttpPattern.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): CustomHttpPattern { const message = createBaseCustomHttpPattern(); message.kind = object.kind ?? ""; @@ -642,7 +735,8 @@ export const CustomHttpPattern = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/google/protobuf/any.ts b/common/types/src/client/google/protobuf/any.ts index 38da266b..f95d4dd7 100644 --- a/common/types/src/client/google/protobuf/any.ts +++ b/common/types/src/client/google/protobuf/any.ts @@ -28,8 +28,12 @@ export const protobufPackage = "google.protobuf"; * if (any.is(Foo.class)) { * foo = any.unpack(Foo.class); * } + * // or ... + * if (any.isSameTypeAs(Foo.getDefaultInstance())) { + * foo = any.unpack(Foo.getDefaultInstance()); + * } * - * Example 3: Pack and unpack a message in Python. + * Example 3: Pack and unpack a message in Python. * * foo = Foo(...) * any = Any() @@ -39,13 +43,16 @@ export const protobufPackage = "google.protobuf"; * any.Unpack(foo) * ... * - * Example 4: Pack and unpack a message in Go + * Example 4: Pack and unpack a message in Go * * foo := &pb.Foo{...} - * any, err := ptypes.MarshalAny(foo) + * any, err := anypb.New(foo) + * if err != nil { + * ... + * } * ... * foo := &pb.Foo{} - * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * if err := any.UnmarshalTo(foo); err != nil { * ... * } * @@ -56,7 +63,7 @@ export const protobufPackage = "google.protobuf"; * 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: @@ -119,7 +126,7 @@ export interface Any { } function createBaseAny(): Any { - return { type_url: "", value: new Uint8Array() }; + return { type_url: "", value: new Uint8Array(0) }; } export const Any = { @@ -134,68 +141,64 @@ export const Any = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Any { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.type_url = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.value = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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(), + type_url: isSet(object.type_url) ? globalThis.String(object.type_url) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), }; }, 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())); + if (message.type_url !== "") { + obj.type_url = message.type_url; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } return obj; }, + create, I>>(base?: I): Any { + return Any.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Any { const message = createBaseAny(); message.type_url = object.type_url ?? ""; - message.value = object.value ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(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")); @@ -215,7 +218,7 @@ function base64FromBytes(arr: Uint8Array): string { } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); return globalThis.btoa(bin.join("")); } @@ -224,7 +227,8 @@ function base64FromBytes(arr: Uint8Array): string { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/google/protobuf/descriptor.ts b/common/types/src/client/google/protobuf/descriptor.ts deleted file mode 100644 index 4df24d9d..00000000 --- a/common/types/src/client/google/protobuf/descriptor.ts +++ /dev/null @@ -1,3714 +0,0 @@ -/* 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 index 8ea1d106..00080d2e 100644 --- a/common/types/src/client/google/protobuf/duration.ts +++ b/common/types/src/client/google/protobuf/duration.ts @@ -26,7 +26,7 @@ export const protobufPackage = "google.protobuf"; * if (duration.seconds < 0 && duration.nanos > 0) { * duration.seconds += 1; * duration.nanos -= 1000000000; - * } else if (durations.seconds > 0 && duration.nanos < 0) { + * } else if (duration.seconds > 0 && duration.nanos < 0) { * duration.seconds -= 1; * duration.nanos += 1000000000; * } @@ -98,40 +98,56 @@ export const Duration = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.seconds = longToString(reader.int64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? String(object.seconds) : "0", - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.String(object.seconds) : "0", + nanos: isSet(object.nanos) ? globalThis.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)); + if (message.seconds !== "0") { + obj.seconds = message.seconds; + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } return obj; }, + create, I>>(base?: I): Duration { + return Duration.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Duration { const message = createBaseDuration(); message.seconds = object.seconds ?? "0"; @@ -143,7 +159,8 @@ export const Duration = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/google/protobuf/empty.ts b/common/types/src/client/google/protobuf/empty.ts deleted file mode 100644 index 58ef8256..00000000 --- a/common/types/src/client/google/protobuf/empty.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 index 8e3ff86f..cd9b753e 100644 --- a/common/types/src/client/google/protobuf/timestamp.ts +++ b/common/types/src/client/google/protobuf/timestamp.ts @@ -55,7 +55,15 @@ export const protobufPackage = "google.protobuf"; * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) * .setNanos((int) ((millis % 1000) * 1000000)).build(); * - * Example 5: Compute Timestamp from current time in Python. + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. * * timestamp = Timestamp() * timestamp.GetCurrentTime() @@ -119,40 +127,56 @@ export const Timestamp = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.seconds = longToString(reader.int64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Timestamp { return { - seconds: isSet(object.seconds) ? String(object.seconds) : "0", - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.String(object.seconds) : "0", + nanos: isSet(object.nanos) ? globalThis.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)); + if (message.seconds !== "0") { + obj.seconds = message.seconds; + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } return obj; }, + create, I>>(base?: I): Timestamp { + return Timestamp.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? "0"; @@ -164,7 +188,8 @@ export const Timestamp = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/bundles/v1beta1/bundles.ts b/common/types/src/client/kyve/bundles/v1beta1/bundles.ts index a834e99c..b3ce1c3b 100644 --- a/common/types/src/client/kyve/bundles/v1beta1/bundles.ts +++ b/common/types/src/client/kyve/bundles/v1beta1/bundles.ts @@ -134,13 +134,17 @@ export interface FinalizedBundle { /** data_hash a sha256 hash of the raw compressed data */ data_hash: string; /** finalized_at contains details of the block that finalized this bundle. */ - finalized_at?: FinalizedAt; + finalized_at?: + | FinalizedAt + | undefined; /** 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; + /** stake_security */ + stake_security?: StakeSecurity | undefined; } /** FinalizedAt ... */ @@ -151,6 +155,44 @@ export interface FinalizedAt { timestamp: string; } +/** StakeSecurity stores information about total stake and valid votes with which the bundle got finalized. */ +export interface StakeSecurity { + /** valid_vote_power is the total amount of stake of all pool stakers which voted valid for the given bundle. */ + valid_vote_power: string; + /** total_vote_power is the total amount of stake that was present during the finalization of the bundle */ + total_vote_power: string; +} + +/** BundleVersionEntry ... */ +export interface BundleVersionEntry { + /** height ... */ + height: string; + /** version ... */ + version: number; +} + +/** BundleVersionMap ... */ +export interface BundleVersionMap { + /** versions ... */ + versions: BundleVersionEntry[]; +} + +/** RoundRobinSingleValidatorProgress ... */ +export interface RoundRobinSingleValidatorProgress { + /** address ... */ + address: string; + /** progress ... */ + progress: string; +} + +/** RoundRobinProgress ... */ +export interface RoundRobinProgress { + /** pool_id ... */ + pool_id: string; + /** progress_list ... */ + progress_list: RoundRobinSingleValidatorProgress[]; +} + function createBaseBundleProposal(): BundleProposal { return { pool_id: "0", @@ -226,122 +268,216 @@ export const BundleProposal = { }, decode(input: _m0.Reader | Uint8Array, length?: number): BundleProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.uploader = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.next_uploader = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.data_size = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.to_key = reader.string(); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.bundle_summary = reader.string(); - break; + continue; case 9: + if (tag !== 74) { + break; + } + message.data_hash = reader.string(); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.updated_at = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.voters_valid.push(reader.string()); - break; + continue; case 12: + if (tag !== 98) { + break; + } + message.voters_invalid.push(reader.string()); - break; + continue; case 13: + if (tag !== 106) { + break; + } + message.voters_abstain.push(reader.string()); - break; + continue; case 14: + if (tag !== 114) { + break; + } + message.from_key = reader.string(); - break; + continue; case 15: + if (tag !== 120) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 16: + if (tag !== 128) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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, + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.String(object.storage_id) : "", + uploader: isSet(object.uploader) ? globalThis.String(object.uploader) : "", + next_uploader: isSet(object.next_uploader) ? globalThis.String(object.next_uploader) : "", + data_size: isSet(object.data_size) ? globalThis.String(object.data_size) : "0", + bundle_size: isSet(object.bundle_size) ? globalThis.String(object.bundle_size) : "0", + to_key: isSet(object.to_key) ? globalThis.String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? globalThis.String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? globalThis.String(object.data_hash) : "", + updated_at: isSet(object.updated_at) ? globalThis.String(object.updated_at) : "0", + voters_valid: globalThis.Array.isArray(object?.voters_valid) + ? object.voters_valid.map((e: any) => globalThis.String(e)) + : [], + voters_invalid: globalThis.Array.isArray(object?.voters_invalid) + ? object.voters_invalid.map((e: any) => globalThis.String(e)) + : [], + voters_abstain: globalThis.Array.isArray(object?.voters_abstain) + ? object.voters_abstain.map((e: any) => globalThis.String(e)) + : [], + from_key: isSet(object.from_key) ? globalThis.String(object.from_key) : "", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.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)); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.uploader !== "") { + obj.uploader = message.uploader; + } + if (message.next_uploader !== "") { + obj.next_uploader = message.next_uploader; + } + if (message.data_size !== "0") { + obj.data_size = message.data_size; + } + if (message.bundle_size !== "0") { + obj.bundle_size = message.bundle_size; + } + if (message.to_key !== "") { + obj.to_key = message.to_key; + } + if (message.bundle_summary !== "") { + obj.bundle_summary = message.bundle_summary; + } + if (message.data_hash !== "") { + obj.data_hash = message.data_hash; + } + if (message.updated_at !== "0") { + obj.updated_at = message.updated_at; + } + if (message.voters_valid?.length) { + obj.voters_valid = message.voters_valid; + } + if (message.voters_invalid?.length) { + obj.voters_invalid = message.voters_invalid; + } + if (message.voters_abstain?.length) { + obj.voters_abstain = message.voters_abstain; + } + if (message.from_key !== "") { + obj.from_key = message.from_key; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } return obj; }, + create, I>>(base?: I): BundleProposal { + return BundleProposal.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): BundleProposal { const message = createBaseBundleProposal(); message.pool_id = object.pool_id ?? "0"; @@ -379,6 +515,7 @@ function createBaseFinalizedBundle(): FinalizedBundle { from_key: "", storage_provider_id: 0, compression_id: 0, + stake_security: undefined, }; } @@ -423,100 +560,195 @@ export const FinalizedBundle = { if (message.compression_id !== 0) { writer.uint32(104).uint32(message.compression_id); } + if (message.stake_security !== undefined) { + StakeSecurity.encode(message.stake_security, writer.uint32(114).fork()).ldelim(); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): FinalizedBundle { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.uploader = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.from_index = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.to_index = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.to_key = reader.string(); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.bundle_summary = reader.string(); - break; + continue; case 9: + if (tag !== 74) { + break; + } + message.data_hash = reader.string(); - break; + continue; case 10: + if (tag !== 82) { + break; + } + message.finalized_at = FinalizedAt.decode(reader, reader.uint32()); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.from_key = reader.string(); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + case 14: + if (tag !== 114) { + break; + } + + message.stake_security = StakeSecurity.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.String(object.storage_id) : "", + uploader: isSet(object.uploader) ? globalThis.String(object.uploader) : "", + from_index: isSet(object.from_index) ? globalThis.String(object.from_index) : "0", + to_index: isSet(object.to_index) ? globalThis.String(object.to_index) : "0", + to_key: isSet(object.to_key) ? globalThis.String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? globalThis.String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? globalThis.String(object.data_hash) : "", finalized_at: isSet(object.finalized_at) ? FinalizedAt.fromJSON(object.finalized_at) : undefined, - 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, + from_key: isSet(object.from_key) ? globalThis.String(object.from_key) : "", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.Number(object.compression_id) : 0, + stake_security: isSet(object.stake_security) ? StakeSecurity.fromJSON(object.stake_security) : undefined, }; }, 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 ? FinalizedAt.toJSON(message.finalized_at) : undefined); - 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)); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.uploader !== "") { + obj.uploader = message.uploader; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } + if (message.to_index !== "0") { + obj.to_index = message.to_index; + } + if (message.to_key !== "") { + obj.to_key = message.to_key; + } + if (message.bundle_summary !== "") { + obj.bundle_summary = message.bundle_summary; + } + if (message.data_hash !== "") { + obj.data_hash = message.data_hash; + } + if (message.finalized_at !== undefined) { + obj.finalized_at = FinalizedAt.toJSON(message.finalized_at); + } + if (message.from_key !== "") { + obj.from_key = message.from_key; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } + if (message.stake_security !== undefined) { + obj.stake_security = StakeSecurity.toJSON(message.stake_security); + } return obj; }, + create, I>>(base?: I): FinalizedBundle { + return FinalizedBundle.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): FinalizedBundle { const message = createBaseFinalizedBundle(); message.pool_id = object.pool_id ?? "0"; @@ -534,6 +766,9 @@ export const FinalizedBundle = { message.from_key = object.from_key ?? ""; message.storage_provider_id = object.storage_provider_id ?? 0; message.compression_id = object.compression_id ?? 0; + message.stake_security = (object.stake_security !== undefined && object.stake_security !== null) + ? StakeSecurity.fromPartial(object.stake_security) + : undefined; return message; }, }; @@ -554,40 +789,56 @@ export const FinalizedAt = { }, decode(input: _m0.Reader | Uint8Array, length?: number): FinalizedAt { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFinalizedAt(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.height = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.timestamp = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): FinalizedAt { return { - height: isSet(object.height) ? String(object.height) : "0", - timestamp: isSet(object.timestamp) ? String(object.timestamp) : "0", + height: isSet(object.height) ? globalThis.String(object.height) : "0", + timestamp: isSet(object.timestamp) ? globalThis.String(object.timestamp) : "0", }; }, toJSON(message: FinalizedAt): unknown { const obj: any = {}; - message.height !== undefined && (obj.height = message.height); - message.timestamp !== undefined && (obj.timestamp = message.timestamp); + if (message.height !== "0") { + obj.height = message.height; + } + if (message.timestamp !== "0") { + obj.timestamp = message.timestamp; + } return obj; }, + create, I>>(base?: I): FinalizedAt { + return FinalizedAt.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): FinalizedAt { const message = createBaseFinalizedAt(); message.height = object.height ?? "0"; @@ -596,10 +847,374 @@ export const FinalizedAt = { }, }; +function createBaseStakeSecurity(): StakeSecurity { + return { valid_vote_power: "0", total_vote_power: "0" }; +} + +export const StakeSecurity = { + encode(message: StakeSecurity, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.valid_vote_power !== "0") { + writer.uint32(8).uint64(message.valid_vote_power); + } + if (message.total_vote_power !== "0") { + writer.uint32(16).uint64(message.total_vote_power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakeSecurity { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeSecurity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.valid_vote_power = longToString(reader.uint64() as Long); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total_vote_power = longToString(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeSecurity { + return { + valid_vote_power: isSet(object.valid_vote_power) ? globalThis.String(object.valid_vote_power) : "0", + total_vote_power: isSet(object.total_vote_power) ? globalThis.String(object.total_vote_power) : "0", + }; + }, + + toJSON(message: StakeSecurity): unknown { + const obj: any = {}; + if (message.valid_vote_power !== "0") { + obj.valid_vote_power = message.valid_vote_power; + } + if (message.total_vote_power !== "0") { + obj.total_vote_power = message.total_vote_power; + } + return obj; + }, + + create, I>>(base?: I): StakeSecurity { + return StakeSecurity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeSecurity { + const message = createBaseStakeSecurity(); + message.valid_vote_power = object.valid_vote_power ?? "0"; + message.total_vote_power = object.total_vote_power ?? "0"; + return message; + }, +}; + +function createBaseBundleVersionEntry(): BundleVersionEntry { + return { height: "0", version: 0 }; +} + +export const BundleVersionEntry = { + encode(message: BundleVersionEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).uint64(message.height); + } + if (message.version !== 0) { + writer.uint32(16).int32(message.version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BundleVersionEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBundleVersionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToString(reader.uint64() as Long); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.version = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BundleVersionEntry { + return { + height: isSet(object.height) ? globalThis.String(object.height) : "0", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: BundleVersionEntry): unknown { + const obj: any = {}; + if (message.height !== "0") { + obj.height = message.height; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): BundleVersionEntry { + return BundleVersionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BundleVersionEntry { + const message = createBaseBundleVersionEntry(); + message.height = object.height ?? "0"; + message.version = object.version ?? 0; + return message; + }, +}; + +function createBaseBundleVersionMap(): BundleVersionMap { + return { versions: [] }; +} + +export const BundleVersionMap = { + encode(message: BundleVersionMap, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.versions) { + BundleVersionEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BundleVersionMap { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBundleVersionMap(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.versions.push(BundleVersionEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BundleVersionMap { + return { + versions: globalThis.Array.isArray(object?.versions) + ? object.versions.map((e: any) => BundleVersionEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: BundleVersionMap): unknown { + const obj: any = {}; + if (message.versions?.length) { + obj.versions = message.versions.map((e) => BundleVersionEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): BundleVersionMap { + return BundleVersionMap.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BundleVersionMap { + const message = createBaseBundleVersionMap(); + message.versions = object.versions?.map((e) => BundleVersionEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRoundRobinSingleValidatorProgress(): RoundRobinSingleValidatorProgress { + return { address: "", progress: "0" }; +} + +export const RoundRobinSingleValidatorProgress = { + encode(message: RoundRobinSingleValidatorProgress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.progress !== "0") { + writer.uint32(16).int64(message.progress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RoundRobinSingleValidatorProgress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRoundRobinSingleValidatorProgress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.progress = longToString(reader.int64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RoundRobinSingleValidatorProgress { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + progress: isSet(object.progress) ? globalThis.String(object.progress) : "0", + }; + }, + + toJSON(message: RoundRobinSingleValidatorProgress): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.progress !== "0") { + obj.progress = message.progress; + } + return obj; + }, + + create, I>>( + base?: I, + ): RoundRobinSingleValidatorProgress { + return RoundRobinSingleValidatorProgress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RoundRobinSingleValidatorProgress { + const message = createBaseRoundRobinSingleValidatorProgress(); + message.address = object.address ?? ""; + message.progress = object.progress ?? "0"; + return message; + }, +}; + +function createBaseRoundRobinProgress(): RoundRobinProgress { + return { pool_id: "0", progress_list: [] }; +} + +export const RoundRobinProgress = { + encode(message: RoundRobinProgress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + for (const v of message.progress_list) { + RoundRobinSingleValidatorProgress.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RoundRobinProgress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRoundRobinProgress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.pool_id = longToString(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.progress_list.push(RoundRobinSingleValidatorProgress.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RoundRobinProgress { + return { + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + progress_list: globalThis.Array.isArray(object?.progress_list) + ? object.progress_list.map((e: any) => RoundRobinSingleValidatorProgress.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RoundRobinProgress): unknown { + const obj: any = {}; + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.progress_list?.length) { + obj.progress_list = message.progress_list.map((e) => RoundRobinSingleValidatorProgress.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RoundRobinProgress { + return RoundRobinProgress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RoundRobinProgress { + const message = createBaseRoundRobinProgress(); + message.pool_id = object.pool_id ?? "0"; + message.progress_list = object.progress_list?.map((e) => RoundRobinSingleValidatorProgress.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/bundles/v1beta1/events.ts b/common/types/src/client/kyve/bundles/v1beta1/events.ts index 630abe87..988dcb99 100644 --- a/common/types/src/client/kyve/bundles/v1beta1/events.ts +++ b/common/types/src/client/kyve/bundles/v1beta1/events.ts @@ -13,9 +13,13 @@ export const protobufPackage = "kyve.bundles.v1beta1"; */ export interface EventUpdateParams { /** old_params is the module's old parameters. */ - old_params?: Params; + old_params?: + | Params + | undefined; /** new_params is the module's new parameters. */ - new_params?: Params; + new_params?: + | Params + | undefined; /** payload is the parameter updates that were performed. */ payload: string; } @@ -195,25 +199,38 @@ export const EventUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.old_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.new_params = Params.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -222,20 +239,27 @@ export const EventUpdateParams = { return { old_params: isSet(object.old_params) ? Params.fromJSON(object.old_params) : undefined, new_params: isSet(object.new_params) ? Params.fromJSON(object.new_params) : undefined, - payload: isSet(object.payload) ? String(object.payload) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: EventUpdateParams): unknown { const obj: any = {}; - message.old_params !== undefined && - (obj.old_params = message.old_params ? Params.toJSON(message.old_params) : undefined); - message.new_params !== undefined && - (obj.new_params = message.new_params ? Params.toJSON(message.new_params) : undefined); - message.payload !== undefined && (obj.payload = message.payload); + if (message.old_params !== undefined) { + obj.old_params = Params.toJSON(message.old_params); + } + if (message.new_params !== undefined) { + obj.new_params = Params.toJSON(message.new_params); + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): EventUpdateParams { + return EventUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateParams { const message = createBaseEventUpdateParams(); message.old_params = (object.old_params !== undefined && object.old_params !== null) @@ -271,50 +295,78 @@ export const EventBundleVote = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.vote = reader.int32() as any; - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + storage_id: isSet(object.storage_id) ? globalThis.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)); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.vote !== 0) { + obj.vote = voteTypeToJSON(message.vote); + } return obj; }, + create, I>>(base?: I): EventBundleVote { + return EventBundleVote.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventBundleVote { const message = createBaseEventBundleVote(); message.pool_id = object.pool_id ?? "0"; @@ -392,100 +444,188 @@ export const EventBundleProposed = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleProposed { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.uploader = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.data_size = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.from_index = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.from_key = reader.string(); - break; + continue; case 9: + if (tag !== 74) { + break; + } + message.to_key = reader.string(); - break; + continue; case 10: + if (tag !== 82) { + break; + } + message.bundle_summary = reader.string(); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.data_hash = reader.string(); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.proposed_at = longToString(reader.uint64() as Long); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 14: + if (tag !== 112) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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, + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.String(object.storage_id) : "", + uploader: isSet(object.uploader) ? globalThis.String(object.uploader) : "", + data_size: isSet(object.data_size) ? globalThis.String(object.data_size) : "0", + from_index: isSet(object.from_index) ? globalThis.String(object.from_index) : "0", + bundle_size: isSet(object.bundle_size) ? globalThis.String(object.bundle_size) : "0", + from_key: isSet(object.from_key) ? globalThis.String(object.from_key) : "", + to_key: isSet(object.to_key) ? globalThis.String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? globalThis.String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? globalThis.String(object.data_hash) : "", + proposed_at: isSet(object.proposed_at) ? globalThis.String(object.proposed_at) : "0", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.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)); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.uploader !== "") { + obj.uploader = message.uploader; + } + if (message.data_size !== "0") { + obj.data_size = message.data_size; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } + if (message.bundle_size !== "0") { + obj.bundle_size = message.bundle_size; + } + if (message.from_key !== "") { + obj.from_key = message.from_key; + } + if (message.to_key !== "") { + obj.to_key = message.to_key; + } + if (message.bundle_summary !== "") { + obj.bundle_summary = message.bundle_summary; + } + if (message.data_hash !== "") { + obj.data_hash = message.data_hash; + } + if (message.proposed_at !== "0") { + obj.proposed_at = message.proposed_at; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } return obj; }, + create, I>>(base?: I): EventBundleProposed { + return EventBundleProposed.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventBundleProposed { const message = createBaseEventBundleProposed(); message.pool_id = object.pool_id ?? "0"; @@ -581,110 +721,210 @@ export const EventBundleFinalized = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleFinalized { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.valid = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.invalid = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.abstain = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.total = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.status = reader.int32() as any; - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.funders_payout = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.inflation_payout = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.reward_treasury = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 88) { + break; + } + message.reward_uploader = longToString(reader.uint64() as Long); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.reward_delegation = longToString(reader.uint64() as Long); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.reward_total = longToString(reader.uint64() as Long); - break; + continue; case 14: + if (tag !== 112) { + break; + } + message.finalized_at = longToString(reader.uint64() as Long); - break; + continue; case 15: + if (tag !== 122) { + break; + } + message.uploader = reader.string(); - break; + continue; case 16: + if (tag !== 130) { + break; + } + message.next_uploader = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + valid: isSet(object.valid) ? globalThis.String(object.valid) : "0", + invalid: isSet(object.invalid) ? globalThis.String(object.invalid) : "0", + abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "0", + total: isSet(object.total) ? globalThis.String(object.total) : "0", status: isSet(object.status) ? bundleStatusFromJSON(object.status) : 0, - funders_payout: isSet(object.funders_payout) ? String(object.funders_payout) : "0", - inflation_payout: isSet(object.inflation_payout) ? String(object.inflation_payout) : "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) : "", + funders_payout: isSet(object.funders_payout) ? globalThis.String(object.funders_payout) : "0", + inflation_payout: isSet(object.inflation_payout) ? globalThis.String(object.inflation_payout) : "0", + reward_treasury: isSet(object.reward_treasury) ? globalThis.String(object.reward_treasury) : "0", + reward_uploader: isSet(object.reward_uploader) ? globalThis.String(object.reward_uploader) : "0", + reward_delegation: isSet(object.reward_delegation) ? globalThis.String(object.reward_delegation) : "0", + reward_total: isSet(object.reward_total) ? globalThis.String(object.reward_total) : "0", + finalized_at: isSet(object.finalized_at) ? globalThis.String(object.finalized_at) : "0", + uploader: isSet(object.uploader) ? globalThis.String(object.uploader) : "", + next_uploader: isSet(object.next_uploader) ? globalThis.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.funders_payout !== undefined && (obj.funders_payout = message.funders_payout); - message.inflation_payout !== undefined && (obj.inflation_payout = message.inflation_payout); - 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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.valid !== "0") { + obj.valid = message.valid; + } + if (message.invalid !== "0") { + obj.invalid = message.invalid; + } + if (message.abstain !== "0") { + obj.abstain = message.abstain; + } + if (message.total !== "0") { + obj.total = message.total; + } + if (message.status !== 0) { + obj.status = bundleStatusToJSON(message.status); + } + if (message.funders_payout !== "0") { + obj.funders_payout = message.funders_payout; + } + if (message.inflation_payout !== "0") { + obj.inflation_payout = message.inflation_payout; + } + if (message.reward_treasury !== "0") { + obj.reward_treasury = message.reward_treasury; + } + if (message.reward_uploader !== "0") { + obj.reward_uploader = message.reward_uploader; + } + if (message.reward_delegation !== "0") { + obj.reward_delegation = message.reward_delegation; + } + if (message.reward_total !== "0") { + obj.reward_total = message.reward_total; + } + if (message.finalized_at !== "0") { + obj.finalized_at = message.finalized_at; + } + if (message.uploader !== "") { + obj.uploader = message.uploader; + } + if (message.next_uploader !== "") { + obj.next_uploader = message.next_uploader; + } return obj; }, + create, I>>(base?: I): EventBundleFinalized { + return EventBundleFinalized.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventBundleFinalized { const message = createBaseEventBundleFinalized(); message.pool_id = object.pool_id ?? "0"; @@ -726,45 +966,67 @@ export const EventClaimedUploaderRole = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimedUploaderRole { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.new_uploader = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + new_uploader: isSet(object.new_uploader) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.new_uploader !== "") { + obj.new_uploader = message.new_uploader; + } return obj; }, + create, I>>(base?: I): EventClaimedUploaderRole { + return EventClaimedUploaderRole.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClaimedUploaderRole { const message = createBaseEventClaimedUploaderRole(); message.pool_id = object.pool_id ?? "0"; @@ -796,50 +1058,78 @@ export const EventSkippedUploaderRole = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventSkippedUploaderRole { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.previous_uploader = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.new_uploader = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + previous_uploader: isSet(object.previous_uploader) ? globalThis.String(object.previous_uploader) : "", + new_uploader: isSet(object.new_uploader) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.previous_uploader !== "") { + obj.previous_uploader = message.previous_uploader; + } + if (message.new_uploader !== "") { + obj.new_uploader = message.new_uploader; + } return obj; }, + create, I>>(base?: I): EventSkippedUploaderRole { + return EventSkippedUploaderRole.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventSkippedUploaderRole { const message = createBaseEventSkippedUploaderRole(); message.pool_id = object.pool_id ?? "0"; @@ -869,45 +1159,67 @@ export const EventPointIncreased = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPointIncreased { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.current_points = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + current_points: isSet(object.current_points) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.current_points !== "0") { + obj.current_points = message.current_points; + } return obj; }, + create, I>>(base?: I): EventPointIncreased { + return EventPointIncreased.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPointIncreased { const message = createBaseEventPointIncreased(); message.pool_id = object.pool_id ?? "0"; @@ -933,40 +1245,56 @@ export const EventPointsReset = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPointsReset { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } return obj; }, + create, I>>(base?: I): EventPointsReset { + return EventPointsReset.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPointsReset { const message = createBaseEventPointsReset(); message.pool_id = object.pool_id ?? "0"; @@ -978,7 +1306,8 @@ export const EventPointsReset = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/bundles/v1beta1/genesis.ts b/common/types/src/client/kyve/bundles/v1beta1/genesis.ts index 1257e971..3847a7b8 100644 --- a/common/types/src/client/kyve/bundles/v1beta1/genesis.ts +++ b/common/types/src/client/kyve/bundles/v1beta1/genesis.ts @@ -1,6 +1,6 @@ /* eslint-disable */ import _m0 from "protobufjs/minimal"; -import { BundleProposal, FinalizedBundle } from "./bundles"; +import { BundleProposal, FinalizedBundle, RoundRobinProgress } from "./bundles"; import { Params } from "./params"; export const protobufPackage = "kyve.bundles.v1beta1"; @@ -8,15 +8,19 @@ 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; + params?: + | Params + | undefined; /** bundle_proposal_list ... */ bundle_proposal_list: BundleProposal[]; /** finalized_bundle_list ... */ finalized_bundle_list: FinalizedBundle[]; + /** round_robin_progress_list ... */ + round_robin_progress_list: RoundRobinProgress[]; } function createBaseGenesisState(): GenesisState { - return { params: undefined, bundle_proposal_list: [], finalized_bundle_list: [] }; + return { params: undefined, bundle_proposal_list: [], finalized_bundle_list: [], round_robin_progress_list: [] }; } export const GenesisState = { @@ -30,29 +34,52 @@ export const GenesisState = { for (const v of message.finalized_bundle_list) { FinalizedBundle.encode(v!, writer.uint32(26).fork()).ldelim(); } + for (const v of message.round_robin_progress_list) { + RoundRobinProgress.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); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.bundle_proposal_list.push(BundleProposal.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.finalized_bundle_list.push(FinalizedBundle.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.round_robin_progress_list.push(RoundRobinProgress.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -60,31 +87,38 @@ export const GenesisState = { fromJSON(object: any): GenesisState { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - bundle_proposal_list: Array.isArray(object?.bundle_proposal_list) + bundle_proposal_list: globalThis.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) + finalized_bundle_list: globalThis.Array.isArray(object?.finalized_bundle_list) ? object.finalized_bundle_list.map((e: any) => FinalizedBundle.fromJSON(e)) : [], + round_robin_progress_list: globalThis.Array.isArray(object?.round_robin_progress_list) + ? object.round_robin_progress_list.map((e: any) => RoundRobinProgress.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.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.bundle_proposal_list?.length) { + obj.bundle_proposal_list = message.bundle_proposal_list.map((e) => BundleProposal.toJSON(e)); } - 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 = []; + if (message.finalized_bundle_list?.length) { + obj.finalized_bundle_list = message.finalized_bundle_list.map((e) => FinalizedBundle.toJSON(e)); + } + if (message.round_robin_progress_list?.length) { + obj.round_robin_progress_list = message.round_robin_progress_list.map((e) => RoundRobinProgress.toJSON(e)); } return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) @@ -92,6 +126,8 @@ export const GenesisState = { : 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)) || []; + message.round_robin_progress_list = + object.round_robin_progress_list?.map((e) => RoundRobinProgress.fromPartial(e)) || []; return message; }, }; @@ -99,7 +135,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/bundles/v1beta1/params.ts b/common/types/src/client/kyve/bundles/v1beta1/params.ts index 4772562b..f9f18d1a 100644 --- a/common/types/src/client/kyve/bundles/v1beta1/params.ts +++ b/common/types/src/client/kyve/bundles/v1beta1/params.ts @@ -38,50 +38,78 @@ export const Params = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.upload_timeout = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.storage_cost = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.network_fee = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.max_points = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", - network_fee: isSet(object.network_fee) ? String(object.network_fee) : "", - max_points: isSet(object.max_points) ? String(object.max_points) : "0", + upload_timeout: isSet(object.upload_timeout) ? globalThis.String(object.upload_timeout) : "0", + storage_cost: isSet(object.storage_cost) ? globalThis.String(object.storage_cost) : "", + network_fee: isSet(object.network_fee) ? globalThis.String(object.network_fee) : "", + max_points: isSet(object.max_points) ? globalThis.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); + if (message.upload_timeout !== "0") { + obj.upload_timeout = message.upload_timeout; + } + if (message.storage_cost !== "") { + obj.storage_cost = message.storage_cost; + } + if (message.network_fee !== "") { + obj.network_fee = message.network_fee; + } + if (message.max_points !== "0") { + obj.max_points = message.max_points; + } return obj; }, + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Params { const message = createBaseParams(); message.upload_timeout = object.upload_timeout ?? "0"; @@ -95,7 +123,8 @@ export const Params = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/bundles/v1beta1/query.ts b/common/types/src/client/kyve/bundles/v1beta1/query.ts index e66091c3..ddd88889 100644 --- a/common/types/src/client/kyve/bundles/v1beta1/query.ts +++ b/common/types/src/client/kyve/bundles/v1beta1/query.ts @@ -11,7 +11,7 @@ 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; + params?: Params | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -24,16 +24,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -47,6 +48,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -66,19 +70,24 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -89,10 +98,15 @@ export const QueryParamsResponse = { toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) @@ -108,18 +122,19 @@ export interface Query { Params(request: QueryParamsRequest): Promise; } +export const QueryServiceName = "kyve.bundles.v1beta1.Query"; 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.service = opts?.service || QueryServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -130,7 +145,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/bundles/v1beta1/tx.ts b/common/types/src/client/kyve/bundles/v1beta1/tx.ts index d15964e1..faf47153 100644 --- a/common/types/src/client/kyve/bundles/v1beta1/tx.ts +++ b/common/types/src/client/kyve/bundles/v1beta1/tx.ts @@ -199,85 +199,155 @@ export const MsgSubmitBundleProposal = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitBundleProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.data_size = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.data_hash = reader.string(); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.from_index = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 74) { + break; + } + message.from_key = reader.string(); - break; + continue; case 10: + if (tag !== 82) { + break; + } + message.to_key = reader.string(); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.bundle_summary = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.String(object.storage_id) : "", + data_size: isSet(object.data_size) ? globalThis.String(object.data_size) : "0", + data_hash: isSet(object.data_hash) ? globalThis.String(object.data_hash) : "", + from_index: isSet(object.from_index) ? globalThis.String(object.from_index) : "0", + bundle_size: isSet(object.bundle_size) ? globalThis.String(object.bundle_size) : "0", + from_key: isSet(object.from_key) ? globalThis.String(object.from_key) : "", + to_key: isSet(object.to_key) ? globalThis.String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.data_size !== "0") { + obj.data_size = message.data_size; + } + if (message.data_hash !== "") { + obj.data_hash = message.data_hash; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } + if (message.bundle_size !== "0") { + obj.bundle_size = message.bundle_size; + } + if (message.from_key !== "") { + obj.from_key = message.from_key; + } + if (message.to_key !== "") { + obj.to_key = message.to_key; + } + if (message.bundle_summary !== "") { + obj.bundle_summary = message.bundle_summary; + } return obj; }, + create, I>>(base?: I): MsgSubmitBundleProposal { + return MsgSubmitBundleProposal.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgSubmitBundleProposal { const message = createBaseMsgSubmitBundleProposal(); message.creator = object.creator ?? ""; @@ -305,16 +375,17 @@ export const MsgSubmitBundleProposalResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitBundleProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -328,6 +399,9 @@ export const MsgSubmitBundleProposalResponse = { return obj; }, + create, I>>(base?: I): MsgSubmitBundleProposalResponse { + return MsgSubmitBundleProposalResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgSubmitBundleProposalResponse { const message = createBaseMsgSubmitBundleProposalResponse(); return message; @@ -359,55 +433,89 @@ export const MsgVoteBundleProposal = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteBundleProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.vote = reader.int32() as any; - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.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)); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.vote !== 0) { + obj.vote = voteTypeToJSON(message.vote); + } return obj; }, + create, I>>(base?: I): MsgVoteBundleProposal { + return MsgVoteBundleProposal.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgVoteBundleProposal { const message = createBaseMsgVoteBundleProposal(); message.creator = object.creator ?? ""; @@ -429,16 +537,17 @@ export const MsgVoteBundleProposalResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteBundleProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -452,6 +561,9 @@ export const MsgVoteBundleProposalResponse = { return obj; }, + create, I>>(base?: I): MsgVoteBundleProposalResponse { + return MsgVoteBundleProposalResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgVoteBundleProposalResponse { const message = createBaseMsgVoteBundleProposalResponse(); return message; @@ -477,45 +589,67 @@ export const MsgClaimUploaderRole = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUploaderRole { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + pool_id: isSet(object.pool_id) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } return obj; }, + create, I>>(base?: I): MsgClaimUploaderRole { + return MsgClaimUploaderRole.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClaimUploaderRole { const message = createBaseMsgClaimUploaderRole(); message.creator = object.creator ?? ""; @@ -535,16 +669,17 @@ export const MsgClaimUploaderRoleResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUploaderRoleResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -558,6 +693,9 @@ export const MsgClaimUploaderRoleResponse = { return obj; }, + create, I>>(base?: I): MsgClaimUploaderRoleResponse { + return MsgClaimUploaderRoleResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgClaimUploaderRoleResponse { const message = createBaseMsgClaimUploaderRoleResponse(); return message; @@ -586,50 +724,78 @@ export const MsgSkipUploaderRole = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSkipUploaderRole { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.from_index = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + from_index: isSet(object.from_index) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } return obj; }, + create, I>>(base?: I): MsgSkipUploaderRole { + return MsgSkipUploaderRole.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgSkipUploaderRole { const message = createBaseMsgSkipUploaderRole(); message.creator = object.creator ?? ""; @@ -650,16 +816,17 @@ export const MsgSkipUploaderRoleResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSkipUploaderRoleResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -673,6 +840,9 @@ export const MsgSkipUploaderRoleResponse = { return obj; }, + create, I>>(base?: I): MsgSkipUploaderRoleResponse { + return MsgSkipUploaderRoleResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgSkipUploaderRoleResponse { const message = createBaseMsgSkipUploaderRoleResponse(); return message; @@ -695,40 +865,56 @@ export const MsgUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", - payload: isSet(object.payload) ? String(object.payload) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: MsgUpdateParams): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.payload !== undefined && (obj.payload = message.payload); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateParams { const message = createBaseMsgUpdateParams(); message.authority = object.authority ?? ""; @@ -747,16 +933,17 @@ export const MsgUpdateParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -770,6 +957,9 @@ export const MsgUpdateParamsResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateParamsResponse { const message = createBaseMsgUpdateParamsResponse(); return message; @@ -793,11 +983,12 @@ export interface Msg { UpdateParams(request: MsgUpdateParams): Promise; } +export const MsgServiceName = "kyve.bundles.v1beta1.Msg"; 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.service = opts?.service || MsgServiceName; this.rpc = rpc; this.SubmitBundleProposal = this.SubmitBundleProposal.bind(this); this.VoteBundleProposal = this.VoteBundleProposal.bind(this); @@ -808,31 +999,31 @@ export class MsgClientImpl implements Msg { 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))); + return promise.then((data) => MsgSubmitBundleProposalResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgVoteBundleProposalResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgClaimUploaderRoleResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgSkipUploaderRoleResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); } } @@ -843,7 +1034,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/delegation/v1beta1/delegation.ts b/common/types/src/client/kyve/delegation/v1beta1/delegation.ts index 4bdab179..d111c081 100644 --- a/common/types/src/client/kyve/delegation/v1beta1/delegation.ts +++ b/common/types/src/client/kyve/delegation/v1beta1/delegation.ts @@ -170,50 +170,78 @@ export const Delegator = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Delegator { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.delegator = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.k_index = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.initial_amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + delegator: isSet(object.delegator) ? globalThis.String(object.delegator) : "", + k_index: isSet(object.k_index) ? globalThis.String(object.k_index) : "0", + initial_amount: isSet(object.initial_amount) ? globalThis.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); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.delegator !== "") { + obj.delegator = message.delegator; + } + if (message.k_index !== "0") { + obj.k_index = message.k_index; + } + if (message.initial_amount !== "0") { + obj.initial_amount = message.initial_amount; + } return obj; }, + create, I>>(base?: I): Delegator { + return Delegator.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Delegator { const message = createBaseDelegator(); message.staker = object.staker ?? ""; @@ -243,45 +271,67 @@ export const DelegationEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegationEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.k_index = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + k_index: isSet(object.k_index) ? globalThis.String(object.k_index) : "0", + value: isSet(object.value) ? globalThis.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); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.k_index !== "0") { + obj.k_index = message.k_index; + } + if (message.value !== "") { + obj.value = message.value; + } return obj; }, + create, I>>(base?: I): DelegationEntry { + return DelegationEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DelegationEntry { const message = createBaseDelegationEntry(); message.staker = object.staker ?? ""; @@ -326,63 +376,102 @@ export const DelegationData = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegationData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.current_rewards = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.total_delegation = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.latest_index_k = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.delegator_count = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.latest_index_was_undelegation = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + current_rewards: isSet(object.current_rewards) ? globalThis.String(object.current_rewards) : "0", + total_delegation: isSet(object.total_delegation) ? globalThis.String(object.total_delegation) : "0", + latest_index_k: isSet(object.latest_index_k) ? globalThis.String(object.latest_index_k) : "0", + delegator_count: isSet(object.delegator_count) ? globalThis.String(object.delegator_count) : "0", latest_index_was_undelegation: isSet(object.latest_index_was_undelegation) - ? Boolean(object.latest_index_was_undelegation) + ? globalThis.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); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.current_rewards !== "0") { + obj.current_rewards = message.current_rewards; + } + if (message.total_delegation !== "0") { + obj.total_delegation = message.total_delegation; + } + if (message.latest_index_k !== "0") { + obj.latest_index_k = message.latest_index_k; + } + if (message.delegator_count !== "0") { + obj.delegator_count = message.delegator_count; + } + if (message.latest_index_was_undelegation === true) { + obj.latest_index_was_undelegation = message.latest_index_was_undelegation; + } return obj; }, + create, I>>(base?: I): DelegationData { + return DelegationData.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DelegationData { const message = createBaseDelegationData(); message.staker = object.staker ?? ""; @@ -414,45 +503,67 @@ export const DelegationSlash = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegationSlash { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.k_index = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.fraction = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + k_index: isSet(object.k_index) ? globalThis.String(object.k_index) : "0", + fraction: isSet(object.fraction) ? globalThis.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); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.k_index !== "0") { + obj.k_index = message.k_index; + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } return obj; }, + create, I>>(base?: I): DelegationSlash { + return DelegationSlash.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DelegationSlash { const message = createBaseDelegationSlash(); message.staker = object.staker ?? ""; @@ -487,55 +598,89 @@ export const UndelegationQueueEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): UndelegationQueueEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.index = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.delegator = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.creation_time = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + index: isSet(object.index) ? globalThis.String(object.index) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + delegator: isSet(object.delegator) ? globalThis.String(object.delegator) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? globalThis.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); + if (message.index !== "0") { + obj.index = message.index; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.delegator !== "") { + obj.delegator = message.delegator; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.creation_time !== "0") { + obj.creation_time = message.creation_time; + } return obj; }, + create, I>>(base?: I): UndelegationQueueEntry { + return UndelegationQueueEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): UndelegationQueueEntry { const message = createBaseUndelegationQueueEntry(); message.index = object.index ?? "0"; @@ -563,40 +708,56 @@ export const QueueState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueueState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.low_index = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.high_index = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + low_index: isSet(object.low_index) ? globalThis.String(object.low_index) : "0", + high_index: isSet(object.high_index) ? globalThis.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); + if (message.low_index !== "0") { + obj.low_index = message.low_index; + } + if (message.high_index !== "0") { + obj.high_index = message.high_index; + } return obj; }, + create, I>>(base?: I): QueueState { + return QueueState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueueState { const message = createBaseQueueState(); message.low_index = object.low_index ?? "0"; @@ -621,40 +782,56 @@ export const RedelegationCooldown = { }, decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationCooldown { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.creation_date = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + address: isSet(object.address) ? globalThis.String(object.address) : "", + creation_date: isSet(object.creation_date) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.creation_date !== "0") { + obj.creation_date = message.creation_date; + } return obj; }, + create, I>>(base?: I): RedelegationCooldown { + return RedelegationCooldown.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): RedelegationCooldown { const message = createBaseRedelegationCooldown(); message.address = object.address ?? ""; @@ -666,7 +843,8 @@ export const RedelegationCooldown = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/delegation/v1beta1/events.ts b/common/types/src/client/kyve/delegation/v1beta1/events.ts index b220e0d9..031b7c43 100644 --- a/common/types/src/client/kyve/delegation/v1beta1/events.ts +++ b/common/types/src/client/kyve/delegation/v1beta1/events.ts @@ -12,9 +12,13 @@ export const protobufPackage = "kyve.delegation.v1beta1"; */ export interface EventUpdateParams { /** old_params is the module's old parameters. */ - old_params?: Params; + old_params?: + | Params + | undefined; /** new_params is the module's new parameters. */ - new_params?: Params; + new_params?: + | Params + | undefined; /** payload is the parameter updates that were performed. */ payload: string; } @@ -125,25 +129,38 @@ export const EventUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.old_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.new_params = Params.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -152,20 +169,27 @@ export const EventUpdateParams = { return { old_params: isSet(object.old_params) ? Params.fromJSON(object.old_params) : undefined, new_params: isSet(object.new_params) ? Params.fromJSON(object.new_params) : undefined, - payload: isSet(object.payload) ? String(object.payload) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: EventUpdateParams): unknown { const obj: any = {}; - message.old_params !== undefined && - (obj.old_params = message.old_params ? Params.toJSON(message.old_params) : undefined); - message.new_params !== undefined && - (obj.new_params = message.new_params ? Params.toJSON(message.new_params) : undefined); - message.payload !== undefined && (obj.payload = message.payload); + if (message.old_params !== undefined) { + obj.old_params = Params.toJSON(message.old_params); + } + if (message.new_params !== undefined) { + obj.new_params = Params.toJSON(message.new_params); + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): EventUpdateParams { + return EventUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateParams { const message = createBaseEventUpdateParams(); message.old_params = (object.old_params !== undefined && object.old_params !== null) @@ -198,45 +222,67 @@ export const EventDelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventDelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + address: isSet(object.address) ? globalThis.String(object.address) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventDelegate { + return EventDelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventDelegate { const message = createBaseEventDelegate(); message.address = object.address ?? ""; @@ -268,53 +314,80 @@ export const EventStartUndelegation = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventStartUndelegation { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventStartUndelegation(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.estimated_undelegation_date = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventStartUndelegation { return { - address: isSet(object.address) ? String(object.address) : "", - staker: isSet(object.staker) ? String(object.staker) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", estimated_undelegation_date: isSet(object.estimated_undelegation_date) - ? String(object.estimated_undelegation_date) + ? globalThis.String(object.estimated_undelegation_date) : "0", }; }, toJSON(message: EventStartUndelegation): 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); - message.estimated_undelegation_date !== undefined && - (obj.estimated_undelegation_date = message.estimated_undelegation_date); + if (message.address !== "") { + obj.address = message.address; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.estimated_undelegation_date !== "0") { + obj.estimated_undelegation_date = message.estimated_undelegation_date; + } return obj; }, + create, I>>(base?: I): EventStartUndelegation { + return EventStartUndelegation.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventStartUndelegation { const message = createBaseEventStartUndelegation(); message.address = object.address ?? ""; @@ -344,45 +417,67 @@ export const EventUndelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUndelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + address: isSet(object.address) ? globalThis.String(object.address) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventUndelegate { + return EventUndelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUndelegate { const message = createBaseEventUndelegate(); message.address = object.address ?? ""; @@ -414,50 +509,78 @@ export const EventRedelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventRedelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.from_staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.to_staker = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + address: isSet(object.address) ? globalThis.String(object.address) : "", + from_staker: isSet(object.from_staker) ? globalThis.String(object.from_staker) : "", + to_staker: isSet(object.to_staker) ? globalThis.String(object.to_staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.from_staker !== "") { + obj.from_staker = message.from_staker; + } + if (message.to_staker !== "") { + obj.to_staker = message.to_staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventRedelegate { + return EventRedelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventRedelegate { const message = createBaseEventRedelegate(); message.address = object.address ?? ""; @@ -487,45 +610,67 @@ export const EventWithdrawRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventWithdrawRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + address: isSet(object.address) ? globalThis.String(object.address) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventWithdrawRewards { + return EventWithdrawRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventWithdrawRewards { const message = createBaseEventWithdrawRewards(); message.address = object.address ?? ""; @@ -557,50 +702,78 @@ export const EventSlash = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventSlash { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.slash_type = reader.int32() as any; - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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)); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.slash_type !== 0) { + obj.slash_type = slashTypeToJSON(message.slash_type); + } return obj; }, + create, I>>(base?: I): EventSlash { + return EventSlash.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventSlash { const message = createBaseEventSlash(); message.pool_id = object.pool_id ?? "0"; @@ -614,7 +787,8 @@ export const EventSlash = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/delegation/v1beta1/genesis.ts b/common/types/src/client/kyve/delegation/v1beta1/genesis.ts index a94db103..26474063 100644 --- a/common/types/src/client/kyve/delegation/v1beta1/genesis.ts +++ b/common/types/src/client/kyve/delegation/v1beta1/genesis.ts @@ -16,7 +16,9 @@ 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; + params?: + | Params + | undefined; /** delegator_list ... */ delegator_list: Delegator[]; /** delegation_entry_list ... */ @@ -28,7 +30,9 @@ export interface GenesisState { /** undelegation_queue_entry_list ... */ undelegation_queue_entry_list: UndelegationQueueEntry[]; /** queue_state_undelegation ... */ - queue_state_undelegation?: QueueState; + queue_state_undelegation?: + | QueueState + | undefined; /** redelegation_cooldown_list ... */ redelegation_cooldown_list: RedelegationCooldown[]; } @@ -76,40 +80,73 @@ export const GenesisState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.delegator_list.push(Delegator.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.delegation_entry_list.push(DelegationEntry.decode(reader, reader.uint32())); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.delegation_data_list.push(DelegationData.decode(reader, reader.uint32())); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.delegation_slash_list.push(DelegationSlash.decode(reader, reader.uint32())); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.undelegation_queue_entry_list.push(UndelegationQueueEntry.decode(reader, reader.uint32())); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.queue_state_undelegation = QueueState.decode(reader, reader.uint32()); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.redelegation_cooldown_list.push(RedelegationCooldown.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -117,25 +154,25 @@ export const GenesisState = { fromJSON(object: any): GenesisState { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - delegator_list: Array.isArray(object?.delegator_list) + delegator_list: globalThis.Array.isArray(object?.delegator_list) ? object.delegator_list.map((e: any) => Delegator.fromJSON(e)) : [], - delegation_entry_list: Array.isArray(object?.delegation_entry_list) + delegation_entry_list: globalThis.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) + delegation_data_list: globalThis.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) + delegation_slash_list: globalThis.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) + undelegation_queue_entry_list: globalThis.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) + redelegation_cooldown_list: globalThis.Array.isArray(object?.redelegation_cooldown_list) ? object.redelegation_cooldown_list.map((e: any) => RedelegationCooldown.fromJSON(e)) : [], }; @@ -143,47 +180,38 @@ export const GenesisState = { 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) { + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.delegator_list?.length) { + obj.delegator_list = message.delegator_list.map((e) => Delegator.toJSON(e)); + } + if (message.delegation_entry_list?.length) { + obj.delegation_entry_list = message.delegation_entry_list.map((e) => DelegationEntry.toJSON(e)); + } + if (message.delegation_data_list?.length) { + obj.delegation_data_list = message.delegation_data_list.map((e) => DelegationData.toJSON(e)); + } + if (message.delegation_slash_list?.length) { + obj.delegation_slash_list = message.delegation_slash_list.map((e) => DelegationSlash.toJSON(e)); + } + if (message.undelegation_queue_entry_list?.length) { obj.undelegation_queue_entry_list = message.undelegation_queue_entry_list.map((e) => - e ? UndelegationQueueEntry.toJSON(e) : undefined + UndelegationQueueEntry.toJSON(e) ); - } 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 = []; + } + if (message.queue_state_undelegation !== undefined) { + obj.queue_state_undelegation = QueueState.toJSON(message.queue_state_undelegation); + } + if (message.redelegation_cooldown_list?.length) { + obj.redelegation_cooldown_list = message.redelegation_cooldown_list.map((e) => RedelegationCooldown.toJSON(e)); } return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) @@ -208,7 +236,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/delegation/v1beta1/params.ts b/common/types/src/client/kyve/delegation/v1beta1/params.ts index 5e5d02f5..9d495c1f 100644 --- a/common/types/src/client/kyve/delegation/v1beta1/params.ts +++ b/common/types/src/client/kyve/delegation/v1beta1/params.ts @@ -55,34 +55,59 @@ export const Params = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.unbonding_delegation_time = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.redelegation_cooldown = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.redelegation_max_amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.vote_slash = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.upload_slash = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.timeout_slash = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -90,28 +115,46 @@ export const Params = { fromJSON(object: any): Params { return { unbonding_delegation_time: isSet(object.unbonding_delegation_time) - ? String(object.unbonding_delegation_time) + ? globalThis.String(object.unbonding_delegation_time) + : "0", + redelegation_cooldown: isSet(object.redelegation_cooldown) + ? globalThis.String(object.redelegation_cooldown) + : "0", + redelegation_max_amount: isSet(object.redelegation_max_amount) + ? globalThis.String(object.redelegation_max_amount) : "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) : "", + vote_slash: isSet(object.vote_slash) ? globalThis.String(object.vote_slash) : "", + upload_slash: isSet(object.upload_slash) ? globalThis.String(object.upload_slash) : "", + timeout_slash: isSet(object.timeout_slash) ? globalThis.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); + if (message.unbonding_delegation_time !== "0") { + obj.unbonding_delegation_time = message.unbonding_delegation_time; + } + if (message.redelegation_cooldown !== "0") { + obj.redelegation_cooldown = message.redelegation_cooldown; + } + if (message.redelegation_max_amount !== "0") { + obj.redelegation_max_amount = message.redelegation_max_amount; + } + if (message.vote_slash !== "") { + obj.vote_slash = message.vote_slash; + } + if (message.upload_slash !== "") { + obj.upload_slash = message.upload_slash; + } + if (message.timeout_slash !== "") { + obj.timeout_slash = message.timeout_slash; + } return obj; }, + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Params { const message = createBaseParams(); message.unbonding_delegation_time = object.unbonding_delegation_time ?? "0"; @@ -127,7 +170,8 @@ export const Params = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/delegation/v1beta1/query.ts b/common/types/src/client/kyve/delegation/v1beta1/query.ts index b1b5f625..fa3a3652 100644 --- a/common/types/src/client/kyve/delegation/v1beta1/query.ts +++ b/common/types/src/client/kyve/delegation/v1beta1/query.ts @@ -11,7 +11,7 @@ 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; + params?: Params | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -24,16 +24,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -47,6 +48,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -66,19 +70,24 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -89,10 +98,15 @@ export const QueryParamsResponse = { toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) @@ -108,18 +122,19 @@ export interface Query { Params(request: QueryParamsRequest): Promise; } +export const QueryServiceName = "kyve.delegation.v1beta1.Query"; 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.service = opts?.service || QueryServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -130,7 +145,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/delegation/v1beta1/tx.ts b/common/types/src/client/kyve/delegation/v1beta1/tx.ts index 257ba0c5..12cbf4c9 100644 --- a/common/types/src/client/kyve/delegation/v1beta1/tx.ts +++ b/common/types/src/client/kyve/delegation/v1beta1/tx.ts @@ -94,45 +94,67 @@ export const MsgDelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgDelegate { + return MsgDelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgDelegate { const message = createBaseMsgDelegate(); message.creator = object.creator ?? ""; @@ -152,16 +174,17 @@ export const MsgDelegateResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -175,6 +198,9 @@ export const MsgDelegateResponse = { return obj; }, + create, I>>(base?: I): MsgDelegateResponse { + return MsgDelegateResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgDelegateResponse { const message = createBaseMsgDelegateResponse(); return message; @@ -197,40 +223,56 @@ export const MsgWithdrawRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgWithdrawRewards { return { - creator: isSet(object.creator) ? String(object.creator) : "", - staker: isSet(object.staker) ? String(object.staker) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", }; }, toJSON(message: MsgWithdrawRewards): unknown { const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.staker !== undefined && (obj.staker = message.staker); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } return obj; }, + create, I>>(base?: I): MsgWithdrawRewards { + return MsgWithdrawRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgWithdrawRewards { const message = createBaseMsgWithdrawRewards(); message.creator = object.creator ?? ""; @@ -249,16 +291,17 @@ export const MsgWithdrawRewardsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -272,6 +315,9 @@ export const MsgWithdrawRewardsResponse = { return obj; }, + create, I>>(base?: I): MsgWithdrawRewardsResponse { + return MsgWithdrawRewardsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgWithdrawRewardsResponse { const message = createBaseMsgWithdrawRewardsResponse(); return message; @@ -297,45 +343,67 @@ export const MsgUndelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgUndelegate { + return MsgUndelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUndelegate { const message = createBaseMsgUndelegate(); message.creator = object.creator ?? ""; @@ -355,16 +423,17 @@ export const MsgUndelegateResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -378,6 +447,9 @@ export const MsgUndelegateResponse = { return obj; }, + create, I>>(base?: I): MsgUndelegateResponse { + return MsgUndelegateResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUndelegateResponse { const message = createBaseMsgUndelegateResponse(); return message; @@ -406,50 +478,78 @@ export const MsgRedelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgRedelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.from_staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.to_staker = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + from_staker: isSet(object.from_staker) ? globalThis.String(object.from_staker) : "", + to_staker: isSet(object.to_staker) ? globalThis.String(object.to_staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.from_staker !== "") { + obj.from_staker = message.from_staker; + } + if (message.to_staker !== "") { + obj.to_staker = message.to_staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgRedelegate { + return MsgRedelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgRedelegate { const message = createBaseMsgRedelegate(); message.creator = object.creator ?? ""; @@ -470,16 +570,17 @@ export const MsgRedelegateResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgRedelegateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -493,6 +594,9 @@ export const MsgRedelegateResponse = { return obj; }, + create, I>>(base?: I): MsgRedelegateResponse { + return MsgRedelegateResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgRedelegateResponse { const message = createBaseMsgRedelegateResponse(); return message; @@ -515,40 +619,56 @@ export const MsgUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", - payload: isSet(object.payload) ? String(object.payload) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: MsgUpdateParams): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.payload !== undefined && (obj.payload = message.payload); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateParams { const message = createBaseMsgUpdateParams(); message.authority = object.authority ?? ""; @@ -567,16 +687,17 @@ export const MsgUpdateParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -590,6 +711,9 @@ export const MsgUpdateParamsResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateParamsResponse { const message = createBaseMsgUpdateParamsResponse(); return message; @@ -613,11 +737,12 @@ export interface Msg { UpdateParams(request: MsgUpdateParams): Promise; } +export const MsgServiceName = "kyve.delegation.v1beta1.Msg"; 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.service = opts?.service || MsgServiceName; this.rpc = rpc; this.Delegate = this.Delegate.bind(this); this.WithdrawRewards = this.WithdrawRewards.bind(this); @@ -628,31 +753,31 @@ export class MsgClientImpl implements Msg { 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))); + return promise.then((data) => MsgDelegateResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgWithdrawRewardsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUndelegateResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgRedelegateResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); } } @@ -663,7 +788,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/global/v1beta1/events.ts b/common/types/src/client/kyve/global/v1beta1/events.ts index 9c7b2481..0bdef677 100644 --- a/common/types/src/client/kyve/global/v1beta1/events.ts +++ b/common/types/src/client/kyve/global/v1beta1/events.ts @@ -10,9 +10,13 @@ export const protobufPackage = "kyve.global.v1beta1"; */ export interface EventUpdateParams { /** old_params is the module's old parameters. */ - old_params?: Params; + old_params?: + | Params + | undefined; /** new_params is the module's new parameters. */ - new_params?: Params; + new_params?: + | Params + | undefined; /** payload is the parameter updates that were performed. */ payload: string; } @@ -36,25 +40,38 @@ export const EventUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.old_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.new_params = Params.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -63,20 +80,27 @@ export const EventUpdateParams = { return { old_params: isSet(object.old_params) ? Params.fromJSON(object.old_params) : undefined, new_params: isSet(object.new_params) ? Params.fromJSON(object.new_params) : undefined, - payload: isSet(object.payload) ? String(object.payload) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: EventUpdateParams): unknown { const obj: any = {}; - message.old_params !== undefined && - (obj.old_params = message.old_params ? Params.toJSON(message.old_params) : undefined); - message.new_params !== undefined && - (obj.new_params = message.new_params ? Params.toJSON(message.new_params) : undefined); - message.payload !== undefined && (obj.payload = message.payload); + if (message.old_params !== undefined) { + obj.old_params = Params.toJSON(message.old_params); + } + if (message.new_params !== undefined) { + obj.new_params = Params.toJSON(message.new_params); + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): EventUpdateParams { + return EventUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateParams { const message = createBaseEventUpdateParams(); message.old_params = (object.old_params !== undefined && object.old_params !== null) @@ -93,7 +117,8 @@ export const EventUpdateParams = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/global/v1beta1/genesis.ts b/common/types/src/client/kyve/global/v1beta1/genesis.ts index e4cc420d..b71700a5 100644 --- a/common/types/src/client/kyve/global/v1beta1/genesis.ts +++ b/common/types/src/client/kyve/global/v1beta1/genesis.ts @@ -7,7 +7,7 @@ export const protobufPackage = "kyve.global.v1beta1"; /** GenesisState defines the global module's genesis state. */ export interface GenesisState { /** params defines all the parameters of the module. */ - params?: Params; + params?: Params | undefined; } function createBaseGenesisState(): GenesisState { @@ -23,19 +23,24 @@ export const GenesisState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -46,10 +51,15 @@ export const GenesisState = { toJSON(message: GenesisState): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) @@ -62,7 +72,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/global/v1beta1/global.ts b/common/types/src/client/kyve/global/v1beta1/global.ts index b8bbbf01..a23732b9 100644 --- a/common/types/src/client/kyve/global/v1beta1/global.ts +++ b/common/types/src/client/kyve/global/v1beta1/global.ts @@ -79,68 +79,95 @@ export const Params = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.min_gas_price = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.burn_ratio = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.gas_adjustments.push(GasAdjustment.decode(reader, reader.uint32())); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.gas_refunds.push(GasRefund.decode(reader, reader.uint32())); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.min_initial_deposit_ratio = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) + min_gas_price: isSet(object.min_gas_price) ? globalThis.String(object.min_gas_price) : "", + burn_ratio: isSet(object.burn_ratio) ? globalThis.String(object.burn_ratio) : "", + gas_adjustments: globalThis.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)) : [], + gas_refunds: globalThis.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) + ? globalThis.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.min_gas_price !== "") { + obj.min_gas_price = message.min_gas_price; } - if (message.gas_refunds) { - obj.gas_refunds = message.gas_refunds.map((e) => e ? GasRefund.toJSON(e) : undefined); - } else { - obj.gas_refunds = []; + if (message.burn_ratio !== "") { + obj.burn_ratio = message.burn_ratio; + } + if (message.gas_adjustments?.length) { + obj.gas_adjustments = message.gas_adjustments.map((e) => GasAdjustment.toJSON(e)); + } + if (message.gas_refunds?.length) { + obj.gas_refunds = message.gas_refunds.map((e) => GasRefund.toJSON(e)); + } + if (message.min_initial_deposit_ratio !== "") { + obj.min_initial_deposit_ratio = message.min_initial_deposit_ratio; } - message.min_initial_deposit_ratio !== undefined && - (obj.min_initial_deposit_ratio = message.min_initial_deposit_ratio); return obj; }, + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Params { const message = createBaseParams(); message.min_gas_price = object.min_gas_price ?? ""; @@ -168,40 +195,56 @@ export const GasAdjustment = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GasAdjustment { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.type = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): GasAdjustment { return { - type: isSet(object.type) ? String(object.type) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", + type: isSet(object.type) ? globalThis.String(object.type) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.type !== "") { + obj.type = message.type; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): GasAdjustment { + return GasAdjustment.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GasAdjustment { const message = createBaseGasAdjustment(); message.type = object.type ?? ""; @@ -226,40 +269,56 @@ export const GasRefund = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GasRefund { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.type = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.fraction = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): GasRefund { return { - type: isSet(object.type) ? String(object.type) : "", - fraction: isSet(object.fraction) ? String(object.fraction) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + fraction: isSet(object.fraction) ? globalThis.String(object.fraction) : "", }; }, toJSON(message: GasRefund): unknown { const obj: any = {}; - message.type !== undefined && (obj.type = message.type); - message.fraction !== undefined && (obj.fraction = message.fraction); + if (message.type !== "") { + obj.type = message.type; + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } return obj; }, + create, I>>(base?: I): GasRefund { + return GasRefund.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GasRefund { const message = createBaseGasRefund(); message.type = object.type ?? ""; @@ -271,7 +330,8 @@ export const GasRefund = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/global/v1beta1/query.ts b/common/types/src/client/kyve/global/v1beta1/query.ts index 252d319b..21b07e42 100644 --- a/common/types/src/client/kyve/global/v1beta1/query.ts +++ b/common/types/src/client/kyve/global/v1beta1/query.ts @@ -11,7 +11,7 @@ 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; + params?: Params | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -24,16 +24,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -47,6 +48,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -66,19 +70,24 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -89,10 +98,15 @@ export const QueryParamsResponse = { toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) @@ -108,18 +122,19 @@ export interface Query { Params(request: QueryParamsRequest): Promise; } +export const QueryServiceName = "kyve.global.v1beta1.Query"; export class QueryClientImpl implements Query { private readonly rpc: Rpc; private readonly service: string; constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || "kyve.global.v1beta1.Query"; + this.service = opts?.service || QueryServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -130,7 +145,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/global/v1beta1/tx.ts b/common/types/src/client/kyve/global/v1beta1/tx.ts index 8f4a9bba..054f931a 100644 --- a/common/types/src/client/kyve/global/v1beta1/tx.ts +++ b/common/types/src/client/kyve/global/v1beta1/tx.ts @@ -31,40 +31,56 @@ export const MsgUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", - payload: isSet(object.payload) ? String(object.payload) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: MsgUpdateParams): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.payload !== undefined && (obj.payload = message.payload); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateParams { const message = createBaseMsgUpdateParams(); message.authority = object.authority ?? ""; @@ -83,16 +99,17 @@ export const MsgUpdateParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -106,6 +123,9 @@ export const MsgUpdateParamsResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateParamsResponse { const message = createBaseMsgUpdateParamsResponse(); return message; @@ -122,18 +142,19 @@ export interface Msg { UpdateParams(request: MsgUpdateParams): Promise; } +export const MsgServiceName = "kyve.global.v1beta1.Msg"; export class MsgClientImpl implements Msg { private readonly rpc: Rpc; private readonly service: string; constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || "kyve.global.v1beta1.Msg"; + this.service = opts?.service || MsgServiceName; 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))); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); } } @@ -144,7 +165,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/pool/v1beta1/events.ts b/common/types/src/client/kyve/pool/v1beta1/events.ts index 9e7bf445..de015888 100644 --- a/common/types/src/client/kyve/pool/v1beta1/events.ts +++ b/common/types/src/client/kyve/pool/v1beta1/events.ts @@ -11,9 +11,13 @@ export const protobufPackage = "kyve.pool.v1beta1"; */ export interface EventUpdateParams { /** old_params is the module's old parameters. */ - old_params?: Params; + old_params?: + | Params + | undefined; /** new_params is the module's new parameters. */ - new_params?: Params; + new_params?: + | Params + | undefined; /** payload is the parameter updates that were performed. */ payload: string; } @@ -251,25 +255,38 @@ export const EventUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.old_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.new_params = Params.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -278,20 +295,27 @@ export const EventUpdateParams = { return { old_params: isSet(object.old_params) ? Params.fromJSON(object.old_params) : undefined, new_params: isSet(object.new_params) ? Params.fromJSON(object.new_params) : undefined, - payload: isSet(object.payload) ? String(object.payload) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: EventUpdateParams): unknown { const obj: any = {}; - message.old_params !== undefined && - (obj.old_params = message.old_params ? Params.toJSON(message.old_params) : undefined); - message.new_params !== undefined && - (obj.new_params = message.new_params ? Params.toJSON(message.new_params) : undefined); - message.payload !== undefined && (obj.payload = message.payload); + if (message.old_params !== undefined) { + obj.old_params = Params.toJSON(message.old_params); + } + if (message.new_params !== undefined) { + obj.new_params = Params.toJSON(message.new_params); + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): EventUpdateParams { + return EventUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateParams { const message = createBaseEventUpdateParams(); message.old_params = (object.old_params !== undefined && object.old_params !== null) @@ -372,100 +396,188 @@ export const EventCreatePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventCreatePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.name = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.runtime = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.logo = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.config = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.start_key = reader.string(); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.upload_interval = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.operating_cost = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.min_delegation = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.max_bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.version = reader.string(); - break; + continue; case 12: + if (tag !== 98) { + break; + } + message.binaries = reader.string(); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 14: + if (tag !== 112) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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, + id: isSet(object.id) ? globalThis.String(object.id) : "0", + name: isSet(object.name) ? globalThis.String(object.name) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + logo: isSet(object.logo) ? globalThis.String(object.logo) : "", + config: isSet(object.config) ? globalThis.String(object.config) : "", + start_key: isSet(object.start_key) ? globalThis.String(object.start_key) : "", + upload_interval: isSet(object.upload_interval) ? globalThis.String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? globalThis.String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? globalThis.String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? globalThis.String(object.max_bundle_size) : "0", + version: isSet(object.version) ? globalThis.String(object.version) : "", + binaries: isSet(object.binaries) ? globalThis.String(object.binaries) : "", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.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)); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.logo !== "") { + obj.logo = message.logo; + } + if (message.config !== "") { + obj.config = message.config; + } + if (message.start_key !== "") { + obj.start_key = message.start_key; + } + if (message.upload_interval !== "0") { + obj.upload_interval = message.upload_interval; + } + if (message.operating_cost !== "0") { + obj.operating_cost = message.operating_cost; + } + if (message.min_delegation !== "0") { + obj.min_delegation = message.min_delegation; + } + if (message.max_bundle_size !== "0") { + obj.max_bundle_size = message.max_bundle_size; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } return obj; }, + create, I>>(base?: I): EventCreatePool { + return EventCreatePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventCreatePool { const message = createBaseEventCreatePool(); message.id = object.id ?? "0"; @@ -499,33 +611,43 @@ export const EventPoolEnabled = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolEnabled { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventPoolEnabled(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventPoolEnabled { - return { id: isSet(object.id) ? String(object.id) : "0" }; + return { id: isSet(object.id) ? globalThis.String(object.id) : "0" }; }, toJSON(message: EventPoolEnabled): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): EventPoolEnabled { + return EventPoolEnabled.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPoolEnabled { const message = createBaseEventPoolEnabled(); message.id = object.id ?? "0"; @@ -546,33 +668,43 @@ export const EventPoolDisabled = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolDisabled { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventPoolDisabled(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventPoolDisabled { - return { id: isSet(object.id) ? String(object.id) : "0" }; + return { id: isSet(object.id) ? globalThis.String(object.id) : "0" }; }, toJSON(message: EventPoolDisabled): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): EventPoolDisabled { + return EventPoolDisabled.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPoolDisabled { const message = createBaseEventPoolDisabled(); message.id = object.id ?? "0"; @@ -610,71 +742,112 @@ export const EventRuntimeUpgradeScheduled = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventRuntimeUpgradeScheduled { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventRuntimeUpgradeScheduled(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.runtime = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.version = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.scheduled_at = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.duration = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.binaries = reader.string(); - break; + continue; case 6: - if ((tag & 7) === 2) { + if (tag === 48) { + message.affected_pools.push(longToString(reader.uint64() as Long)); + + continue; + } + + if (tag === 50) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.affected_pools.push(longToString(reader.uint64() as Long)); } - } else { - message.affected_pools.push(longToString(reader.uint64() as Long)); + + continue; } + break; - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventRuntimeUpgradeScheduled { return { - 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) : "", - affected_pools: Array.isArray(object?.affected_pools) ? object.affected_pools.map((e: any) => String(e)) : [], + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + scheduled_at: isSet(object.scheduled_at) ? globalThis.String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? globalThis.String(object.duration) : "0", + binaries: isSet(object.binaries) ? globalThis.String(object.binaries) : "", + affected_pools: globalThis.Array.isArray(object?.affected_pools) + ? object.affected_pools.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EventRuntimeUpgradeScheduled): unknown { const obj: any = {}; - 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); - if (message.affected_pools) { - obj.affected_pools = message.affected_pools.map((e) => e); - } else { - obj.affected_pools = []; + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.scheduled_at !== "0") { + obj.scheduled_at = message.scheduled_at; + } + if (message.duration !== "0") { + obj.duration = message.duration; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } + if (message.affected_pools?.length) { + obj.affected_pools = message.affected_pools; } return obj; }, + create, I>>(base?: I): EventRuntimeUpgradeScheduled { + return EventRuntimeUpgradeScheduled.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventRuntimeUpgradeScheduled { const message = createBaseEventRuntimeUpgradeScheduled(); message.runtime = object.runtime ?? ""; @@ -705,51 +878,68 @@ export const EventRuntimeUpgradeCancelled = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventRuntimeUpgradeCancelled { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventRuntimeUpgradeCancelled(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.runtime = reader.string(); - break; + continue; case 2: - if ((tag & 7) === 2) { + if (tag === 16) { + message.affected_pools.push(longToString(reader.uint64() as Long)); + + continue; + } + + if (tag === 18) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.affected_pools.push(longToString(reader.uint64() as Long)); } - } else { - message.affected_pools.push(longToString(reader.uint64() as Long)); + + continue; } - break; - default: - reader.skipType(tag & 7); + break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventRuntimeUpgradeCancelled { return { - runtime: isSet(object.runtime) ? String(object.runtime) : "", - affected_pools: Array.isArray(object?.affected_pools) ? object.affected_pools.map((e: any) => String(e)) : [], + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + affected_pools: globalThis.Array.isArray(object?.affected_pools) + ? object.affected_pools.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EventRuntimeUpgradeCancelled): unknown { const obj: any = {}; - message.runtime !== undefined && (obj.runtime = message.runtime); - if (message.affected_pools) { - obj.affected_pools = message.affected_pools.map((e) => e); - } else { - obj.affected_pools = []; + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.affected_pools?.length) { + obj.affected_pools = message.affected_pools; } return obj; }, + create, I>>(base?: I): EventRuntimeUpgradeCancelled { + return EventRuntimeUpgradeCancelled.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventRuntimeUpgradeCancelled { const message = createBaseEventRuntimeUpgradeCancelled(); message.runtime = object.runtime ?? ""; @@ -817,90 +1007,166 @@ export const EventPoolUpdated = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolUpdated { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventPoolUpdated(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.raw_update_string = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.name = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.runtime = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.logo = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.config = reader.string(); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.upload_interval = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.operating_cost = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.min_delegation = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.max_bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 88) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventPoolUpdated { return { - id: isSet(object.id) ? String(object.id) : "0", - raw_update_string: isSet(object.raw_update_string) ? String(object.raw_update_string) : "", - 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) : "", - 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", - 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, + id: isSet(object.id) ? globalThis.String(object.id) : "0", + raw_update_string: isSet(object.raw_update_string) ? globalThis.String(object.raw_update_string) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + logo: isSet(object.logo) ? globalThis.String(object.logo) : "", + config: isSet(object.config) ? globalThis.String(object.config) : "", + upload_interval: isSet(object.upload_interval) ? globalThis.String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? globalThis.String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? globalThis.String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? globalThis.String(object.max_bundle_size) : "0", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.Number(object.compression_id) : 0, }; }, toJSON(message: EventPoolUpdated): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); - message.raw_update_string !== undefined && (obj.raw_update_string = message.raw_update_string); - 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.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.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)); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.raw_update_string !== "") { + obj.raw_update_string = message.raw_update_string; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.logo !== "") { + obj.logo = message.logo; + } + if (message.config !== "") { + obj.config = message.config; + } + if (message.upload_interval !== "0") { + obj.upload_interval = message.upload_interval; + } + if (message.operating_cost !== "0") { + obj.operating_cost = message.operating_cost; + } + if (message.min_delegation !== "0") { + obj.min_delegation = message.min_delegation; + } + if (message.max_bundle_size !== "0") { + obj.max_bundle_size = message.max_bundle_size; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } return obj; }, + create, I>>(base?: I): EventPoolUpdated { + return EventPoolUpdated.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPoolUpdated { const message = createBaseEventPoolUpdated(); message.id = object.id ?? "0"; @@ -938,45 +1204,67 @@ export const EventFundPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventFundPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.address = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.address !== "") { + obj.address = message.address; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventFundPool { + return EventFundPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventFundPool { const message = createBaseEventFundPool(); message.pool_id = object.pool_id ?? "0"; @@ -1005,45 +1293,67 @@ export const EventDefundPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventDefundPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.address = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.address !== "") { + obj.address = message.address; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventDefundPool { + return EventDefundPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventDefundPool { const message = createBaseEventDefundPool(); message.pool_id = object.pool_id ?? "0"; @@ -1072,45 +1382,67 @@ export const EventPoolFundsSlashed = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolFundsSlashed { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.address = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.address !== "") { + obj.address = message.address; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventPoolFundsSlashed { + return EventPoolFundsSlashed.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPoolFundsSlashed { const message = createBaseEventPoolFundsSlashed(); message.pool_id = object.pool_id ?? "0"; @@ -1133,33 +1465,43 @@ export const EventPoolOutOfFunds = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolOutOfFunds { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventPoolOutOfFunds { - return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + return { pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0" }; }, toJSON(message: EventPoolOutOfFunds): unknown { const obj: any = {}; - message.pool_id !== undefined && (obj.pool_id = message.pool_id); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } return obj; }, + create, I>>(base?: I): EventPoolOutOfFunds { + return EventPoolOutOfFunds.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPoolOutOfFunds { const message = createBaseEventPoolOutOfFunds(); message.pool_id = object.pool_id ?? "0"; @@ -1170,7 +1512,8 @@ export const EventPoolOutOfFunds = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/pool/v1beta1/genesis.ts b/common/types/src/client/kyve/pool/v1beta1/genesis.ts index 31057598..10b7383f 100644 --- a/common/types/src/client/kyve/pool/v1beta1/genesis.ts +++ b/common/types/src/client/kyve/pool/v1beta1/genesis.ts @@ -9,7 +9,9 @@ export const protobufPackage = "kyve.pool.v1beta1"; /** GenesisState defines the pool module's genesis state. */ export interface GenesisState { /** params ... */ - params?: Params; + params?: + | Params + | undefined; /** pool_list ... */ pool_list: Pool[]; /** pool_count ... */ @@ -35,25 +37,38 @@ export const GenesisState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pool_list.push(Pool.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_count = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -61,23 +76,28 @@ export const GenesisState = { fromJSON(object: any): GenesisState { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - 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", + pool_list: globalThis.Array.isArray(object?.pool_list) ? object.pool_list.map((e: any) => Pool.fromJSON(e)) : [], + pool_count: isSet(object.pool_count) ? globalThis.String(object.pool_count) : "0", }; }, toJSON(message: GenesisState): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); - if (message.pool_list) { - obj.pool_list = message.pool_list.map((e) => e ? Pool.toJSON(e) : undefined); - } else { - obj.pool_list = []; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.pool_list?.length) { + obj.pool_list = message.pool_list.map((e) => Pool.toJSON(e)); + } + if (message.pool_count !== "0") { + obj.pool_count = message.pool_count; } - message.pool_count !== undefined && (obj.pool_count = message.pool_count); return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) @@ -92,7 +112,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/pool/v1beta1/params.ts b/common/types/src/client/kyve/pool/v1beta1/params.ts index eef68351..67eb92d7 100644 --- a/common/types/src/client/kyve/pool/v1beta1/params.ts +++ b/common/types/src/client/kyve/pool/v1beta1/params.ts @@ -27,43 +27,60 @@ export const Params = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.protocol_inflation_share = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pool_inflation_payout_rate = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Params { return { - protocol_inflation_share: isSet(object.protocol_inflation_share) ? String(object.protocol_inflation_share) : "", + protocol_inflation_share: isSet(object.protocol_inflation_share) + ? globalThis.String(object.protocol_inflation_share) + : "", pool_inflation_payout_rate: isSet(object.pool_inflation_payout_rate) - ? String(object.pool_inflation_payout_rate) + ? globalThis.String(object.pool_inflation_payout_rate) : "", }; }, toJSON(message: Params): unknown { const obj: any = {}; - message.protocol_inflation_share !== undefined && (obj.protocol_inflation_share = message.protocol_inflation_share); - message.pool_inflation_payout_rate !== undefined && - (obj.pool_inflation_payout_rate = message.pool_inflation_payout_rate); + if (message.protocol_inflation_share !== "") { + obj.protocol_inflation_share = message.protocol_inflation_share; + } + if (message.pool_inflation_payout_rate !== "") { + obj.pool_inflation_payout_rate = message.pool_inflation_payout_rate; + } return obj; }, + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Params { const message = createBaseParams(); message.protocol_inflation_share = object.protocol_inflation_share ?? ""; @@ -75,7 +92,8 @@ export const Params = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/pool/v1beta1/pool.ts b/common/types/src/client/kyve/pool/v1beta1/pool.ts index 2a2a4d2d..47273cdc 100644 --- a/common/types/src/client/kyve/pool/v1beta1/pool.ts +++ b/common/types/src/client/kyve/pool/v1beta1/pool.ts @@ -157,9 +157,13 @@ export interface Pool { /** total_funds ... */ total_funds: string; /** protocol ... */ - protocol?: Protocol; + protocol?: + | Protocol + | undefined; /** upgrade_plan ... */ - upgrade_plan?: UpgradePlan; + upgrade_plan?: + | UpgradePlan + | undefined; /** storage_provider_id ... */ current_storage_provider_id: number; /** compression_id ... */ @@ -185,45 +189,67 @@ export const Protocol = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Protocol { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.version = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.binaries = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.last_upgrade = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + version: isSet(object.version) ? globalThis.String(object.version) : "", + binaries: isSet(object.binaries) ? globalThis.String(object.binaries) : "", + last_upgrade: isSet(object.last_upgrade) ? globalThis.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); + if (message.version !== "") { + obj.version = message.version; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } + if (message.last_upgrade !== "0") { + obj.last_upgrade = message.last_upgrade; + } return obj; }, + create, I>>(base?: I): Protocol { + return Protocol.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Protocol { const message = createBaseProtocol(); message.version = object.version ?? ""; @@ -255,50 +281,78 @@ export const UpgradePlan = { }, decode(input: _m0.Reader | Uint8Array, length?: number): UpgradePlan { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.version = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.binaries = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.scheduled_at = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.duration = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + version: isSet(object.version) ? globalThis.String(object.version) : "", + binaries: isSet(object.binaries) ? globalThis.String(object.binaries) : "", + scheduled_at: isSet(object.scheduled_at) ? globalThis.String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? globalThis.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); + if (message.version !== "") { + obj.version = message.version; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } + if (message.scheduled_at !== "0") { + obj.scheduled_at = message.scheduled_at; + } + if (message.duration !== "0") { + obj.duration = message.duration; + } return obj; }, + create, I>>(base?: I): UpgradePlan { + return UpgradePlan.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): UpgradePlan { const message = createBaseUpgradePlan(); message.version = object.version ?? ""; @@ -325,40 +379,56 @@ export const Funder = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Funder { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Funder { return { - address: isSet(object.address) ? String(object.address) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): Funder { + return Funder.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Funder { const message = createBaseFunder(); message.address = object.address ?? ""; @@ -462,144 +532,269 @@ export const Pool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Pool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.name = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.runtime = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.logo = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.config = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.start_key = reader.string(); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.current_key = reader.string(); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.current_summary = reader.string(); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.current_index = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.total_bundles = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 88) { + break; + } + message.upload_interval = longToString(reader.uint64() as Long); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.operating_cost = longToString(reader.uint64() as Long); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.min_delegation = longToString(reader.uint64() as Long); - break; + continue; case 14: + if (tag !== 112) { + break; + } + message.max_bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 15: + if (tag !== 120) { + break; + } + message.disabled = reader.bool(); - break; + continue; case 16: + if (tag !== 130) { + break; + } + message.funders.push(Funder.decode(reader, reader.uint32())); - break; + continue; case 17: + if (tag !== 136) { + break; + } + message.total_funds = longToString(reader.uint64() as Long); - break; + continue; case 18: + if (tag !== 146) { + break; + } + message.protocol = Protocol.decode(reader, reader.uint32()); - break; + continue; case 19: + if (tag !== 154) { + break; + } + message.upgrade_plan = UpgradePlan.decode(reader, reader.uint32()); - break; + continue; case 20: + if (tag !== 160) { + break; + } + message.current_storage_provider_id = reader.uint32(); - break; + continue; case 21: + if (tag !== 168) { + break; + } + message.current_compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", - disabled: isSet(object.disabled) ? Boolean(object.disabled) : 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", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + name: isSet(object.name) ? globalThis.String(object.name) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + logo: isSet(object.logo) ? globalThis.String(object.logo) : "", + config: isSet(object.config) ? globalThis.String(object.config) : "", + start_key: isSet(object.start_key) ? globalThis.String(object.start_key) : "", + current_key: isSet(object.current_key) ? globalThis.String(object.current_key) : "", + current_summary: isSet(object.current_summary) ? globalThis.String(object.current_summary) : "", + current_index: isSet(object.current_index) ? globalThis.String(object.current_index) : "0", + total_bundles: isSet(object.total_bundles) ? globalThis.String(object.total_bundles) : "0", + upload_interval: isSet(object.upload_interval) ? globalThis.String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? globalThis.String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? globalThis.String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? globalThis.String(object.max_bundle_size) : "0", + disabled: isSet(object.disabled) ? globalThis.Boolean(object.disabled) : false, + funders: globalThis.Array.isArray(object?.funders) ? object.funders.map((e: any) => Funder.fromJSON(e)) : [], + total_funds: isSet(object.total_funds) ? globalThis.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) + ? globalThis.Number(object.current_storage_provider_id) + : 0, + current_compression_id: isSet(object.current_compression_id) + ? globalThis.Number(object.current_compression_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.disabled !== undefined && (obj.disabled = message.disabled); - 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)); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.logo !== "") { + obj.logo = message.logo; + } + if (message.config !== "") { + obj.config = message.config; + } + if (message.start_key !== "") { + obj.start_key = message.start_key; + } + if (message.current_key !== "") { + obj.current_key = message.current_key; + } + if (message.current_summary !== "") { + obj.current_summary = message.current_summary; + } + if (message.current_index !== "0") { + obj.current_index = message.current_index; + } + if (message.total_bundles !== "0") { + obj.total_bundles = message.total_bundles; + } + if (message.upload_interval !== "0") { + obj.upload_interval = message.upload_interval; + } + if (message.operating_cost !== "0") { + obj.operating_cost = message.operating_cost; + } + if (message.min_delegation !== "0") { + obj.min_delegation = message.min_delegation; + } + if (message.max_bundle_size !== "0") { + obj.max_bundle_size = message.max_bundle_size; + } + if (message.disabled === true) { + obj.disabled = message.disabled; + } + if (message.funders?.length) { + obj.funders = message.funders.map((e) => Funder.toJSON(e)); + } + if (message.total_funds !== "0") { + obj.total_funds = message.total_funds; + } + if (message.protocol !== undefined) { + obj.protocol = Protocol.toJSON(message.protocol); + } + if (message.upgrade_plan !== undefined) { + obj.upgrade_plan = UpgradePlan.toJSON(message.upgrade_plan); + } + if (message.current_storage_provider_id !== 0) { + obj.current_storage_provider_id = Math.round(message.current_storage_provider_id); + } + if (message.current_compression_id !== 0) { + obj.current_compression_id = Math.round(message.current_compression_id); + } return obj; }, + create, I>>(base?: I): Pool { + return Pool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Pool { const message = createBasePool(); message.id = object.id ?? "0"; @@ -634,7 +829,8 @@ export const Pool = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/pool/v1beta1/query.ts b/common/types/src/client/kyve/pool/v1beta1/query.ts index b6783ff7..07d65355 100644 --- a/common/types/src/client/kyve/pool/v1beta1/query.ts +++ b/common/types/src/client/kyve/pool/v1beta1/query.ts @@ -11,7 +11,7 @@ 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; + params?: Params | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -24,16 +24,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -47,6 +48,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -66,19 +70,24 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -89,10 +98,15 @@ export const QueryParamsResponse = { toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) @@ -108,18 +122,19 @@ export interface Query { Params(request: QueryParamsRequest): Promise; } +export const QueryServiceName = "kyve.pool.v1beta1.Query"; export class QueryClientImpl implements Query { private readonly rpc: Rpc; private readonly service: string; constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || "kyve.pool.v1beta1.Query"; + this.service = opts?.service || QueryServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -130,7 +145,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/pool/v1beta1/tx.ts b/common/types/src/client/kyve/pool/v1beta1/tx.ts index 49d2c23c..39300bdb 100644 --- a/common/types/src/client/kyve/pool/v1beta1/tx.ts +++ b/common/types/src/client/kyve/pool/v1beta1/tx.ts @@ -169,45 +169,67 @@ export const MsgFundPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgFundPool { + return MsgFundPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgFundPool { const message = createBaseMsgFundPool(); message.creator = object.creator ?? ""; @@ -227,16 +249,17 @@ export const MsgFundPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -250,6 +273,9 @@ export const MsgFundPoolResponse = { return obj; }, + create, I>>(base?: I): MsgFundPoolResponse { + return MsgFundPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgFundPoolResponse { const message = createBaseMsgFundPoolResponse(); return message; @@ -275,45 +301,67 @@ export const MsgDefundPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDefundPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgDefundPool { + return MsgDefundPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgDefundPool { const message = createBaseMsgDefundPool(); message.creator = object.creator ?? ""; @@ -333,16 +381,17 @@ export const MsgDefundPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDefundPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -356,6 +405,9 @@ export const MsgDefundPoolResponse = { return obj; }, + create, I>>(base?: I): MsgDefundPoolResponse { + return MsgDefundPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgDefundPoolResponse { const message = createBaseMsgDefundPoolResponse(); return message; @@ -429,100 +481,188 @@ export const MsgCreatePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.name = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.runtime = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.logo = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.config = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.start_key = reader.string(); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.upload_interval = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.operating_cost = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.min_delegation = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.max_bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.version = reader.string(); - break; + continue; case 12: + if (tag !== 98) { + break; + } + message.binaries = reader.string(); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 14: + if (tag !== 112) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + logo: isSet(object.logo) ? globalThis.String(object.logo) : "", + config: isSet(object.config) ? globalThis.String(object.config) : "", + start_key: isSet(object.start_key) ? globalThis.String(object.start_key) : "", + upload_interval: isSet(object.upload_interval) ? globalThis.String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? globalThis.String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? globalThis.String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? globalThis.String(object.max_bundle_size) : "0", + version: isSet(object.version) ? globalThis.String(object.version) : "", + binaries: isSet(object.binaries) ? globalThis.String(object.binaries) : "", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.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)); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.logo !== "") { + obj.logo = message.logo; + } + if (message.config !== "") { + obj.config = message.config; + } + if (message.start_key !== "") { + obj.start_key = message.start_key; + } + if (message.upload_interval !== "0") { + obj.upload_interval = message.upload_interval; + } + if (message.operating_cost !== "0") { + obj.operating_cost = message.operating_cost; + } + if (message.min_delegation !== "0") { + obj.min_delegation = message.min_delegation; + } + if (message.max_bundle_size !== "0") { + obj.max_bundle_size = message.max_bundle_size; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } return obj; }, + create, I>>(base?: I): MsgCreatePool { + return MsgCreatePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgCreatePool { const message = createBaseMsgCreatePool(); message.authority = object.authority ?? ""; @@ -553,16 +693,17 @@ export const MsgCreatePoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -576,6 +717,9 @@ export const MsgCreatePoolResponse = { return obj; }, + create, I>>(base?: I): MsgCreatePoolResponse { + return MsgCreatePoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgCreatePoolResponse { const message = createBaseMsgCreatePoolResponse(); return message; @@ -601,45 +745,67 @@ export const MsgUpdatePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdatePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + payload: isSet(object.payload) ? globalThis.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); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdatePool { + return MsgUpdatePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdatePool { const message = createBaseMsgUpdatePool(); message.authority = object.authority ?? ""; @@ -659,16 +825,17 @@ export const MsgUpdatePoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdatePoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -682,6 +849,9 @@ export const MsgUpdatePoolResponse = { return obj; }, + create, I>>(base?: I): MsgUpdatePoolResponse { + return MsgUpdatePoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdatePoolResponse { const message = createBaseMsgUpdatePoolResponse(); return message; @@ -704,40 +874,56 @@ export const MsgDisablePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDisablePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDisablePool(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgDisablePool { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", }; }, toJSON(message: MsgDisablePool): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): MsgDisablePool { + return MsgDisablePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgDisablePool { const message = createBaseMsgDisablePool(); message.authority = object.authority ?? ""; @@ -756,16 +942,17 @@ export const MsgDisablePoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDisablePoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDisablePoolResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -779,6 +966,9 @@ export const MsgDisablePoolResponse = { return obj; }, + create, I>>(base?: I): MsgDisablePoolResponse { + return MsgDisablePoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgDisablePoolResponse { const message = createBaseMsgDisablePoolResponse(); return message; @@ -801,40 +991,56 @@ export const MsgEnablePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgEnablePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgEnablePool(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgEnablePool { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", }; }, toJSON(message: MsgEnablePool): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): MsgEnablePool { + return MsgEnablePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgEnablePool { const message = createBaseMsgEnablePool(); message.authority = object.authority ?? ""; @@ -853,16 +1059,17 @@ export const MsgEnablePoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgEnablePoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgEnablePoolResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -876,6 +1083,9 @@ export const MsgEnablePoolResponse = { return obj; }, + create, I>>(base?: I): MsgEnablePoolResponse { + return MsgEnablePoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgEnablePoolResponse { const message = createBaseMsgEnablePoolResponse(); return message; @@ -910,60 +1120,100 @@ export const MsgScheduleRuntimeUpgrade = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgScheduleRuntimeUpgrade { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.runtime = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.version = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.scheduled_at = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.duration = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.binaries = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + scheduled_at: isSet(object.scheduled_at) ? globalThis.String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? globalThis.String(object.duration) : "0", + binaries: isSet(object.binaries) ? globalThis.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); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.scheduled_at !== "0") { + obj.scheduled_at = message.scheduled_at; + } + if (message.duration !== "0") { + obj.duration = message.duration; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } return obj; }, + create, I>>(base?: I): MsgScheduleRuntimeUpgrade { + return MsgScheduleRuntimeUpgrade.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgScheduleRuntimeUpgrade { const message = createBaseMsgScheduleRuntimeUpgrade(); message.authority = object.authority ?? ""; @@ -986,16 +1236,17 @@ export const MsgScheduleRuntimeUpgradeResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgScheduleRuntimeUpgradeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -1009,6 +1260,11 @@ export const MsgScheduleRuntimeUpgradeResponse = { return obj; }, + create, I>>( + base?: I, + ): MsgScheduleRuntimeUpgradeResponse { + return MsgScheduleRuntimeUpgradeResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( _: I, ): MsgScheduleRuntimeUpgradeResponse { @@ -1033,40 +1289,56 @@ export const MsgCancelRuntimeUpgrade = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelRuntimeUpgrade { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.runtime = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgCancelRuntimeUpgrade { return { - authority: isSet(object.authority) ? String(object.authority) : "", - runtime: isSet(object.runtime) ? String(object.runtime) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", }; }, toJSON(message: MsgCancelRuntimeUpgrade): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.runtime !== undefined && (obj.runtime = message.runtime); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } return obj; }, + create, I>>(base?: I): MsgCancelRuntimeUpgrade { + return MsgCancelRuntimeUpgrade.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgCancelRuntimeUpgrade { const message = createBaseMsgCancelRuntimeUpgrade(); message.authority = object.authority ?? ""; @@ -1085,16 +1357,17 @@ export const MsgCancelRuntimeUpgradeResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelRuntimeUpgradeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -1108,6 +1381,9 @@ export const MsgCancelRuntimeUpgradeResponse = { return obj; }, + create, I>>(base?: I): MsgCancelRuntimeUpgradeResponse { + return MsgCancelRuntimeUpgradeResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgCancelRuntimeUpgradeResponse { const message = createBaseMsgCancelRuntimeUpgradeResponse(); return message; @@ -1130,40 +1406,56 @@ export const MsgUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", - payload: isSet(object.payload) ? String(object.payload) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: MsgUpdateParams): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.payload !== undefined && (obj.payload = message.payload); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateParams { const message = createBaseMsgUpdateParams(); message.authority = object.authority ?? ""; @@ -1182,16 +1474,17 @@ export const MsgUpdateParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -1205,6 +1498,9 @@ export const MsgUpdateParamsResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateParamsResponse { const message = createBaseMsgUpdateParamsResponse(); return message; @@ -1254,11 +1550,12 @@ export interface Msg { UpdateParams(request: MsgUpdateParams): Promise; } +export const MsgServiceName = "kyve.pool.v1beta1.Msg"; 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.service = opts?.service || MsgServiceName; this.rpc = rpc; this.FundPool = this.FundPool.bind(this); this.DefundPool = this.DefundPool.bind(this); @@ -1273,55 +1570,55 @@ export class MsgClientImpl implements Msg { 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))); + return promise.then((data) => MsgFundPoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgDefundPoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgCreatePoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdatePoolResponse.decode(_m0.Reader.create(data))); } DisablePool(request: MsgDisablePool): Promise { const data = MsgDisablePool.encode(request).finish(); const promise = this.rpc.request(this.service, "DisablePool", data); - return promise.then((data) => MsgDisablePoolResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgDisablePoolResponse.decode(_m0.Reader.create(data))); } EnablePool(request: MsgEnablePool): Promise { const data = MsgEnablePool.encode(request).finish(); const promise = this.rpc.request(this.service, "EnablePool", data); - return promise.then((data) => MsgEnablePoolResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgEnablePoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgScheduleRuntimeUpgradeResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgCancelRuntimeUpgradeResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); } } @@ -1332,7 +1629,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/query/v1beta1/account.ts b/common/types/src/client/kyve/query/v1beta1/account.ts index 1a12e74d..b58d92db 100644 --- a/common/types/src/client/kyve/query/v1beta1/account.ts +++ b/common/types/src/client/kyve/query/v1beta1/account.ts @@ -33,7 +33,9 @@ export interface QueryAccountAssetsResponse { /** QueryAccountFundedListRequest ... */ export interface QueryAccountDelegationUnbondingsRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: + | PageRequest + | undefined; /** address ... */ address: string; } @@ -43,7 +45,7 @@ export interface QueryAccountDelegationUnbondingsResponse { /** balance ... */ unbondings: DelegationUnbonding[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** QueryAccountAssetsResponse is the response type for the Query/AccountAssets RPC method. */ @@ -53,7 +55,7 @@ export interface DelegationUnbonding { /** creation_time */ creation_time: string; /** staker */ - staker?: FullStaker; + staker?: FullStaker | undefined; } /** QueryAccountFundedListRequest is the request type for the account queries with pagination */ @@ -73,7 +75,7 @@ export interface Funded { /** amount ... */ amount: string; /** pool ... */ - pool?: BasicPool; + pool?: BasicPool | undefined; } /** QueryAccountDelegationListRequest ... */ @@ -111,33 +113,43 @@ export const QueryAccountAssetsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountAssetsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountAssetsRequest { - return { address: isSet(object.address) ? String(object.address) : "" }; + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, toJSON(message: QueryAccountAssetsRequest): unknown { const obj: any = {}; - message.address !== undefined && (obj.address = message.address); + if (message.address !== "") { + obj.address = message.address; + } return obj; }, + create, I>>(base?: I): QueryAccountAssetsRequest { + return QueryAccountAssetsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryAccountAssetsRequest { const message = createBaseQueryAccountAssetsRequest(); message.address = object.address ?? ""; @@ -184,71 +196,117 @@ export const QueryAccountAssetsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountAssetsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.balance = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.protocol_self_delegation = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.protocol_self_delegation_unbonding = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.protocol_delegation = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.protocol_delegation_unbonding = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.protocol_rewards = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.protocol_funding = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + balance: isSet(object.balance) ? globalThis.String(object.balance) : "0", + protocol_self_delegation: isSet(object.protocol_self_delegation) + ? globalThis.String(object.protocol_self_delegation) + : "0", protocol_self_delegation_unbonding: isSet(object.protocol_self_delegation_unbonding) - ? String(object.protocol_self_delegation_unbonding) + ? globalThis.String(object.protocol_self_delegation_unbonding) : "0", - protocol_delegation: isSet(object.protocol_delegation) ? String(object.protocol_delegation) : "0", + protocol_delegation: isSet(object.protocol_delegation) ? globalThis.String(object.protocol_delegation) : "0", protocol_delegation_unbonding: isSet(object.protocol_delegation_unbonding) - ? String(object.protocol_delegation_unbonding) + ? globalThis.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", + protocol_rewards: isSet(object.protocol_rewards) ? globalThis.String(object.protocol_rewards) : "0", + protocol_funding: isSet(object.protocol_funding) ? globalThis.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); + if (message.balance !== "0") { + obj.balance = message.balance; + } + if (message.protocol_self_delegation !== "0") { + obj.protocol_self_delegation = message.protocol_self_delegation; + } + if (message.protocol_self_delegation_unbonding !== "0") { + obj.protocol_self_delegation_unbonding = message.protocol_self_delegation_unbonding; + } + if (message.protocol_delegation !== "0") { + obj.protocol_delegation = message.protocol_delegation; + } + if (message.protocol_delegation_unbonding !== "0") { + obj.protocol_delegation_unbonding = message.protocol_delegation_unbonding; + } + if (message.protocol_rewards !== "0") { + obj.protocol_rewards = message.protocol_rewards; + } + if (message.protocol_funding !== "0") { + obj.protocol_funding = message.protocol_funding; + } return obj; }, + create, I>>(base?: I): QueryAccountAssetsResponse { + return QueryAccountAssetsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryAccountAssetsResponse { const message = createBaseQueryAccountAssetsResponse(); message.balance = object.balance ?? "0"; @@ -278,22 +336,31 @@ export const QueryAccountDelegationUnbondingsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountDelegationUnbondingsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -301,18 +368,26 @@ export const QueryAccountDelegationUnbondingsRequest = { fromJSON(object: any): QueryAccountDelegationUnbondingsRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - address: isSet(object.address) ? String(object.address) : "", + address: isSet(object.address) ? globalThis.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); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.address !== "") { + obj.address = message.address; + } return obj; }, + create, I>>( + base?: I, + ): QueryAccountDelegationUnbondingsRequest { + return QueryAccountDelegationUnbondingsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountDelegationUnbondingsRequest { @@ -341,29 +416,38 @@ export const QueryAccountDelegationUnbondingsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountDelegationUnbondingsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.unbondings.push(DelegationUnbonding.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountDelegationUnbondingsResponse { return { - unbondings: Array.isArray(object?.unbondings) + unbondings: globalThis.Array.isArray(object?.unbondings) ? object.unbondings.map((e: any) => DelegationUnbonding.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, @@ -372,16 +456,20 @@ export const QueryAccountDelegationUnbondingsResponse = { toJSON(message: QueryAccountDelegationUnbondingsResponse): unknown { const obj: any = {}; - if (message.unbondings) { - obj.unbondings = message.unbondings.map((e) => e ? DelegationUnbonding.toJSON(e) : undefined); - } else { - obj.unbondings = []; + if (message.unbondings?.length) { + obj.unbondings = message.unbondings.map((e) => DelegationUnbonding.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>( + base?: I, + ): QueryAccountDelegationUnbondingsResponse { + return QueryAccountDelegationUnbondingsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountDelegationUnbondingsResponse { @@ -413,45 +501,67 @@ export const DelegationUnbonding = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegationUnbonding { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.creation_time = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.staker = FullStaker.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? globalThis.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); + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.creation_time !== "0") { + obj.creation_time = message.creation_time; + } + if (message.staker !== undefined) { + obj.staker = FullStaker.toJSON(message.staker); + } return obj; }, + create, I>>(base?: I): DelegationUnbonding { + return DelegationUnbonding.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DelegationUnbonding { const message = createBaseDelegationUnbonding(); message.amount = object.amount ?? "0"; @@ -476,33 +586,43 @@ export const QueryAccountFundedListRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountFundedListRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountFundedListRequest { - return { address: isSet(object.address) ? String(object.address) : "" }; + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, toJSON(message: QueryAccountFundedListRequest): unknown { const obj: any = {}; - message.address !== undefined && (obj.address = message.address); + if (message.address !== "") { + obj.address = message.address; + } return obj; }, + create, I>>(base?: I): QueryAccountFundedListRequest { + return QueryAccountFundedListRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountFundedListRequest { @@ -525,37 +645,45 @@ export const QueryAccountFundedListResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountFundedListResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.funded.push(Funded.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountFundedListResponse { - return { funded: Array.isArray(object?.funded) ? object.funded.map((e: any) => Funded.fromJSON(e)) : [] }; + return { + funded: globalThis.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 = []; + if (message.funded?.length) { + obj.funded = message.funded.map((e) => Funded.toJSON(e)); } return obj; }, + create, I>>(base?: I): QueryAccountFundedListResponse { + return QueryAccountFundedListResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountFundedListResponse { @@ -581,40 +709,56 @@ export const Funded = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Funded { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pool = BasicPool.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Funded { return { - amount: isSet(object.amount) ? String(object.amount) : "0", + amount: isSet(object.amount) ? globalThis.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); + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.pool !== undefined) { + obj.pool = BasicPool.toJSON(message.pool); + } return obj; }, + create, I>>(base?: I): Funded { + return Funded.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Funded { const message = createBaseFunded(); message.amount = object.amount ?? "0"; @@ -636,33 +780,43 @@ export const QueryAccountRedelegationRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRedelegationRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountRedelegationRequest { - return { address: isSet(object.address) ? String(object.address) : "" }; + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, toJSON(message: QueryAccountRedelegationRequest): unknown { const obj: any = {}; - message.address !== undefined && (obj.address = message.address); + if (message.address !== "") { + obj.address = message.address; + } return obj; }, + create, I>>(base?: I): QueryAccountRedelegationRequest { + return QueryAccountRedelegationRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountRedelegationRequest { @@ -688,48 +842,60 @@ export const QueryAccountRedelegationResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRedelegationResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.redelegation_cooldown_entries.push(RedelegationEntry.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.available_slots = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountRedelegationResponse { return { - redelegation_cooldown_entries: Array.isArray(object?.redelegation_cooldown_entries) + redelegation_cooldown_entries: globalThis.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", + available_slots: isSet(object.available_slots) ? globalThis.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); + if (message.redelegation_cooldown_entries?.length) { + obj.redelegation_cooldown_entries = message.redelegation_cooldown_entries.map((e) => RedelegationEntry.toJSON(e)); + } + if (message.available_slots !== "0") { + obj.available_slots = message.available_slots; + } return obj; }, + create, I>>( + base?: I, + ): QueryAccountRedelegationResponse { + return QueryAccountRedelegationResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountRedelegationResponse { @@ -757,40 +923,56 @@ export const RedelegationEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.creation_date = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.finish_date = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creation_date: isSet(object.creation_date) ? globalThis.String(object.creation_date) : "0", + finish_date: isSet(object.finish_date) ? globalThis.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); + if (message.creation_date !== "0") { + obj.creation_date = message.creation_date; + } + if (message.finish_date !== "0") { + obj.finish_date = message.finish_date; + } return obj; }, + create, I>>(base?: I): RedelegationEntry { + return RedelegationEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): RedelegationEntry { const message = createBaseRedelegationEntry(); message.creation_date = object.creation_date ?? "0"; @@ -813,11 +995,12 @@ export interface QueryAccount { AccountRedelegation(request: QueryAccountRedelegationRequest): Promise; } +export const QueryAccountServiceName = "kyve.query.v1beta1.QueryAccount"; 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.service = opts?.service || QueryAccountServiceName; this.rpc = rpc; this.AccountAssets = this.AccountAssets.bind(this); this.AccountDelegationUnbondings = this.AccountDelegationUnbondings.bind(this); @@ -827,7 +1010,7 @@ export class QueryAccountClientImpl implements QueryAccount { 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))); + return promise.then((data) => QueryAccountAssetsResponse.decode(_m0.Reader.create(data))); } AccountDelegationUnbondings( @@ -835,19 +1018,19 @@ export class QueryAccountClientImpl implements QueryAccount { ): 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))); + return promise.then((data) => QueryAccountDelegationUnbondingsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryAccountFundedListResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryAccountRedelegationResponse.decode(_m0.Reader.create(data))); } } @@ -858,7 +1041,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/query/v1beta1/bundles.ts b/common/types/src/client/kyve/query/v1beta1/bundles.ts index fa32d124..bce7c561 100644 --- a/common/types/src/client/kyve/query/v1beta1/bundles.ts +++ b/common/types/src/client/kyve/query/v1beta1/bundles.ts @@ -2,16 +2,78 @@ 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"; +/** FinalizedBundle represents the latest version of a valid bundle of a pool */ +export interface FinalizedBundle { + /** pool_id in which the bundle was created */ + pool_id: string; + /** id is is integrated with each valid bundle produced. */ + id: string; + /** storage_id is the id with which the data can be retrieved from the configured data provider */ + 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; + /** from_key is the key of the first data item in the bundle proposal */ + from_key: string; + /** to_key the key of the last data item in the bundle */ + to_key: string; + /** bundle_summary is a summary of the bundle. */ + bundle_summary: string; + /** data_hash is a sha256 hash of the uploaded data. */ + data_hash: string; + /** finalized_at contains details of the block that finalized this bundle. */ + finalized_at?: + | FinalizedAt + | undefined; + /** storage_provider_id the id of the storage provider where the bundle is stored */ + storage_provider_id: string; + /** compression_id the id of the compression type with which the data was compressed */ + compression_id: string; + /** + * stake_security defines the amount of stake which was present in the pool during the finalization of the bundle. + * This field was added in schema version 2. Bundles finalized before that return `null`. + */ + stake_security?: StakeSecurity | undefined; +} + +/** FinalizedAt stores information about finalization block and time. */ +export interface FinalizedAt { + /** height is the block height in which the bundle got finalized. */ + height: string; + /** timestamp is the UNIX timestamp of the block in which the bundle got finalized. */ + timestamp: string; +} + +/** StakeSecurity represents the relative security of a finalized bundle */ +export interface StakeSecurity { + /** valid_vote_power gives the amount of $KYVE stake that voted `valid`. */ + valid_vote_power: string; + /** + * total_vote_power gives the amount of total $KYVE stake that was present in the pool + * during finalization. + */ + total_vote_power: string; +} + /** QueryFinalizedBundlesRequest is the request type for the Query/Staker RPC method. */ export interface QueryFinalizedBundlesRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: + | PageRequest + | undefined; /** pool_id ... */ pool_id: string; + /** + * index is an optional parameter which tells the server to only show + * the bundle with the given index. This can not be combined with pagination. + */ + index: string; } /** QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. */ @@ -19,7 +81,7 @@ export interface QueryFinalizedBundlesResponse { /** finalized_bundles ... */ finalized_bundles: FinalizedBundle[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** QueryFinalizedBundleRequest is the request type for the Query/Staker RPC method. */ @@ -32,22 +94,8 @@ export interface QueryFinalizedBundleRequest { /** 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; + /** finalized_bundles ... */ + finalized_bundles?: FinalizedBundle | undefined; } /** QueryCurrentVoteStatusRequest is the request type for the Query/Staker RPC method. */ @@ -124,8 +172,429 @@ export interface QueryCanVoteResponse { reason: string; } +function createBaseFinalizedBundle(): FinalizedBundle { + return { + pool_id: "0", + id: "0", + storage_id: "", + uploader: "", + from_index: "0", + to_index: "0", + from_key: "", + to_key: "", + bundle_summary: "", + data_hash: "", + finalized_at: undefined, + storage_provider_id: "0", + compression_id: "0", + stake_security: undefined, + }; +} + +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.from_key !== "") { + writer.uint32(90).string(message.from_key); + } + 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 !== undefined) { + FinalizedAt.encode(message.finalized_at, writer.uint32(82).fork()).ldelim(); + } + if (message.storage_provider_id !== "0") { + writer.uint32(96).uint64(message.storage_provider_id); + } + if (message.compression_id !== "0") { + writer.uint32(104).uint64(message.compression_id); + } + if (message.stake_security !== undefined) { + StakeSecurity.encode(message.stake_security, writer.uint32(114).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FinalizedBundle { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.pool_id = longToString(reader.uint64() as Long); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.id = longToString(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.storage_id = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.uploader = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.from_index = longToString(reader.uint64() as Long); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.to_index = longToString(reader.uint64() as Long); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.from_key = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.to_key = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.bundle_summary = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.data_hash = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.finalized_at = FinalizedAt.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.storage_provider_id = longToString(reader.uint64() as Long); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.compression_id = longToString(reader.uint64() as Long); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.stake_security = StakeSecurity.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FinalizedBundle { + return { + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.String(object.storage_id) : "", + uploader: isSet(object.uploader) ? globalThis.String(object.uploader) : "", + from_index: isSet(object.from_index) ? globalThis.String(object.from_index) : "0", + to_index: isSet(object.to_index) ? globalThis.String(object.to_index) : "0", + from_key: isSet(object.from_key) ? globalThis.String(object.from_key) : "", + to_key: isSet(object.to_key) ? globalThis.String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? globalThis.String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? globalThis.String(object.data_hash) : "", + finalized_at: isSet(object.finalized_at) ? FinalizedAt.fromJSON(object.finalized_at) : undefined, + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.String(object.storage_provider_id) : "0", + compression_id: isSet(object.compression_id) ? globalThis.String(object.compression_id) : "0", + stake_security: isSet(object.stake_security) ? StakeSecurity.fromJSON(object.stake_security) : undefined, + }; + }, + + toJSON(message: FinalizedBundle): unknown { + const obj: any = {}; + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.uploader !== "") { + obj.uploader = message.uploader; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } + if (message.to_index !== "0") { + obj.to_index = message.to_index; + } + if (message.from_key !== "") { + obj.from_key = message.from_key; + } + if (message.to_key !== "") { + obj.to_key = message.to_key; + } + if (message.bundle_summary !== "") { + obj.bundle_summary = message.bundle_summary; + } + if (message.data_hash !== "") { + obj.data_hash = message.data_hash; + } + if (message.finalized_at !== undefined) { + obj.finalized_at = FinalizedAt.toJSON(message.finalized_at); + } + if (message.storage_provider_id !== "0") { + obj.storage_provider_id = message.storage_provider_id; + } + if (message.compression_id !== "0") { + obj.compression_id = message.compression_id; + } + if (message.stake_security !== undefined) { + obj.stake_security = StakeSecurity.toJSON(message.stake_security); + } + return obj; + }, + + create, I>>(base?: I): FinalizedBundle { + return FinalizedBundle.fromPartial(base ?? ({} as any)); + }, + 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.from_key = object.from_key ?? ""; + message.to_key = object.to_key ?? ""; + message.bundle_summary = object.bundle_summary ?? ""; + message.data_hash = object.data_hash ?? ""; + message.finalized_at = (object.finalized_at !== undefined && object.finalized_at !== null) + ? FinalizedAt.fromPartial(object.finalized_at) + : undefined; + message.storage_provider_id = object.storage_provider_id ?? "0"; + message.compression_id = object.compression_id ?? "0"; + message.stake_security = (object.stake_security !== undefined && object.stake_security !== null) + ? StakeSecurity.fromPartial(object.stake_security) + : undefined; + return message; + }, +}; + +function createBaseFinalizedAt(): FinalizedAt { + return { height: "", timestamp: "" }; +} + +export const FinalizedAt = { + encode(message: FinalizedAt, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "") { + writer.uint32(10).string(message.height); + } + if (message.timestamp !== "") { + writer.uint32(18).string(message.timestamp); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FinalizedAt { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFinalizedAt(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.height = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.timestamp = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FinalizedAt { + return { + height: isSet(object.height) ? globalThis.String(object.height) : "", + timestamp: isSet(object.timestamp) ? globalThis.String(object.timestamp) : "", + }; + }, + + toJSON(message: FinalizedAt): unknown { + const obj: any = {}; + if (message.height !== "") { + obj.height = message.height; + } + if (message.timestamp !== "") { + obj.timestamp = message.timestamp; + } + return obj; + }, + + create, I>>(base?: I): FinalizedAt { + return FinalizedAt.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FinalizedAt { + const message = createBaseFinalizedAt(); + message.height = object.height ?? ""; + message.timestamp = object.timestamp ?? ""; + return message; + }, +}; + +function createBaseStakeSecurity(): StakeSecurity { + return { valid_vote_power: "", total_vote_power: "" }; +} + +export const StakeSecurity = { + encode(message: StakeSecurity, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.valid_vote_power !== "") { + writer.uint32(10).string(message.valid_vote_power); + } + if (message.total_vote_power !== "") { + writer.uint32(18).string(message.total_vote_power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakeSecurity { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeSecurity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.valid_vote_power = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total_vote_power = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeSecurity { + return { + valid_vote_power: isSet(object.valid_vote_power) ? globalThis.String(object.valid_vote_power) : "", + total_vote_power: isSet(object.total_vote_power) ? globalThis.String(object.total_vote_power) : "", + }; + }, + + toJSON(message: StakeSecurity): unknown { + const obj: any = {}; + if (message.valid_vote_power !== "") { + obj.valid_vote_power = message.valid_vote_power; + } + if (message.total_vote_power !== "") { + obj.total_vote_power = message.total_vote_power; + } + return obj; + }, + + create, I>>(base?: I): StakeSecurity { + return StakeSecurity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeSecurity { + const message = createBaseStakeSecurity(); + message.valid_vote_power = object.valid_vote_power ?? ""; + message.total_vote_power = object.total_vote_power ?? ""; + return message; + }, +}; + function createBaseQueryFinalizedBundlesRequest(): QueryFinalizedBundlesRequest { - return { pagination: undefined, pool_id: "0" }; + return { pagination: undefined, pool_id: "0", index: "" }; } export const QueryFinalizedBundlesRequest = { @@ -136,26 +605,45 @@ export const QueryFinalizedBundlesRequest = { if (message.pool_id !== "0") { writer.uint32(16).uint64(message.pool_id); } + if (message.index !== "") { + writer.uint32(26).string(message.index); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.index = reader.string(); + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -163,24 +651,35 @@ export const QueryFinalizedBundlesRequest = { 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + index: isSet(object.index) ? globalThis.String(object.index) : "", }; }, 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); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.index !== "") { + obj.index = message.index; + } return obj; }, + create, I>>(base?: I): QueryFinalizedBundlesRequest { + return QueryFinalizedBundlesRequest.fromPartial(base ?? ({} as any)); + }, 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"; + message.index = object.index ?? ""; return message; }, }; @@ -201,29 +700,38 @@ export const QueryFinalizedBundlesResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.finalized_bundles.push(FinalizedBundle.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryFinalizedBundlesResponse { return { - finalized_bundles: Array.isArray(object?.finalized_bundles) + finalized_bundles: globalThis.Array.isArray(object?.finalized_bundles) ? object.finalized_bundles.map((e: any) => FinalizedBundle.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, @@ -232,16 +740,18 @@ export const QueryFinalizedBundlesResponse = { 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 = []; + if (message.finalized_bundles?.length) { + obj.finalized_bundles = message.finalized_bundles.map((e) => FinalizedBundle.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryFinalizedBundlesResponse { + return QueryFinalizedBundlesResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryFinalizedBundlesResponse { @@ -270,40 +780,56 @@ export const QueryFinalizedBundleRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundleRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): QueryFinalizedBundleRequest { + return QueryFinalizedBundleRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryFinalizedBundleRequest { const message = createBaseQueryFinalizedBundleRequest(); message.pool_id = object.pool_id ?? "0"; @@ -313,166 +839,63 @@ export const QueryFinalizedBundleRequest = { }; function createBaseQueryFinalizedBundleResponse(): QueryFinalizedBundleResponse { - return { finalized_bundle: undefined }; + return { finalized_bundles: 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(); + if (message.finalized_bundles !== undefined) { + FinalizedBundle.encode(message.finalized_bundles, 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); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; + if (tag !== 10) { + break; + } + + message.finalized_bundles = FinalizedBundle.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryFinalizedBundleResponse { return { - finalized_bundle: isSet(object.finalized_bundle) ? FinalizedBundle.fromJSON(object.finalized_bundle) : undefined, + finalized_bundles: isSet(object.finalized_bundles) + ? FinalizedBundle.fromJSON(object.finalized_bundles) + : 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.finalized_bundles !== undefined) { + obj.finalized_bundles = FinalizedBundle.toJSON(message.finalized_bundles); } - 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, - }; + create, I>>(base?: I): QueryFinalizedBundleResponse { + return QueryFinalizedBundleResponse.fromPartial(base ?? ({} as any)); }, - - 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) + fromPartial, I>>(object: I): QueryFinalizedBundleResponse { + const message = createBaseQueryFinalizedBundleResponse(); + message.finalized_bundles = (object.finalized_bundles !== undefined && object.finalized_bundles !== null) + ? FinalizedBundle.fromPartial(object.finalized_bundles) : undefined; return message; }, @@ -491,33 +914,43 @@ export const QueryCurrentVoteStatusRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentVoteStatusRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryCurrentVoteStatusRequest { - return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + return { pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0" }; }, toJSON(message: QueryCurrentVoteStatusRequest): unknown { const obj: any = {}; - message.pool_id !== undefined && (obj.pool_id = message.pool_id); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } return obj; }, + create, I>>(base?: I): QueryCurrentVoteStatusRequest { + return QueryCurrentVoteStatusRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryCurrentVoteStatusRequest { @@ -549,50 +982,78 @@ export const QueryCurrentVoteStatusResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentVoteStatusResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.valid = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.invalid = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.abstain = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.total = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + valid: isSet(object.valid) ? globalThis.String(object.valid) : "0", + invalid: isSet(object.invalid) ? globalThis.String(object.invalid) : "0", + abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "0", + total: isSet(object.total) ? globalThis.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); + if (message.valid !== "0") { + obj.valid = message.valid; + } + if (message.invalid !== "0") { + obj.invalid = message.invalid; + } + if (message.abstain !== "0") { + obj.abstain = message.abstain; + } + if (message.total !== "0") { + obj.total = message.total; + } return obj; }, + create, I>>(base?: I): QueryCurrentVoteStatusResponse { + return QueryCurrentVoteStatusResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryCurrentVoteStatusResponse { @@ -621,40 +1082,56 @@ export const QueryCanValidateRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanValidateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.valaddress = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + valaddress: isSet(object.valaddress) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.valaddress !== "") { + obj.valaddress = message.valaddress; + } return obj; }, + create, I>>(base?: I): QueryCanValidateRequest { + return QueryCanValidateRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanValidateRequest { const message = createBaseQueryCanValidateRequest(); message.pool_id = object.pool_id ?? "0"; @@ -679,40 +1156,56 @@ export const QueryCanValidateResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanValidateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.possible = reader.bool(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.reason = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryCanValidateResponse { return { - possible: isSet(object.possible) ? Boolean(object.possible) : false, - reason: isSet(object.reason) ? String(object.reason) : "", + possible: isSet(object.possible) ? globalThis.Boolean(object.possible) : false, + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", }; }, toJSON(message: QueryCanValidateResponse): unknown { const obj: any = {}; - message.possible !== undefined && (obj.possible = message.possible); - message.reason !== undefined && (obj.reason = message.reason); + if (message.possible === true) { + obj.possible = message.possible; + } + if (message.reason !== "") { + obj.reason = message.reason; + } return obj; }, + create, I>>(base?: I): QueryCanValidateResponse { + return QueryCanValidateResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanValidateResponse { const message = createBaseQueryCanValidateResponse(); message.possible = object.possible ?? false; @@ -743,50 +1236,78 @@ export const QueryCanProposeRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanProposeRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.proposer = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.from_index = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + from_index: isSet(object.from_index) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } return obj; }, + create, I>>(base?: I): QueryCanProposeRequest { + return QueryCanProposeRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanProposeRequest { const message = createBaseQueryCanProposeRequest(); message.pool_id = object.pool_id ?? "0"; @@ -813,40 +1334,56 @@ export const QueryCanProposeResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanProposeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.possible = reader.bool(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.reason = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryCanProposeResponse { return { - possible: isSet(object.possible) ? Boolean(object.possible) : false, - reason: isSet(object.reason) ? String(object.reason) : "", + possible: isSet(object.possible) ? globalThis.Boolean(object.possible) : false, + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", }; }, toJSON(message: QueryCanProposeResponse): unknown { const obj: any = {}; - message.possible !== undefined && (obj.possible = message.possible); - message.reason !== undefined && (obj.reason = message.reason); + if (message.possible === true) { + obj.possible = message.possible; + } + if (message.reason !== "") { + obj.reason = message.reason; + } return obj; }, + create, I>>(base?: I): QueryCanProposeResponse { + return QueryCanProposeResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanProposeResponse { const message = createBaseQueryCanProposeResponse(); message.possible = object.possible ?? false; @@ -877,50 +1414,78 @@ export const QueryCanVoteRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanVoteRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.voter = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.storage_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + storage_id: isSet(object.storage_id) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } return obj; }, + create, I>>(base?: I): QueryCanVoteRequest { + return QueryCanVoteRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanVoteRequest { const message = createBaseQueryCanVoteRequest(); message.pool_id = object.pool_id ?? "0"; @@ -947,40 +1512,56 @@ export const QueryCanVoteResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.possible = reader.bool(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.reason = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryCanVoteResponse { return { - possible: isSet(object.possible) ? Boolean(object.possible) : false, - reason: isSet(object.reason) ? String(object.reason) : "", + possible: isSet(object.possible) ? globalThis.Boolean(object.possible) : false, + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", }; }, toJSON(message: QueryCanVoteResponse): unknown { const obj: any = {}; - message.possible !== undefined && (obj.possible = message.possible); - message.reason !== undefined && (obj.reason = message.reason); + if (message.possible === true) { + obj.possible = message.possible; + } + if (message.reason !== "") { + obj.reason = message.reason; + } return obj; }, + create, I>>(base?: I): QueryCanVoteResponse { + return QueryCanVoteResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanVoteResponse { const message = createBaseQueryCanVoteResponse(); message.possible = object.possible ?? false; @@ -992,13 +1573,9 @@ export const QueryCanVoteResponse = { /** QueryDelegation contains all rpc requests related to direct delegation data */ export interface QueryBundles { /** FinalizedBundles ... */ - FinalizedBundles(request: QueryFinalizedBundlesRequest): Promise; + FinalizedBundlesQuery(request: QueryFinalizedBundlesRequest): Promise; /** FinalizedBundle ... */ - FinalizedBundle(request: QueryFinalizedBundleRequest): Promise; - /** Queries the bundle which contains the data given height */ - FinalizedBundlesByHeight( - request: QueryFinalizedBundlesByHeightRequest, - ): Promise; + FinalizedBundleQuery(request: QueryFinalizedBundleRequest): Promise; /** CurrentVoteStatus ... */ CurrentVoteStatus(request: QueryCurrentVoteStatusRequest): Promise; /** CanValidate ... */ @@ -1009,62 +1586,54 @@ export interface QueryBundles { CanVote(request: QueryCanVoteRequest): Promise; } +export const QueryBundlesServiceName = "kyve.query.v1beta1.QueryBundles"; 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.service = opts?.service || QueryBundlesServiceName; this.rpc = rpc; - this.FinalizedBundles = this.FinalizedBundles.bind(this); - this.FinalizedBundle = this.FinalizedBundle.bind(this); - this.FinalizedBundlesByHeight = this.FinalizedBundlesByHeight.bind(this); + this.FinalizedBundlesQuery = this.FinalizedBundlesQuery.bind(this); + this.FinalizedBundleQuery = this.FinalizedBundleQuery.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 { + FinalizedBundlesQuery(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))); + const promise = this.rpc.request(this.service, "FinalizedBundlesQuery", data); + return promise.then((data) => QueryFinalizedBundlesResponse.decode(_m0.Reader.create(data))); } - FinalizedBundle(request: QueryFinalizedBundleRequest): Promise { + FinalizedBundleQuery(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))); + const promise = this.rpc.request(this.service, "FinalizedBundleQuery", data); + return promise.then((data) => FinalizedBundle.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryCurrentVoteStatusResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryCanValidateResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryCanProposeResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryCanVoteResponse.decode(_m0.Reader.create(data))); } } @@ -1075,7 +1644,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/query/v1beta1/delegation.ts b/common/types/src/client/kyve/query/v1beta1/delegation.ts index 5c87d5b4..853a9025 100644 --- a/common/types/src/client/kyve/query/v1beta1/delegation.ts +++ b/common/types/src/client/kyve/query/v1beta1/delegation.ts @@ -17,7 +17,7 @@ export interface QueryDelegatorRequest { /** QueryDelegatorResponse is the response type for the Query/Delegator RPC method. */ export interface QueryDelegatorResponse { /** delegator ... */ - delegator?: StakerDelegatorResponse; + delegator?: StakerDelegatorResponse | undefined; } /** StakerDelegatorResponse ... */ @@ -35,7 +35,9 @@ export interface StakerDelegatorResponse { /** QueryDelegatorsByStakerRequest ... */ export interface QueryDelegatorsByStakerRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: + | PageRequest + | undefined; /** staker ... */ staker: string; } @@ -49,13 +51,15 @@ export interface QueryDelegatorsByStakerResponse { /** total_delegation ... */ total_delegator_count: string; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** QueryStakersByDelegatorRequest ... */ export interface QueryStakersByDelegatorRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: + | PageRequest + | undefined; /** delegator ... */ delegator: string; } @@ -67,13 +71,15 @@ export interface QueryStakersByDelegatorResponse { /** stakers ... */ stakers: DelegationForStakerResponse[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** DelegationForStakerResponse ... */ export interface DelegationForStakerResponse { /** staker ... */ - staker?: FullStaker; + staker?: + | FullStaker + | undefined; /** current_reward ... */ current_reward: string; /** delegation_amount ... */ @@ -96,40 +102,56 @@ export const QueryDelegatorRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.delegator = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryDelegatorRequest { return { - staker: isSet(object.staker) ? String(object.staker) : "", - delegator: isSet(object.delegator) ? String(object.delegator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + delegator: isSet(object.delegator) ? globalThis.String(object.delegator) : "", }; }, toJSON(message: QueryDelegatorRequest): unknown { const obj: any = {}; - message.staker !== undefined && (obj.staker = message.staker); - message.delegator !== undefined && (obj.delegator = message.delegator); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.delegator !== "") { + obj.delegator = message.delegator; + } return obj; }, + create, I>>(base?: I): QueryDelegatorRequest { + return QueryDelegatorRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDelegatorRequest { const message = createBaseQueryDelegatorRequest(); message.staker = object.staker ?? ""; @@ -151,19 +173,24 @@ export const QueryDelegatorResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.delegator = StakerDelegatorResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -174,11 +201,15 @@ export const QueryDelegatorResponse = { toJSON(message: QueryDelegatorResponse): unknown { const obj: any = {}; - message.delegator !== undefined && - (obj.delegator = message.delegator ? StakerDelegatorResponse.toJSON(message.delegator) : undefined); + if (message.delegator !== undefined) { + obj.delegator = StakerDelegatorResponse.toJSON(message.delegator); + } return obj; }, + create, I>>(base?: I): QueryDelegatorResponse { + return QueryDelegatorResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDelegatorResponse { const message = createBaseQueryDelegatorResponse(); message.delegator = (object.delegator !== undefined && object.delegator !== null) @@ -210,50 +241,78 @@ export const StakerDelegatorResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): StakerDelegatorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.delegator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.current_reward = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.delegation_amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.staker = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + delegator: isSet(object.delegator) ? globalThis.String(object.delegator) : "", + current_reward: isSet(object.current_reward) ? globalThis.String(object.current_reward) : "0", + delegation_amount: isSet(object.delegation_amount) ? globalThis.String(object.delegation_amount) : "0", + staker: isSet(object.staker) ? globalThis.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); + if (message.delegator !== "") { + obj.delegator = message.delegator; + } + if (message.current_reward !== "0") { + obj.current_reward = message.current_reward; + } + if (message.delegation_amount !== "0") { + obj.delegation_amount = message.delegation_amount; + } + if (message.staker !== "") { + obj.staker = message.staker; + } return obj; }, + create, I>>(base?: I): StakerDelegatorResponse { + return StakerDelegatorResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): StakerDelegatorResponse { const message = createBaseStakerDelegatorResponse(); message.delegator = object.delegator ?? ""; @@ -280,22 +339,31 @@ export const QueryDelegatorsByStakerRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorsByStakerRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -303,18 +371,24 @@ export const QueryDelegatorsByStakerRequest = { fromJSON(object: any): QueryDelegatorsByStakerRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - staker: isSet(object.staker) ? String(object.staker) : "", + staker: isSet(object.staker) ? globalThis.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); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.staker !== "") { + obj.staker = message.staker; + } return obj; }, + create, I>>(base?: I): QueryDelegatorsByStakerRequest { + return QueryDelegatorsByStakerRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryDelegatorsByStakerRequest { @@ -349,57 +423,82 @@ export const QueryDelegatorsByStakerResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorsByStakerResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.delegators.push(StakerDelegatorResponse.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.total_delegation = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.total_delegator_count = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryDelegatorsByStakerResponse { return { - delegators: Array.isArray(object?.delegators) + delegators: globalThis.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", + total_delegation: isSet(object.total_delegation) ? globalThis.String(object.total_delegation) : "0", + total_delegator_count: isSet(object.total_delegator_count) + ? globalThis.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); + if (message.delegators?.length) { + obj.delegators = message.delegators.map((e) => StakerDelegatorResponse.toJSON(e)); + } + if (message.total_delegation !== "0") { + obj.total_delegation = message.total_delegation; + } + if (message.total_delegator_count !== "0") { + obj.total_delegator_count = message.total_delegator_count; + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryDelegatorsByStakerResponse { + return QueryDelegatorsByStakerResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryDelegatorsByStakerResponse { @@ -430,22 +529,31 @@ export const QueryStakersByDelegatorRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByDelegatorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.delegator = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -453,18 +561,24 @@ export const QueryStakersByDelegatorRequest = { fromJSON(object: any): QueryStakersByDelegatorRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - delegator: isSet(object.delegator) ? String(object.delegator) : "", + delegator: isSet(object.delegator) ? globalThis.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); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.delegator !== "") { + obj.delegator = message.delegator; + } return obj; }, + create, I>>(base?: I): QueryStakersByDelegatorRequest { + return QueryStakersByDelegatorRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryStakersByDelegatorRequest { @@ -496,33 +610,46 @@ export const QueryStakersByDelegatorResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByDelegatorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.delegator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.stakers.push(DelegationForStakerResponse.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakersByDelegatorResponse { return { - delegator: isSet(object.delegator) ? String(object.delegator) : "", - stakers: Array.isArray(object?.stakers) + delegator: isSet(object.delegator) ? globalThis.String(object.delegator) : "", + stakers: globalThis.Array.isArray(object?.stakers) ? object.stakers.map((e: any) => DelegationForStakerResponse.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, @@ -531,17 +658,21 @@ export const QueryStakersByDelegatorResponse = { 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); + if (message.delegator !== "") { + obj.delegator = message.delegator; + } + if (message.stakers?.length) { + obj.stakers = message.stakers.map((e) => DelegationForStakerResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryStakersByDelegatorResponse { + return QueryStakersByDelegatorResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryStakersByDelegatorResponse { @@ -574,25 +705,38 @@ export const DelegationForStakerResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegationForStakerResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = FullStaker.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.current_reward = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.delegation_amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -600,19 +744,28 @@ export const DelegationForStakerResponse = { 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", + current_reward: isSet(object.current_reward) ? globalThis.String(object.current_reward) : "0", + delegation_amount: isSet(object.delegation_amount) ? globalThis.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); + if (message.staker !== undefined) { + obj.staker = FullStaker.toJSON(message.staker); + } + if (message.current_reward !== "0") { + obj.current_reward = message.current_reward; + } + if (message.delegation_amount !== "0") { + obj.delegation_amount = message.delegation_amount; + } return obj; }, + create, I>>(base?: I): DelegationForStakerResponse { + return DelegationForStakerResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DelegationForStakerResponse { const message = createBaseDelegationForStakerResponse(); message.staker = (object.staker !== undefined && object.staker !== null) @@ -640,11 +793,12 @@ export interface QueryDelegation { StakersByDelegator(request: QueryStakersByDelegatorRequest): Promise; } +export const QueryDelegationServiceName = "kyve.query.v1beta1.QueryDelegation"; 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.service = opts?.service || QueryDelegationServiceName; this.rpc = rpc; this.Delegator = this.Delegator.bind(this); this.DelegatorsByStaker = this.DelegatorsByStaker.bind(this); @@ -653,19 +807,19 @@ export class QueryDelegationClientImpl implements QueryDelegation { 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))); + return promise.then((data) => QueryDelegatorResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryDelegatorsByStakerResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryStakersByDelegatorResponse.decode(_m0.Reader.create(data))); } } @@ -676,7 +830,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/query/v1beta1/params.ts b/common/types/src/client/kyve/query/v1beta1/params.ts index b163cc6a..d8345941 100644 --- a/common/types/src/client/kyve/query/v1beta1/params.ts +++ b/common/types/src/client/kyve/query/v1beta1/params.ts @@ -16,17 +16,27 @@ export interface QueryParamsRequest { /** QueryParamsResponse ... */ export interface QueryParamsResponse { /** bundles_params ... */ - bundles_params?: Params; + bundles_params?: + | Params + | undefined; /** delegation_params ... */ - delegation_params?: Params1; + delegation_params?: + | Params1 + | undefined; /** global_params ... */ - global_params?: Params2; + global_params?: + | Params2 + | undefined; /** gov_params ... */ - gov_params?: QueryParamsResponse3; + gov_params?: + | QueryParamsResponse3 + | undefined; /** stakers_params ... */ - stakers_params?: Params4; + stakers_params?: + | Params4 + | undefined; /** pool_params ... */ - pool_params?: Params5; + pool_params?: Params5 | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -39,16 +49,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -62,6 +73,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -103,34 +117,59 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.bundles_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.delegation_params = Params1.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.global_params = Params2.decode(reader, reader.uint32()); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.gov_params = QueryParamsResponse3.decode(reader, reader.uint32()); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.stakers_params = Params4.decode(reader, reader.uint32()); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.pool_params = Params5.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -148,21 +187,30 @@ export const QueryParamsResponse = { 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.global_params !== undefined && - (obj.global_params = message.global_params ? Params2.toJSON(message.global_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); - message.pool_params !== undefined && - (obj.pool_params = message.pool_params ? Params5.toJSON(message.pool_params) : undefined); + if (message.bundles_params !== undefined) { + obj.bundles_params = Params.toJSON(message.bundles_params); + } + if (message.delegation_params !== undefined) { + obj.delegation_params = Params1.toJSON(message.delegation_params); + } + if (message.global_params !== undefined) { + obj.global_params = Params2.toJSON(message.global_params); + } + if (message.gov_params !== undefined) { + obj.gov_params = QueryParamsResponse3.toJSON(message.gov_params); + } + if (message.stakers_params !== undefined) { + obj.stakers_params = Params4.toJSON(message.stakers_params); + } + if (message.pool_params !== undefined) { + obj.pool_params = Params5.toJSON(message.pool_params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.bundles_params = (object.bundles_params !== undefined && object.bundles_params !== null) @@ -193,18 +241,19 @@ export interface QueryParams { Params(request: QueryParamsRequest): Promise; } +export const QueryParamsServiceName = "kyve.query.v1beta1.QueryParams"; 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.service = opts?.service || QueryParamsServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -215,7 +264,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/query/v1beta1/pools.ts b/common/types/src/client/kyve/query/v1beta1/pools.ts index 9241e133..41380e78 100644 --- a/common/types/src/client/kyve/query/v1beta1/pools.ts +++ b/common/types/src/client/kyve/query/v1beta1/pools.ts @@ -10,7 +10,9 @@ 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; + pagination?: + | PageRequest + | undefined; /** search ... */ search: string; /** runtime ... */ @@ -26,7 +28,7 @@ export interface QueryPoolsResponse { /** pools ... */ pools: PoolResponse[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** PoolResponse ... */ @@ -34,9 +36,13 @@ export interface PoolResponse { /** id ... */ id: string; /** data ... */ - data?: Pool; + data?: + | Pool + | undefined; /** bundle_proposal ... */ - bundle_proposal?: BundleProposal; + bundle_proposal?: + | BundleProposal + | undefined; /** stakers ... */ stakers: string[]; /** total_stake ... */ @@ -60,7 +66,7 @@ export interface QueryPoolRequest { /** QueryPoolResponse is the response type for the Query/Pool RPC method. */ export interface QueryPoolResponse { /** pool ... */ - pool?: PoolResponse; + pool?: PoolResponse | undefined; } function createBaseQueryPoolsRequest(): QueryPoolsRequest { @@ -88,31 +94,52 @@ export const QueryPoolsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.search = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.runtime = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.disabled = reader.bool(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.storage_provider_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -120,24 +147,36 @@ export const QueryPoolsRequest = { 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) : "", - disabled: isSet(object.disabled) ? Boolean(object.disabled) : false, - storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + search: isSet(object.search) ? globalThis.String(object.search) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + disabled: isSet(object.disabled) ? globalThis.Boolean(object.disabled) : false, + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.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.disabled !== undefined && (obj.disabled = message.disabled); - message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.search !== "") { + obj.search = message.search; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.disabled === true) { + obj.disabled = message.disabled; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } return obj; }, + create, I>>(base?: I): QueryPoolsRequest { + return QueryPoolsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryPoolsRequest { const message = createBaseQueryPoolsRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) @@ -167,45 +206,56 @@ export const QueryPoolsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pools.push(PoolResponse.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryPoolsResponse { return { - pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => PoolResponse.fromJSON(e)) : [], + pools: globalThis.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 = []; + if (message.pools?.length) { + obj.pools = message.pools.map((e) => PoolResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryPoolsResponse { + return QueryPoolsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryPoolsResponse { const message = createBaseQueryPoolsResponse(); message.pools = object.pools?.map((e) => PoolResponse.fromPartial(e)) || []; @@ -263,80 +313,135 @@ export const PoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): PoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.data = Pool.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.bundle_proposal = BundleProposal.decode(reader, reader.uint32()); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.stakers.push(reader.string()); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.total_self_delegation = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.total_delegation = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.status = reader.int32() as any; - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.account = reader.string(); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.account_balance = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): PoolResponse { return { - id: isSet(object.id) ? String(object.id) : "0", + id: isSet(object.id) ? globalThis.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", + stakers: globalThis.Array.isArray(object?.stakers) ? object.stakers.map((e: any) => globalThis.String(e)) : [], + total_self_delegation: isSet(object.total_self_delegation) + ? globalThis.String(object.total_self_delegation) + : "0", + total_delegation: isSet(object.total_delegation) ? globalThis.String(object.total_delegation) : "0", status: isSet(object.status) ? poolStatusFromJSON(object.status) : 0, - account: isSet(object.account) ? String(object.account) : "", - account_balance: isSet(object.account_balance) ? String(object.account_balance) : "0", + account: isSet(object.account) ? globalThis.String(object.account) : "", + account_balance: isSet(object.account_balance) ? globalThis.String(object.account_balance) : "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)); - message.account !== undefined && (obj.account = message.account); - message.account_balance !== undefined && (obj.account_balance = message.account_balance); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.data !== undefined) { + obj.data = Pool.toJSON(message.data); + } + if (message.bundle_proposal !== undefined) { + obj.bundle_proposal = BundleProposal.toJSON(message.bundle_proposal); + } + if (message.stakers?.length) { + obj.stakers = message.stakers; + } + if (message.total_self_delegation !== "0") { + obj.total_self_delegation = message.total_self_delegation; + } + if (message.total_delegation !== "0") { + obj.total_delegation = message.total_delegation; + } + if (message.status !== 0) { + obj.status = poolStatusToJSON(message.status); + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.account_balance !== "0") { + obj.account_balance = message.account_balance; + } return obj; }, + create, I>>(base?: I): PoolResponse { + return PoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): PoolResponse { const message = createBasePoolResponse(); message.id = object.id ?? "0"; @@ -367,33 +472,43 @@ export const QueryPoolRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryPoolRequest { - return { id: isSet(object.id) ? String(object.id) : "0" }; + return { id: isSet(object.id) ? globalThis.String(object.id) : "0" }; }, toJSON(message: QueryPoolRequest): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): QueryPoolRequest { + return QueryPoolRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryPoolRequest { const message = createBaseQueryPoolRequest(); message.id = object.id ?? "0"; @@ -414,19 +529,24 @@ export const QueryPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pool = PoolResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -437,10 +557,15 @@ export const QueryPoolResponse = { toJSON(message: QueryPoolResponse): unknown { const obj: any = {}; - message.pool !== undefined && (obj.pool = message.pool ? PoolResponse.toJSON(message.pool) : undefined); + if (message.pool !== undefined) { + obj.pool = PoolResponse.toJSON(message.pool); + } return obj; }, + create, I>>(base?: I): QueryPoolResponse { + return QueryPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryPoolResponse { const message = createBaseQueryPoolResponse(); message.pool = (object.pool !== undefined && object.pool !== null) @@ -458,11 +583,12 @@ export interface QueryPool { Pool(request: QueryPoolRequest): Promise; } +export const QueryPoolServiceName = "kyve.query.v1beta1.QueryPool"; 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.service = opts?.service || QueryPoolServiceName; this.rpc = rpc; this.Pools = this.Pools.bind(this); this.Pool = this.Pool.bind(this); @@ -470,13 +596,13 @@ export class QueryPoolClientImpl implements QueryPool { 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))); + return promise.then((data) => QueryPoolsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryPoolResponse.decode(_m0.Reader.create(data))); } } @@ -487,7 +613,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/query/v1beta1/query.ts b/common/types/src/client/kyve/query/v1beta1/query.ts index 4886234c..7e61e6ac 100644 --- a/common/types/src/client/kyve/query/v1beta1/query.ts +++ b/common/types/src/client/kyve/query/v1beta1/query.ts @@ -48,7 +48,9 @@ export interface FullStaker { /** address of the staker */ address: string; /** metadata as logo, moniker, etc. */ - metadata?: StakerMetadata; + metadata?: + | StakerMetadata + | undefined; /** amount the staker has delegated to himself */ self_delegation: string; /** @@ -105,7 +107,9 @@ export interface StakerMetadata { * the commission is applied. Users have time to redelegate * if they not agree with the new commission. */ - pending_commission_change?: CommissionChangeEntry; + pending_commission_change?: + | CommissionChangeEntry + | undefined; /** commission_rewards are the rewards in $KYVE earned through commission */ commission_rewards: string; } @@ -133,7 +137,9 @@ export interface CommissionChangeEntry { */ export interface PoolMembership { /** pool contains useful information about the pool */ - pool?: BasicPool; + pool?: + | BasicPool + | undefined; /** * points indicates if the staker is inactive * If the staker misses a vote, a point is added. @@ -208,75 +214,133 @@ export const BasicPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): BasicPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.name = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.runtime = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.logo = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.operating_cost = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.upload_interval = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.total_funds = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.total_delegation = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.status = reader.int32() as any; - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + name: isSet(object.name) ? globalThis.String(object.name) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + logo: isSet(object.logo) ? globalThis.String(object.logo) : "", + operating_cost: isSet(object.operating_cost) ? globalThis.String(object.operating_cost) : "0", + upload_interval: isSet(object.upload_interval) ? globalThis.String(object.upload_interval) : "0", + total_funds: isSet(object.total_funds) ? globalThis.String(object.total_funds) : "0", + total_delegation: isSet(object.total_delegation) ? globalThis.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)); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.logo !== "") { + obj.logo = message.logo; + } + if (message.operating_cost !== "0") { + obj.operating_cost = message.operating_cost; + } + if (message.upload_interval !== "0") { + obj.upload_interval = message.upload_interval; + } + if (message.total_funds !== "0") { + obj.total_funds = message.total_funds; + } + if (message.total_delegation !== "0") { + obj.total_delegation = message.total_delegation; + } + if (message.status !== 0) { + obj.status = poolStatusToJSON(message.status); + } return obj; }, + create, I>>(base?: I): BasicPool { + return BasicPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): BasicPool { const message = createBaseBasicPool(); message.id = object.id ?? "0"; @@ -331,73 +395,113 @@ export const FullStaker = { }, decode(input: _m0.Reader | Uint8Array, length?: number): FullStaker { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.metadata = StakerMetadata.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.self_delegation = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.self_delegation_unbonding = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.total_delegation = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.delegator_count = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.pools.push(PoolMembership.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): FullStaker { return { - address: isSet(object.address) ? String(object.address) : "", + address: isSet(object.address) ? globalThis.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: isSet(object.self_delegation) ? globalThis.String(object.self_delegation) : "0", self_delegation_unbonding: isSet(object.self_delegation_unbonding) - ? String(object.self_delegation_unbonding) + ? globalThis.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)) : [], + total_delegation: isSet(object.total_delegation) ? globalThis.String(object.total_delegation) : "0", + delegator_count: isSet(object.delegator_count) ? globalThis.String(object.delegator_count) : "0", + pools: globalThis.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 = []; + if (message.address !== "") { + obj.address = message.address; + } + if (message.metadata !== undefined) { + obj.metadata = StakerMetadata.toJSON(message.metadata); + } + if (message.self_delegation !== "0") { + obj.self_delegation = message.self_delegation; + } + if (message.self_delegation_unbonding !== "0") { + obj.self_delegation_unbonding = message.self_delegation_unbonding; + } + if (message.total_delegation !== "0") { + obj.total_delegation = message.total_delegation; + } + if (message.delegator_count !== "0") { + obj.delegator_count = message.delegator_count; + } + if (message.pools?.length) { + obj.pools = message.pools.map((e) => PoolMembership.toJSON(e)); } return obj; }, + create, I>>(base?: I): FullStaker { + return FullStaker.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): FullStaker { const message = createBaseFullStaker(); message.address = object.address ?? ""; @@ -456,75 +560,124 @@ export const StakerMetadata = { }, decode(input: _m0.Reader | Uint8Array, length?: number): StakerMetadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.commission = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.moniker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.website = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.identity = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.security_contact = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.details = reader.string(); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.pending_commission_change = CommissionChangeEntry.decode(reader, reader.uint32()); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.commission_rewards = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", - identity: isSet(object.identity) ? String(object.identity) : "", - security_contact: isSet(object.security_contact) ? String(object.security_contact) : "", - details: isSet(object.details) ? String(object.details) : "", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + security_contact: isSet(object.security_contact) ? globalThis.String(object.security_contact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", pending_commission_change: isSet(object.pending_commission_change) ? CommissionChangeEntry.fromJSON(object.pending_commission_change) : undefined, - commission_rewards: isSet(object.commission_rewards) ? String(object.commission_rewards) : "0", + commission_rewards: isSet(object.commission_rewards) ? globalThis.String(object.commission_rewards) : "0", }; }, 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.identity !== undefined && (obj.identity = message.identity); - message.security_contact !== undefined && (obj.security_contact = message.security_contact); - message.details !== undefined && (obj.details = message.details); - message.pending_commission_change !== undefined && - (obj.pending_commission_change = message.pending_commission_change - ? CommissionChangeEntry.toJSON(message.pending_commission_change) - : undefined); - message.commission_rewards !== undefined && (obj.commission_rewards = message.commission_rewards); + if (message.commission !== "") { + obj.commission = message.commission; + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.security_contact !== "") { + obj.security_contact = message.security_contact; + } + if (message.details !== "") { + obj.details = message.details; + } + if (message.pending_commission_change !== undefined) { + obj.pending_commission_change = CommissionChangeEntry.toJSON(message.pending_commission_change); + } + if (message.commission_rewards !== "0") { + obj.commission_rewards = message.commission_rewards; + } return obj; }, + create, I>>(base?: I): StakerMetadata { + return StakerMetadata.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): StakerMetadata { const message = createBaseStakerMetadata(); message.commission = object.commission ?? ""; @@ -558,40 +711,56 @@ export const CommissionChangeEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.commission = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.creation_date = longToString(reader.int64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", + creation_date: isSet(object.creation_date) ? globalThis.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); + if (message.commission !== "") { + obj.commission = message.commission; + } + if (message.creation_date !== "0") { + obj.creation_date = message.creation_date; + } return obj; }, + create, I>>(base?: I): CommissionChangeEntry { + return CommissionChangeEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): CommissionChangeEntry { const message = createBaseCommissionChangeEntry(); message.commission = object.commission ?? ""; @@ -625,31 +794,52 @@ export const PoolMembership = { }, decode(input: _m0.Reader | Uint8Array, length?: number): PoolMembership { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pool = BasicPool.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.points = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.is_leaving = reader.bool(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.valaddress = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.balance = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -657,23 +847,36 @@ export const PoolMembership = { 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", + points: isSet(object.points) ? globalThis.String(object.points) : "0", + is_leaving: isSet(object.is_leaving) ? globalThis.Boolean(object.is_leaving) : false, + valaddress: isSet(object.valaddress) ? globalThis.String(object.valaddress) : "", + balance: isSet(object.balance) ? globalThis.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); + if (message.pool !== undefined) { + obj.pool = BasicPool.toJSON(message.pool); + } + if (message.points !== "0") { + obj.points = message.points; + } + if (message.is_leaving === true) { + obj.is_leaving = message.is_leaving; + } + if (message.valaddress !== "") { + obj.valaddress = message.valaddress; + } + if (message.balance !== "0") { + obj.balance = message.balance; + } return obj; }, + create, I>>(base?: I): PoolMembership { + return PoolMembership.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): PoolMembership { const message = createBasePoolMembership(); message.pool = (object.pool !== undefined && object.pool !== null) ? BasicPool.fromPartial(object.pool) : undefined; @@ -688,7 +891,8 @@ export const PoolMembership = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/query/v1beta1/stakers.ts b/common/types/src/client/kyve/query/v1beta1/stakers.ts index 3266f228..658d5969 100644 --- a/common/types/src/client/kyve/query/v1beta1/stakers.ts +++ b/common/types/src/client/kyve/query/v1beta1/stakers.ts @@ -53,7 +53,9 @@ export function stakerStatusToJSON(object: StakerStatus): string { /** QueryStakersRequest is the request type for the Query/Stakers RPC method. */ export interface QueryStakersRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: + | PageRequest + | undefined; /** status looks whether a staker is participating in pools or not */ status: StakerStatus; /** search searches for moniker OR address */ @@ -65,7 +67,7 @@ export interface QueryStakersResponse { /** stakers ... */ stakers: FullStaker[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** QueryStakerRequest is the request type for the Query/Staker RPC method. */ @@ -77,7 +79,7 @@ export interface QueryStakerRequest { /** QueryStakerResponse is the response type for the Query/Staker RPC method. */ export interface QueryStakerResponse { /** staker ... */ - staker?: FullStaker; + staker?: FullStaker | undefined; } /** QueryStakersByPoolRequest is the request type for the Query/Staker RPC method. */ @@ -95,15 +97,17 @@ export interface QueryStakersByPoolResponse { /** StakerPoolResponse ... */ export interface StakerPoolResponse { /** staker ... */ - staker?: FullStaker; + staker?: + | FullStaker + | undefined; /** valaccount ... */ - valaccount?: Valaccount; + valaccount?: Valaccount | undefined; } /** QueryStakersByPoolCountRequest ... */ export interface QueryStakersByPoolCountRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: PageRequest | undefined; } /** QueryStakersByPoolCountResponse ... */ @@ -111,7 +115,7 @@ export interface QueryStakersByPoolCountResponse { /** stakers ... */ stakers: FullStaker[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } function createBaseQueryStakersRequest(): QueryStakersRequest { @@ -133,25 +137,38 @@ export const QueryStakersRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.status = reader.int32() as any; - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.search = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -160,19 +177,27 @@ export const 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) : "", + search: isSet(object.search) ? globalThis.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); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.status !== 0) { + obj.status = stakerStatusToJSON(message.status); + } + if (message.search !== "") { + obj.search = message.search; + } return obj; }, + create, I>>(base?: I): QueryStakersRequest { + return QueryStakersRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakersRequest { const message = createBaseQueryStakersRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) @@ -200,45 +225,56 @@ export const QueryStakersResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.stakers.push(FullStaker.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakersResponse { return { - stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => FullStaker.fromJSON(e)) : [], + stakers: globalThis.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 = []; + if (message.stakers?.length) { + obj.stakers = message.stakers.map((e) => FullStaker.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryStakersResponse { + return QueryStakersResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakersResponse { const message = createBaseQueryStakersResponse(); message.stakers = object.stakers?.map((e) => FullStaker.fromPartial(e)) || []; @@ -262,33 +298,43 @@ export const QueryStakerRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakerRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakerRequest { - return { address: isSet(object.address) ? String(object.address) : "" }; + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, toJSON(message: QueryStakerRequest): unknown { const obj: any = {}; - message.address !== undefined && (obj.address = message.address); + if (message.address !== "") { + obj.address = message.address; + } return obj; }, + create, I>>(base?: I): QueryStakerRequest { + return QueryStakerRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakerRequest { const message = createBaseQueryStakerRequest(); message.address = object.address ?? ""; @@ -309,19 +355,24 @@ export const QueryStakerResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakerResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = FullStaker.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -332,10 +383,15 @@ export const QueryStakerResponse = { toJSON(message: QueryStakerResponse): unknown { const obj: any = {}; - message.staker !== undefined && (obj.staker = message.staker ? FullStaker.toJSON(message.staker) : undefined); + if (message.staker !== undefined) { + obj.staker = FullStaker.toJSON(message.staker); + } return obj; }, + create, I>>(base?: I): QueryStakerResponse { + return QueryStakerResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakerResponse { const message = createBaseQueryStakerResponse(); message.staker = (object.staker !== undefined && object.staker !== null) @@ -358,33 +414,43 @@ export const QueryStakersByPoolRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakersByPoolRequest { - return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + return { pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0" }; }, toJSON(message: QueryStakersByPoolRequest): unknown { const obj: any = {}; - message.pool_id !== undefined && (obj.pool_id = message.pool_id); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } return obj; }, + create, I>>(base?: I): QueryStakersByPoolRequest { + return QueryStakersByPoolRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakersByPoolRequest { const message = createBaseQueryStakersByPoolRequest(); message.pool_id = object.pool_id ?? "0"; @@ -405,39 +471,47 @@ export const QueryStakersByPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.stakers.push(StakerPoolResponse.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakersByPoolResponse { return { - stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => StakerPoolResponse.fromJSON(e)) : [], + stakers: globalThis.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 = []; + if (message.stakers?.length) { + obj.stakers = message.stakers.map((e) => StakerPoolResponse.toJSON(e)); } return obj; }, + create, I>>(base?: I): QueryStakersByPoolResponse { + return QueryStakersByPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakersByPoolResponse { const message = createBaseQueryStakersByPoolResponse(); message.stakers = object.stakers?.map((e) => StakerPoolResponse.fromPartial(e)) || []; @@ -461,22 +535,31 @@ export const StakerPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): StakerPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = FullStaker.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.valaccount = Valaccount.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -490,12 +573,18 @@ export const StakerPoolResponse = { 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); + if (message.staker !== undefined) { + obj.staker = FullStaker.toJSON(message.staker); + } + if (message.valaccount !== undefined) { + obj.valaccount = Valaccount.toJSON(message.valaccount); + } return obj; }, + create, I>>(base?: I): StakerPoolResponse { + return StakerPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): StakerPoolResponse { const message = createBaseStakerPoolResponse(); message.staker = (object.staker !== undefined && object.staker !== null) @@ -521,19 +610,24 @@ export const QueryStakersByPoolCountRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolCountRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -544,11 +638,15 @@ export const QueryStakersByPoolCountRequest = { toJSON(message: QueryStakersByPoolCountRequest): unknown { const obj: any = {}; - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryStakersByPoolCountRequest { + return QueryStakersByPoolCountRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryStakersByPoolCountRequest { @@ -576,45 +674,56 @@ export const QueryStakersByPoolCountResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolCountResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.stakers.push(FullStaker.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakersByPoolCountResponse { return { - stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => FullStaker.fromJSON(e)) : [], + stakers: globalThis.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 = []; + if (message.stakers?.length) { + obj.stakers = message.stakers.map((e) => FullStaker.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryStakersByPoolCountResponse { + return QueryStakersByPoolCountResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryStakersByPoolCountResponse { @@ -642,11 +751,12 @@ export interface QueryStakers { StakersByPoolCount(request: QueryStakersByPoolCountRequest): Promise; } +export const QueryStakersServiceName = "kyve.query.v1beta1.QueryStakers"; 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.service = opts?.service || QueryStakersServiceName; this.rpc = rpc; this.Stakers = this.Stakers.bind(this); this.Staker = this.Staker.bind(this); @@ -656,25 +766,25 @@ export class QueryStakersClientImpl implements QueryStakers { 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))); + return promise.then((data) => QueryStakersResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryStakerResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryStakersByPoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryStakersByPoolCountResponse.decode(_m0.Reader.create(data))); } } @@ -685,7 +795,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/stakers/v1beta1/events.ts b/common/types/src/client/kyve/stakers/v1beta1/events.ts index 4ab8cfda..71eed8b1 100644 --- a/common/types/src/client/kyve/stakers/v1beta1/events.ts +++ b/common/types/src/client/kyve/stakers/v1beta1/events.ts @@ -11,9 +11,13 @@ export const protobufPackage = "kyve.stakers.v1beta1"; */ export interface EventUpdateParams { /** old_params is the module's old parameters. */ - old_params?: Params; + old_params?: + | Params + | undefined; /** new_params is the module's new parameters. */ - new_params?: Params; + new_params?: + | Params + | undefined; /** payload is the parameter updates that were performed. */ payload: string; } @@ -120,25 +124,38 @@ export const EventUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.old_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.new_params = Params.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -147,20 +164,27 @@ export const EventUpdateParams = { return { old_params: isSet(object.old_params) ? Params.fromJSON(object.old_params) : undefined, new_params: isSet(object.new_params) ? Params.fromJSON(object.new_params) : undefined, - payload: isSet(object.payload) ? String(object.payload) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: EventUpdateParams): unknown { const obj: any = {}; - message.old_params !== undefined && - (obj.old_params = message.old_params ? Params.toJSON(message.old_params) : undefined); - message.new_params !== undefined && - (obj.new_params = message.new_params ? Params.toJSON(message.new_params) : undefined); - message.payload !== undefined && (obj.payload = message.payload); + if (message.old_params !== undefined) { + obj.old_params = Params.toJSON(message.old_params); + } + if (message.new_params !== undefined) { + obj.new_params = Params.toJSON(message.new_params); + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): EventUpdateParams { + return EventUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateParams { const message = createBaseEventUpdateParams(); message.old_params = (object.old_params !== undefined && object.old_params !== null) @@ -193,45 +217,67 @@ export const EventCreateStaker = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateStaker { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.commission = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventCreateStaker { return { - staker: isSet(object.staker) ? String(object.staker) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", - commission: isSet(object.commission) ? String(object.commission) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", }; }, toJSON(message: EventCreateStaker): unknown { const obj: any = {}; - message.staker !== undefined && (obj.staker = message.staker); - message.amount !== undefined && (obj.amount = message.amount); - message.commission !== undefined && (obj.commission = message.commission); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.commission !== "") { + obj.commission = message.commission; + } return obj; }, + create, I>>(base?: I): EventCreateStaker { + return EventCreateStaker.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventCreateStaker { const message = createBaseEventCreateStaker(); message.staker = object.staker ?? ""; @@ -269,60 +315,100 @@ export const EventUpdateMetadata = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateMetadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.moniker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.website = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.identity = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.security_contact = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.details = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", - identity: isSet(object.identity) ? String(object.identity) : "", - security_contact: isSet(object.security_contact) ? String(object.security_contact) : "", - details: isSet(object.details) ? String(object.details) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + security_contact: isSet(object.security_contact) ? globalThis.String(object.security_contact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", }; }, 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.identity !== undefined && (obj.identity = message.identity); - message.security_contact !== undefined && (obj.security_contact = message.security_contact); - message.details !== undefined && (obj.details = message.details); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.security_contact !== "") { + obj.security_contact = message.security_contact; + } + if (message.details !== "") { + obj.details = message.details; + } return obj; }, + create, I>>(base?: I): EventUpdateMetadata { + return EventUpdateMetadata.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateMetadata { const message = createBaseEventUpdateMetadata(); message.staker = object.staker ?? ""; @@ -351,40 +437,56 @@ export const EventUpdateCommission = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateCommission { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.commission = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventUpdateCommission { return { - staker: isSet(object.staker) ? String(object.staker) : "", - commission: isSet(object.commission) ? String(object.commission) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", }; }, toJSON(message: EventUpdateCommission): unknown { const obj: any = {}; - message.staker !== undefined && (obj.staker = message.staker); - message.commission !== undefined && (obj.commission = message.commission); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.commission !== "") { + obj.commission = message.commission; + } return obj; }, + create, I>>(base?: I): EventUpdateCommission { + return EventUpdateCommission.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateCommission { const message = createBaseEventUpdateCommission(); message.staker = object.staker ?? ""; @@ -409,40 +511,56 @@ export const EventClaimCommissionRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimCommissionRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventClaimCommissionRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventClaimCommissionRewards { return { - staker: isSet(object.staker) ? String(object.staker) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", }; }, toJSON(message: EventClaimCommissionRewards): unknown { const obj: any = {}; - message.staker !== undefined && (obj.staker = message.staker); - message.amount !== undefined && (obj.amount = message.amount); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventClaimCommissionRewards { + return EventClaimCommissionRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClaimCommissionRewards { const message = createBaseEventClaimCommissionRewards(); message.staker = object.staker ?? ""; @@ -473,50 +591,78 @@ export const EventJoinPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventJoinPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.valaddress = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + valaddress: isSet(object.valaddress) ? globalThis.String(object.valaddress) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.valaddress !== "") { + obj.valaddress = message.valaddress; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventJoinPool { + return EventJoinPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventJoinPool { const message = createBaseEventJoinPool(); message.pool_id = object.pool_id ?? "0"; @@ -543,40 +689,56 @@ export const EventLeavePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventLeavePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } return obj; }, + create, I>>(base?: I): EventLeavePool { + return EventLeavePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventLeavePool { const message = createBaseEventLeavePool(); message.pool_id = object.pool_id ?? "0"; @@ -588,7 +750,8 @@ export const EventLeavePool = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/stakers/v1beta1/genesis.ts b/common/types/src/client/kyve/stakers/v1beta1/genesis.ts index 792284ab..43c09bab 100644 --- a/common/types/src/client/kyve/stakers/v1beta1/genesis.ts +++ b/common/types/src/client/kyve/stakers/v1beta1/genesis.ts @@ -8,7 +8,9 @@ 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; + params?: + | Params + | undefined; /** staker_list ... */ staker_list: Staker[]; /** valaccount_list ... */ @@ -16,11 +18,13 @@ export interface GenesisState { /** commission_change_entries ... */ commission_change_entries: CommissionChangeEntry[]; /** queue_state_commission ... */ - queue_state_commission?: QueueState; + queue_state_commission?: + | QueueState + | undefined; /** leave_pool_entries ... */ leave_pool_entries: LeavePoolEntry[]; /** queue_state_leave ... */ - queue_state_leave?: QueueState; + queue_state_leave?: QueueState | undefined; } function createBaseGenesisState(): GenesisState { @@ -62,37 +66,66 @@ export const GenesisState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker_list.push(Staker.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.valaccount_list.push(Valaccount.decode(reader, reader.uint32())); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.commission_change_entries.push(CommissionChangeEntry.decode(reader, reader.uint32())); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.queue_state_commission = QueueState.decode(reader, reader.uint32()); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.leave_pool_entries.push(LeavePoolEntry.decode(reader, reader.uint32())); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.queue_state_leave = QueueState.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -100,17 +133,19 @@ export const GenesisState = { 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) + staker_list: globalThis.Array.isArray(object?.staker_list) + ? object.staker_list.map((e: any) => Staker.fromJSON(e)) + : [], + valaccount_list: globalThis.Array.isArray(object?.valaccount_list) ? object.valaccount_list.map((e: any) => Valaccount.fromJSON(e)) : [], - commission_change_entries: Array.isArray(object?.commission_change_entries) + commission_change_entries: globalThis.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) + leave_pool_entries: globalThis.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, @@ -119,37 +154,33 @@ export const GenesisState = { 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.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.staker_list?.length) { + obj.staker_list = message.staker_list.map((e) => Staker.toJSON(e)); + } + if (message.valaccount_list?.length) { + obj.valaccount_list = message.valaccount_list.map((e) => Valaccount.toJSON(e)); } - 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?.length) { + obj.commission_change_entries = message.commission_change_entries.map((e) => CommissionChangeEntry.toJSON(e)); } - 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 = []; + if (message.queue_state_commission !== undefined) { + obj.queue_state_commission = QueueState.toJSON(message.queue_state_commission); + } + if (message.leave_pool_entries?.length) { + obj.leave_pool_entries = message.leave_pool_entries.map((e) => LeavePoolEntry.toJSON(e)); } - 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 = []; + if (message.queue_state_leave !== undefined) { + obj.queue_state_leave = QueueState.toJSON(message.queue_state_leave); } - message.queue_state_leave !== undefined && - (obj.queue_state_leave = message.queue_state_leave ? QueueState.toJSON(message.queue_state_leave) : undefined); return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) @@ -174,7 +205,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/stakers/v1beta1/params.ts b/common/types/src/client/kyve/stakers/v1beta1/params.ts index a7917aaa..fdd4bcdc 100644 --- a/common/types/src/client/kyve/stakers/v1beta1/params.ts +++ b/common/types/src/client/kyve/stakers/v1beta1/params.ts @@ -28,40 +28,58 @@ export const Params = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.commission_change_time = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.leave_pool_time = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + commission_change_time: isSet(object.commission_change_time) + ? globalThis.String(object.commission_change_time) + : "0", + leave_pool_time: isSet(object.leave_pool_time) ? globalThis.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); + if (message.commission_change_time !== "0") { + obj.commission_change_time = message.commission_change_time; + } + if (message.leave_pool_time !== "0") { + obj.leave_pool_time = message.leave_pool_time; + } return obj; }, + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Params { const message = createBaseParams(); message.commission_change_time = object.commission_change_time ?? "0"; @@ -73,7 +91,8 @@ export const Params = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/stakers/v1beta1/query.ts b/common/types/src/client/kyve/stakers/v1beta1/query.ts index cea644b1..99186d74 100644 --- a/common/types/src/client/kyve/stakers/v1beta1/query.ts +++ b/common/types/src/client/kyve/stakers/v1beta1/query.ts @@ -11,7 +11,7 @@ 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; + params?: Params | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -24,16 +24,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -47,6 +48,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -66,19 +70,24 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -89,10 +98,15 @@ export const QueryParamsResponse = { toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) @@ -108,18 +122,19 @@ export interface Query { Params(request: QueryParamsRequest): Promise; } +export const QueryServiceName = "kyve.stakers.v1beta1.Query"; 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.service = opts?.service || QueryServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -130,7 +145,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/stakers/v1beta1/stakers.ts b/common/types/src/client/kyve/stakers/v1beta1/stakers.ts index 0ea61915..2ea1decc 100644 --- a/common/types/src/client/kyve/stakers/v1beta1/stakers.ts +++ b/common/types/src/client/kyve/stakers/v1beta1/stakers.ts @@ -162,70 +162,122 @@ export const Staker = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Staker { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.commission = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.moniker = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.website = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.identity = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.security_contact = reader.string(); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.details = reader.string(); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.commission_rewards = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", - identity: isSet(object.identity) ? String(object.identity) : "", - security_contact: isSet(object.security_contact) ? String(object.security_contact) : "", - details: isSet(object.details) ? String(object.details) : "", - commission_rewards: isSet(object.commission_rewards) ? String(object.commission_rewards) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + security_contact: isSet(object.security_contact) ? globalThis.String(object.security_contact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", + commission_rewards: isSet(object.commission_rewards) ? globalThis.String(object.commission_rewards) : "0", }; }, 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.identity !== undefined && (obj.identity = message.identity); - message.security_contact !== undefined && (obj.security_contact = message.security_contact); - message.details !== undefined && (obj.details = message.details); - message.commission_rewards !== undefined && (obj.commission_rewards = message.commission_rewards); + if (message.address !== "") { + obj.address = message.address; + } + if (message.commission !== "") { + obj.commission = message.commission; + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.security_contact !== "") { + obj.security_contact = message.security_contact; + } + if (message.details !== "") { + obj.details = message.details; + } + if (message.commission_rewards !== "0") { + obj.commission_rewards = message.commission_rewards; + } return obj; }, + create, I>>(base?: I): Staker { + return Staker.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Staker { const message = createBaseStaker(); message.address = object.address ?? ""; @@ -265,55 +317,89 @@ export const Valaccount = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Valaccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.valaddress = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.points = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.is_leaving = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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, + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + valaddress: isSet(object.valaddress) ? globalThis.String(object.valaddress) : "", + points: isSet(object.points) ? globalThis.String(object.points) : "0", + is_leaving: isSet(object.is_leaving) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.valaddress !== "") { + obj.valaddress = message.valaddress; + } + if (message.points !== "0") { + obj.points = message.points; + } + if (message.is_leaving === true) { + obj.is_leaving = message.is_leaving; + } return obj; }, + create, I>>(base?: I): Valaccount { + return Valaccount.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Valaccount { const message = createBaseValaccount(); message.pool_id = object.pool_id ?? "0"; @@ -347,50 +433,78 @@ export const CommissionChangeEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.index = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.commission = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.creation_date = longToString(reader.int64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + index: isSet(object.index) ? globalThis.String(object.index) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", + creation_date: isSet(object.creation_date) ? globalThis.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); + if (message.index !== "0") { + obj.index = message.index; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.commission !== "") { + obj.commission = message.commission; + } + if (message.creation_date !== "0") { + obj.creation_date = message.creation_date; + } return obj; }, + create, I>>(base?: I): CommissionChangeEntry { + return CommissionChangeEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): CommissionChangeEntry { const message = createBaseCommissionChangeEntry(); message.index = object.index ?? "0"; @@ -423,50 +537,78 @@ export const LeavePoolEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): LeavePoolEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.index = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.creation_date = longToString(reader.int64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + index: isSet(object.index) ? globalThis.String(object.index) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + creation_date: isSet(object.creation_date) ? globalThis.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); + if (message.index !== "0") { + obj.index = message.index; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.creation_date !== "0") { + obj.creation_date = message.creation_date; + } return obj; }, + create, I>>(base?: I): LeavePoolEntry { + return LeavePoolEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): LeavePoolEntry { const message = createBaseLeavePoolEntry(); message.index = object.index ?? "0"; @@ -493,40 +635,56 @@ export const QueueState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueueState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.low_index = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.high_index = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + low_index: isSet(object.low_index) ? globalThis.String(object.low_index) : "0", + high_index: isSet(object.high_index) ? globalThis.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); + if (message.low_index !== "0") { + obj.low_index = message.low_index; + } + if (message.high_index !== "0") { + obj.high_index = message.high_index; + } return obj; }, + create, I>>(base?: I): QueueState { + return QueueState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueueState { const message = createBaseQueueState(); message.low_index = object.low_index ?? "0"; @@ -538,7 +696,8 @@ export const QueueState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/stakers/v1beta1/tx.ts b/common/types/src/client/kyve/stakers/v1beta1/tx.ts index 7321b97a..c5e641ad 100644 --- a/common/types/src/client/kyve/stakers/v1beta1/tx.ts +++ b/common/types/src/client/kyve/stakers/v1beta1/tx.ts @@ -124,45 +124,67 @@ export const MsgCreateStaker = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateStaker { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.commission = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgCreateStaker { return { - creator: isSet(object.creator) ? String(object.creator) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", - commission: isSet(object.commission) ? String(object.commission) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", }; }, toJSON(message: MsgCreateStaker): unknown { const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.amount !== undefined && (obj.amount = message.amount); - message.commission !== undefined && (obj.commission = message.commission); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.commission !== "") { + obj.commission = message.commission; + } return obj; }, + create, I>>(base?: I): MsgCreateStaker { + return MsgCreateStaker.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgCreateStaker { const message = createBaseMsgCreateStaker(); message.creator = object.creator ?? ""; @@ -182,16 +204,17 @@ export const MsgCreateStakerResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateStakerResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -205,6 +228,9 @@ export const MsgCreateStakerResponse = { return obj; }, + create, I>>(base?: I): MsgCreateStakerResponse { + return MsgCreateStakerResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgCreateStakerResponse { const message = createBaseMsgCreateStakerResponse(); return message; @@ -239,60 +265,100 @@ export const MsgUpdateMetadata = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateMetadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.moniker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.website = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.identity = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.security_contact = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.details = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", - identity: isSet(object.identity) ? String(object.identity) : "", - security_contact: isSet(object.security_contact) ? String(object.security_contact) : "", - details: isSet(object.details) ? String(object.details) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + security_contact: isSet(object.security_contact) ? globalThis.String(object.security_contact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", }; }, 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.identity !== undefined && (obj.identity = message.identity); - message.security_contact !== undefined && (obj.security_contact = message.security_contact); - message.details !== undefined && (obj.details = message.details); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.security_contact !== "") { + obj.security_contact = message.security_contact; + } + if (message.details !== "") { + obj.details = message.details; + } return obj; }, + create, I>>(base?: I): MsgUpdateMetadata { + return MsgUpdateMetadata.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateMetadata { const message = createBaseMsgUpdateMetadata(); message.creator = object.creator ?? ""; @@ -315,16 +381,17 @@ export const MsgUpdateMetadataResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateMetadataResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -338,6 +405,9 @@ export const MsgUpdateMetadataResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateMetadataResponse { + return MsgUpdateMetadataResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateMetadataResponse { const message = createBaseMsgUpdateMetadataResponse(); return message; @@ -360,40 +430,56 @@ export const MsgUpdateCommission = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateCommission { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.commission = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateCommission { return { - creator: isSet(object.creator) ? String(object.creator) : "", - commission: isSet(object.commission) ? String(object.commission) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", }; }, toJSON(message: MsgUpdateCommission): unknown { const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.commission !== undefined && (obj.commission = message.commission); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.commission !== "") { + obj.commission = message.commission; + } return obj; }, + create, I>>(base?: I): MsgUpdateCommission { + return MsgUpdateCommission.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateCommission { const message = createBaseMsgUpdateCommission(); message.creator = object.creator ?? ""; @@ -412,16 +498,17 @@ export const MsgUpdateCommissionResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateCommissionResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -435,6 +522,9 @@ export const MsgUpdateCommissionResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateCommissionResponse { + return MsgUpdateCommissionResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateCommissionResponse { const message = createBaseMsgUpdateCommissionResponse(); return message; @@ -457,40 +547,56 @@ export const MsgClaimCommissionRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimCommissionRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimCommissionRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgClaimCommissionRewards { return { - creator: isSet(object.creator) ? String(object.creator) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", }; }, toJSON(message: MsgClaimCommissionRewards): unknown { const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.amount !== undefined && (obj.amount = message.amount); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgClaimCommissionRewards { + return MsgClaimCommissionRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClaimCommissionRewards { const message = createBaseMsgClaimCommissionRewards(); message.creator = object.creator ?? ""; @@ -509,16 +615,17 @@ export const MsgClaimCommissionRewardsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimCommissionRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimCommissionRewardsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -532,6 +639,11 @@ export const MsgClaimCommissionRewardsResponse = { return obj; }, + create, I>>( + base?: I, + ): MsgClaimCommissionRewardsResponse { + return MsgClaimCommissionRewardsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( _: I, ): MsgClaimCommissionRewardsResponse { @@ -562,50 +674,78 @@ export const MsgJoinPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgJoinPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.valaddress = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + valaddress: isSet(object.valaddress) ? globalThis.String(object.valaddress) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.valaddress !== "") { + obj.valaddress = message.valaddress; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgJoinPool { + return MsgJoinPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgJoinPool { const message = createBaseMsgJoinPool(); message.creator = object.creator ?? ""; @@ -626,16 +766,17 @@ export const MsgJoinPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgJoinPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -649,6 +790,9 @@ export const MsgJoinPoolResponse = { return obj; }, + create, I>>(base?: I): MsgJoinPoolResponse { + return MsgJoinPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgJoinPoolResponse { const message = createBaseMsgJoinPoolResponse(); return message; @@ -671,40 +815,56 @@ export const MsgLeavePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeavePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + pool_id: isSet(object.pool_id) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } return obj; }, + create, I>>(base?: I): MsgLeavePool { + return MsgLeavePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgLeavePool { const message = createBaseMsgLeavePool(); message.creator = object.creator ?? ""; @@ -723,16 +883,17 @@ export const MsgLeavePoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeavePoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -746,6 +907,9 @@ export const MsgLeavePoolResponse = { return obj; }, + create, I>>(base?: I): MsgLeavePoolResponse { + return MsgLeavePoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgLeavePoolResponse { const message = createBaseMsgLeavePoolResponse(); return message; @@ -768,40 +932,56 @@ export const MsgUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", - payload: isSet(object.payload) ? String(object.payload) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: MsgUpdateParams): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.payload !== undefined && (obj.payload = message.payload); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateParams { const message = createBaseMsgUpdateParams(); message.authority = object.authority ?? ""; @@ -820,16 +1000,17 @@ export const MsgUpdateParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -843,6 +1024,9 @@ export const MsgUpdateParamsResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateParamsResponse { const message = createBaseMsgUpdateParamsResponse(); return message; @@ -870,11 +1054,12 @@ export interface Msg { UpdateParams(request: MsgUpdateParams): Promise; } +export const MsgServiceName = "kyve.stakers.v1beta1.Msg"; 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.service = opts?.service || MsgServiceName; this.rpc = rpc; this.CreateStaker = this.CreateStaker.bind(this); this.UpdateMetadata = this.UpdateMetadata.bind(this); @@ -887,43 +1072,43 @@ export class MsgClientImpl implements Msg { 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))); + return promise.then((data) => MsgCreateStakerResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateMetadataResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateCommissionResponse.decode(_m0.Reader.create(data))); } ClaimCommissionRewards(request: MsgClaimCommissionRewards): Promise { const data = MsgClaimCommissionRewards.encode(request).finish(); const promise = this.rpc.request(this.service, "ClaimCommissionRewards", data); - return promise.then((data) => MsgClaimCommissionRewardsResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgClaimCommissionRewardsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgJoinPoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgLeavePoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); } } @@ -934,7 +1119,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/team/v1beta1/events.ts b/common/types/src/client/kyve/team/v1beta1/events.ts index c96f773e..30dbe829 100644 --- a/common/types/src/client/kyve/team/v1beta1/events.ts +++ b/common/types/src/client/kyve/team/v1beta1/events.ts @@ -102,50 +102,78 @@ export const EventCreateTeamVestingAccount = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateTeamVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventCreateTeamVestingAccount(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.total_allocation = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.commencement = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventCreateTeamVestingAccount { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - total_allocation: isSet(object.total_allocation) ? String(object.total_allocation) : "0", - commencement: isSet(object.commencement) ? String(object.commencement) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + total_allocation: isSet(object.total_allocation) ? globalThis.String(object.total_allocation) : "0", + commencement: isSet(object.commencement) ? globalThis.String(object.commencement) : "0", }; }, toJSON(message: EventCreateTeamVestingAccount): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.total_allocation !== undefined && (obj.total_allocation = message.total_allocation); - message.commencement !== undefined && (obj.commencement = message.commencement); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.total_allocation !== "0") { + obj.total_allocation = message.total_allocation; + } + if (message.commencement !== "0") { + obj.commencement = message.commencement; + } return obj; }, + create, I>>(base?: I): EventCreateTeamVestingAccount { + return EventCreateTeamVestingAccount.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): EventCreateTeamVestingAccount { @@ -180,50 +208,78 @@ export const EventClawback = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClawback { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventClawback(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.clawback = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventClawback { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - clawback: isSet(object.clawback) ? String(object.clawback) : "0", - amount: isSet(object.amount) ? String(object.amount) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + clawback: isSet(object.clawback) ? globalThis.String(object.clawback) : "0", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", }; }, toJSON(message: EventClawback): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.clawback !== undefined && (obj.clawback = message.clawback); - message.amount !== undefined && (obj.amount = message.amount); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.clawback !== "0") { + obj.clawback = message.clawback; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventClawback { + return EventClawback.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClawback { const message = createBaseEventClawback(); message.authority = object.authority ?? ""; @@ -256,50 +312,78 @@ export const EventClaimedUnlocked = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimedUnlocked { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventClaimedUnlocked(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventClaimedUnlocked { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: EventClaimedUnlocked): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): EventClaimedUnlocked { + return EventClaimedUnlocked.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClaimedUnlocked { const message = createBaseEventClaimedUnlocked(); message.authority = object.authority ?? ""; @@ -332,50 +416,78 @@ export const EventClaimInflationRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimInflationRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventClaimInflationRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventClaimInflationRewards { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: EventClaimInflationRewards): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): EventClaimInflationRewards { + return EventClaimInflationRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClaimInflationRewards { const message = createBaseEventClaimInflationRewards(); message.authority = object.authority ?? ""; @@ -405,45 +517,67 @@ export const EventClaimAuthorityRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimAuthorityRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventClaimAuthorityRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventClaimAuthorityRewards { return { - authority: isSet(object.authority) ? String(object.authority) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: EventClaimAuthorityRewards): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): EventClaimAuthorityRewards { + return EventClaimAuthorityRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClaimAuthorityRewards { const message = createBaseEventClaimAuthorityRewards(); message.authority = object.authority ?? ""; @@ -456,7 +590,8 @@ export const EventClaimAuthorityRewards = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/team/v1beta1/genesis.ts b/common/types/src/client/kyve/team/v1beta1/genesis.ts index 7e8223ae..7f61d5e0 100644 --- a/common/types/src/client/kyve/team/v1beta1/genesis.ts +++ b/common/types/src/client/kyve/team/v1beta1/genesis.ts @@ -8,7 +8,9 @@ export const protobufPackage = "kyve.team.v1beta1"; /** GenesisState defines the team module's genesis state. */ export interface GenesisState { /** authority ... */ - authority?: Authority; + authority?: + | Authority + | undefined; /** account_list ... */ account_list: TeamVestingAccount[]; /** account_count ... */ @@ -34,25 +36,38 @@ export const GenesisState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 18) { + break; + } + message.authority = Authority.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.account_list.push(TeamVestingAccount.decode(reader, reader.uint32())); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.account_count = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -60,26 +75,30 @@ export const GenesisState = { fromJSON(object: any): GenesisState { return { authority: isSet(object.authority) ? Authority.fromJSON(object.authority) : undefined, - account_list: Array.isArray(object?.account_list) + account_list: globalThis.Array.isArray(object?.account_list) ? object.account_list.map((e: any) => TeamVestingAccount.fromJSON(e)) : [], - account_count: isSet(object.account_count) ? String(object.account_count) : "0", + account_count: isSet(object.account_count) ? globalThis.String(object.account_count) : "0", }; }, toJSON(message: GenesisState): unknown { const obj: any = {}; - message.authority !== undefined && - (obj.authority = message.authority ? Authority.toJSON(message.authority) : undefined); - if (message.account_list) { - obj.account_list = message.account_list.map((e) => e ? TeamVestingAccount.toJSON(e) : undefined); - } else { - obj.account_list = []; + if (message.authority !== undefined) { + obj.authority = Authority.toJSON(message.authority); + } + if (message.account_list?.length) { + obj.account_list = message.account_list.map((e) => TeamVestingAccount.toJSON(e)); + } + if (message.account_count !== "0") { + obj.account_count = message.account_count; } - message.account_count !== undefined && (obj.account_count = message.account_count); return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.authority = (object.authority !== undefined && object.authority !== null) @@ -94,7 +113,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/team/v1beta1/query.ts b/common/types/src/client/kyve/team/v1beta1/query.ts index fae0f0d0..aac3427b 100644 --- a/common/types/src/client/kyve/team/v1beta1/query.ts +++ b/common/types/src/client/kyve/team/v1beta1/query.ts @@ -67,7 +67,7 @@ export interface QueryTeamVestingAccountRequest { /** QueryTeamVestingAccountResponse is the response type for the Query/TeamVestingAccount RPC method. */ export interface QueryTeamVestingAccountResponse { /** account holds the requested team vesting account */ - account?: TeamVestingAccount; + account?: TeamVestingAccount | undefined; } /** QueryTeamCurrentVestingStatusRequest is request type for the Query/TeamCurrentVestingStatus RPC method. */ @@ -81,9 +81,11 @@ export interface QueryTeamVestingStatusResponse { /** request_date .. */ request_date: string; /** plan ... */ - plan?: QueryVestingPlan; + plan?: + | QueryVestingPlan + | undefined; /** status .. */ - status?: QueryVestingStatus; + status?: QueryVestingStatus | undefined; } /** QueryTeamVestingStatusByTimeRequest is request type for the Query/TeamCurrentVestingByTimeStatus RPC method. */ @@ -99,9 +101,11 @@ export interface QueryTeamVestingStatusByTimeResponse { /** request_date .. */ request_date: string; /** plan ... */ - plan?: QueryVestingPlan; + plan?: + | QueryVestingPlan + | undefined; /** status .. */ - status?: QueryVestingStatus; + status?: QueryVestingStatus | undefined; } /** QueryVestingStatus is a type holding information about the account's vesting progress */ @@ -156,16 +160,17 @@ export const QueryTeamInfoRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamInfoRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamInfoRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -179,6 +184,9 @@ export const QueryTeamInfoRequest = { return obj; }, + create, I>>(base?: I): QueryTeamInfoRequest { + return QueryTeamInfoRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryTeamInfoRequest { const message = createBaseQueryTeamInfoRequest(); return message; @@ -248,107 +256,197 @@ export const QueryTeamInfoResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamInfoResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamInfoResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.foundation_authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.bcp_authority = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.total_team_allocation = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.issued_team_allocation = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.available_team_allocation = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.total_authority_rewards = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.claimed_authority_rewards = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.available_authority_rewards = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.total_account_rewards = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.claimed_account_rewards = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 88) { + break; + } + message.available_account_rewards = longToString(reader.uint64() as Long); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.required_module_balance = longToString(reader.uint64() as Long); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.team_module_balance = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamInfoResponse { return { - foundation_authority: isSet(object.foundation_authority) ? String(object.foundation_authority) : "", - bcp_authority: isSet(object.bcp_authority) ? String(object.bcp_authority) : "", - total_team_allocation: isSet(object.total_team_allocation) ? String(object.total_team_allocation) : "0", - issued_team_allocation: isSet(object.issued_team_allocation) ? String(object.issued_team_allocation) : "0", + foundation_authority: isSet(object.foundation_authority) ? globalThis.String(object.foundation_authority) : "", + bcp_authority: isSet(object.bcp_authority) ? globalThis.String(object.bcp_authority) : "", + total_team_allocation: isSet(object.total_team_allocation) + ? globalThis.String(object.total_team_allocation) + : "0", + issued_team_allocation: isSet(object.issued_team_allocation) + ? globalThis.String(object.issued_team_allocation) + : "0", available_team_allocation: isSet(object.available_team_allocation) - ? String(object.available_team_allocation) + ? globalThis.String(object.available_team_allocation) + : "0", + total_authority_rewards: isSet(object.total_authority_rewards) + ? globalThis.String(object.total_authority_rewards) : "0", - total_authority_rewards: isSet(object.total_authority_rewards) ? String(object.total_authority_rewards) : "0", claimed_authority_rewards: isSet(object.claimed_authority_rewards) - ? String(object.claimed_authority_rewards) + ? globalThis.String(object.claimed_authority_rewards) : "0", available_authority_rewards: isSet(object.available_authority_rewards) - ? String(object.available_authority_rewards) + ? globalThis.String(object.available_authority_rewards) + : "0", + total_account_rewards: isSet(object.total_account_rewards) + ? globalThis.String(object.total_account_rewards) + : "0", + claimed_account_rewards: isSet(object.claimed_account_rewards) + ? globalThis.String(object.claimed_account_rewards) : "0", - total_account_rewards: isSet(object.total_account_rewards) ? String(object.total_account_rewards) : "0", - claimed_account_rewards: isSet(object.claimed_account_rewards) ? String(object.claimed_account_rewards) : "0", available_account_rewards: isSet(object.available_account_rewards) - ? String(object.available_account_rewards) + ? globalThis.String(object.available_account_rewards) : "0", - required_module_balance: isSet(object.required_module_balance) ? String(object.required_module_balance) : "0", - team_module_balance: isSet(object.team_module_balance) ? String(object.team_module_balance) : "0", + required_module_balance: isSet(object.required_module_balance) + ? globalThis.String(object.required_module_balance) + : "0", + team_module_balance: isSet(object.team_module_balance) ? globalThis.String(object.team_module_balance) : "0", }; }, toJSON(message: QueryTeamInfoResponse): unknown { const obj: any = {}; - message.foundation_authority !== undefined && (obj.foundation_authority = message.foundation_authority); - message.bcp_authority !== undefined && (obj.bcp_authority = message.bcp_authority); - message.total_team_allocation !== undefined && (obj.total_team_allocation = message.total_team_allocation); - message.issued_team_allocation !== undefined && (obj.issued_team_allocation = message.issued_team_allocation); - message.available_team_allocation !== undefined && - (obj.available_team_allocation = message.available_team_allocation); - message.total_authority_rewards !== undefined && (obj.total_authority_rewards = message.total_authority_rewards); - message.claimed_authority_rewards !== undefined && - (obj.claimed_authority_rewards = message.claimed_authority_rewards); - message.available_authority_rewards !== undefined && - (obj.available_authority_rewards = message.available_authority_rewards); - message.total_account_rewards !== undefined && (obj.total_account_rewards = message.total_account_rewards); - message.claimed_account_rewards !== undefined && (obj.claimed_account_rewards = message.claimed_account_rewards); - message.available_account_rewards !== undefined && - (obj.available_account_rewards = message.available_account_rewards); - message.required_module_balance !== undefined && (obj.required_module_balance = message.required_module_balance); - message.team_module_balance !== undefined && (obj.team_module_balance = message.team_module_balance); + if (message.foundation_authority !== "") { + obj.foundation_authority = message.foundation_authority; + } + if (message.bcp_authority !== "") { + obj.bcp_authority = message.bcp_authority; + } + if (message.total_team_allocation !== "0") { + obj.total_team_allocation = message.total_team_allocation; + } + if (message.issued_team_allocation !== "0") { + obj.issued_team_allocation = message.issued_team_allocation; + } + if (message.available_team_allocation !== "0") { + obj.available_team_allocation = message.available_team_allocation; + } + if (message.total_authority_rewards !== "0") { + obj.total_authority_rewards = message.total_authority_rewards; + } + if (message.claimed_authority_rewards !== "0") { + obj.claimed_authority_rewards = message.claimed_authority_rewards; + } + if (message.available_authority_rewards !== "0") { + obj.available_authority_rewards = message.available_authority_rewards; + } + if (message.total_account_rewards !== "0") { + obj.total_account_rewards = message.total_account_rewards; + } + if (message.claimed_account_rewards !== "0") { + obj.claimed_account_rewards = message.claimed_account_rewards; + } + if (message.available_account_rewards !== "0") { + obj.available_account_rewards = message.available_account_rewards; + } + if (message.required_module_balance !== "0") { + obj.required_module_balance = message.required_module_balance; + } + if (message.team_module_balance !== "0") { + obj.team_module_balance = message.team_module_balance; + } return obj; }, + create, I>>(base?: I): QueryTeamInfoResponse { + return QueryTeamInfoResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryTeamInfoResponse { const message = createBaseQueryTeamInfoResponse(); message.foundation_authority = object.foundation_authority ?? ""; @@ -378,16 +476,17 @@ export const QueryTeamVestingAccountsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingAccountsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingAccountsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -401,6 +500,9 @@ export const QueryTeamVestingAccountsRequest = { return obj; }, + create, I>>(base?: I): QueryTeamVestingAccountsRequest { + return QueryTeamVestingAccountsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryTeamVestingAccountsRequest { const message = createBaseQueryTeamVestingAccountsRequest(); return message; @@ -420,39 +522,49 @@ export const QueryTeamVestingAccountsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingAccountsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingAccountsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.accounts.push(TeamVestingAccount.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingAccountsResponse { return { - accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => TeamVestingAccount.fromJSON(e)) : [], + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e: any) => TeamVestingAccount.fromJSON(e)) + : [], }; }, toJSON(message: QueryTeamVestingAccountsResponse): unknown { const obj: any = {}; - if (message.accounts) { - obj.accounts = message.accounts.map((e) => e ? TeamVestingAccount.toJSON(e) : undefined); - } else { - obj.accounts = []; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => TeamVestingAccount.toJSON(e)); } return obj; }, + create, I>>( + base?: I, + ): QueryTeamVestingAccountsResponse { + return QueryTeamVestingAccountsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingAccountsResponse { @@ -475,33 +587,43 @@ export const QueryTeamVestingAccountRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingAccountRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingAccountRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingAccountRequest { - return { id: isSet(object.id) ? String(object.id) : "0" }; + return { id: isSet(object.id) ? globalThis.String(object.id) : "0" }; }, toJSON(message: QueryTeamVestingAccountRequest): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): QueryTeamVestingAccountRequest { + return QueryTeamVestingAccountRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingAccountRequest { @@ -524,19 +646,24 @@ export const QueryTeamVestingAccountResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingAccountResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingAccountResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.account = TeamVestingAccount.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -547,11 +674,15 @@ export const QueryTeamVestingAccountResponse = { toJSON(message: QueryTeamVestingAccountResponse): unknown { const obj: any = {}; - message.account !== undefined && - (obj.account = message.account ? TeamVestingAccount.toJSON(message.account) : undefined); + if (message.account !== undefined) { + obj.account = TeamVestingAccount.toJSON(message.account); + } return obj; }, + create, I>>(base?: I): QueryTeamVestingAccountResponse { + return QueryTeamVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingAccountResponse { @@ -576,33 +707,43 @@ export const QueryTeamVestingStatusRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingStatusRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingStatusRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingStatusRequest { - return { id: isSet(object.id) ? String(object.id) : "0" }; + return { id: isSet(object.id) ? globalThis.String(object.id) : "0" }; }, toJSON(message: QueryTeamVestingStatusRequest): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): QueryTeamVestingStatusRequest { + return QueryTeamVestingStatusRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingStatusRequest { @@ -631,32 +772,45 @@ export const QueryTeamVestingStatusResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingStatusResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingStatusResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.request_date = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.plan = QueryVestingPlan.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.status = QueryVestingStatus.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingStatusResponse { return { - request_date: isSet(object.request_date) ? String(object.request_date) : "", + request_date: isSet(object.request_date) ? globalThis.String(object.request_date) : "", plan: isSet(object.plan) ? QueryVestingPlan.fromJSON(object.plan) : undefined, status: isSet(object.status) ? QueryVestingStatus.fromJSON(object.status) : undefined, }; @@ -664,13 +818,21 @@ export const QueryTeamVestingStatusResponse = { toJSON(message: QueryTeamVestingStatusResponse): unknown { const obj: any = {}; - message.request_date !== undefined && (obj.request_date = message.request_date); - message.plan !== undefined && (obj.plan = message.plan ? QueryVestingPlan.toJSON(message.plan) : undefined); - message.status !== undefined && - (obj.status = message.status ? QueryVestingStatus.toJSON(message.status) : undefined); + if (message.request_date !== "") { + obj.request_date = message.request_date; + } + if (message.plan !== undefined) { + obj.plan = QueryVestingPlan.toJSON(message.plan); + } + if (message.status !== undefined) { + obj.status = QueryVestingStatus.toJSON(message.status); + } return obj; }, + create, I>>(base?: I): QueryTeamVestingStatusResponse { + return QueryTeamVestingStatusResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingStatusResponse { @@ -702,37 +864,58 @@ export const QueryTeamVestingStatusByTimeRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingStatusByTimeRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingStatusByTimeRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.time = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingStatusByTimeRequest { - return { id: isSet(object.id) ? String(object.id) : "0", time: isSet(object.time) ? String(object.time) : "0" }; + return { + id: isSet(object.id) ? globalThis.String(object.id) : "0", + time: isSet(object.time) ? globalThis.String(object.time) : "0", + }; }, toJSON(message: QueryTeamVestingStatusByTimeRequest): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); - message.time !== undefined && (obj.time = message.time); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.time !== "0") { + obj.time = message.time; + } return obj; }, + create, I>>( + base?: I, + ): QueryTeamVestingStatusByTimeRequest { + return QueryTeamVestingStatusByTimeRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingStatusByTimeRequest { @@ -762,32 +945,45 @@ export const QueryTeamVestingStatusByTimeResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingStatusByTimeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingStatusByTimeResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.request_date = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.plan = QueryVestingPlan.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.status = QueryVestingStatus.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingStatusByTimeResponse { return { - request_date: isSet(object.request_date) ? String(object.request_date) : "", + request_date: isSet(object.request_date) ? globalThis.String(object.request_date) : "", plan: isSet(object.plan) ? QueryVestingPlan.fromJSON(object.plan) : undefined, status: isSet(object.status) ? QueryVestingStatus.fromJSON(object.status) : undefined, }; @@ -795,13 +991,23 @@ export const QueryTeamVestingStatusByTimeResponse = { toJSON(message: QueryTeamVestingStatusByTimeResponse): unknown { const obj: any = {}; - message.request_date !== undefined && (obj.request_date = message.request_date); - message.plan !== undefined && (obj.plan = message.plan ? QueryVestingPlan.toJSON(message.plan) : undefined); - message.status !== undefined && - (obj.status = message.status ? QueryVestingStatus.toJSON(message.status) : undefined); + if (message.request_date !== "") { + obj.request_date = message.request_date; + } + if (message.plan !== undefined) { + obj.plan = QueryVestingPlan.toJSON(message.plan); + } + if (message.status !== undefined) { + obj.status = QueryVestingStatus.toJSON(message.status); + } return obj; }, + create, I>>( + base?: I, + ): QueryTeamVestingStatusByTimeResponse { + return QueryTeamVestingStatusByTimeResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingStatusByTimeResponse { @@ -864,78 +1070,139 @@ export const QueryVestingStatus = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVestingStatus { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVestingStatus(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.total_vested_amount = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.total_unlocked_amount = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.current_claimable_amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.locked_vested_amount = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.remaining_unvested_amount = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.claimed_amount = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.total_rewards = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.claimed_rewards = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.available_rewards = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryVestingStatus { return { - total_vested_amount: isSet(object.total_vested_amount) ? String(object.total_vested_amount) : "0", - total_unlocked_amount: isSet(object.total_unlocked_amount) ? String(object.total_unlocked_amount) : "0", - current_claimable_amount: isSet(object.current_claimable_amount) ? String(object.current_claimable_amount) : "0", - locked_vested_amount: isSet(object.locked_vested_amount) ? String(object.locked_vested_amount) : "0", + total_vested_amount: isSet(object.total_vested_amount) ? globalThis.String(object.total_vested_amount) : "0", + total_unlocked_amount: isSet(object.total_unlocked_amount) + ? globalThis.String(object.total_unlocked_amount) + : "0", + current_claimable_amount: isSet(object.current_claimable_amount) + ? globalThis.String(object.current_claimable_amount) + : "0", + locked_vested_amount: isSet(object.locked_vested_amount) ? globalThis.String(object.locked_vested_amount) : "0", remaining_unvested_amount: isSet(object.remaining_unvested_amount) - ? String(object.remaining_unvested_amount) + ? globalThis.String(object.remaining_unvested_amount) : "0", - claimed_amount: isSet(object.claimed_amount) ? String(object.claimed_amount) : "0", - total_rewards: isSet(object.total_rewards) ? String(object.total_rewards) : "0", - claimed_rewards: isSet(object.claimed_rewards) ? String(object.claimed_rewards) : "0", - available_rewards: isSet(object.available_rewards) ? String(object.available_rewards) : "0", + claimed_amount: isSet(object.claimed_amount) ? globalThis.String(object.claimed_amount) : "0", + total_rewards: isSet(object.total_rewards) ? globalThis.String(object.total_rewards) : "0", + claimed_rewards: isSet(object.claimed_rewards) ? globalThis.String(object.claimed_rewards) : "0", + available_rewards: isSet(object.available_rewards) ? globalThis.String(object.available_rewards) : "0", }; }, toJSON(message: QueryVestingStatus): unknown { const obj: any = {}; - message.total_vested_amount !== undefined && (obj.total_vested_amount = message.total_vested_amount); - message.total_unlocked_amount !== undefined && (obj.total_unlocked_amount = message.total_unlocked_amount); - message.current_claimable_amount !== undefined && (obj.current_claimable_amount = message.current_claimable_amount); - message.locked_vested_amount !== undefined && (obj.locked_vested_amount = message.locked_vested_amount); - message.remaining_unvested_amount !== undefined && - (obj.remaining_unvested_amount = message.remaining_unvested_amount); - message.claimed_amount !== undefined && (obj.claimed_amount = message.claimed_amount); - message.total_rewards !== undefined && (obj.total_rewards = message.total_rewards); - message.claimed_rewards !== undefined && (obj.claimed_rewards = message.claimed_rewards); - message.available_rewards !== undefined && (obj.available_rewards = message.available_rewards); + if (message.total_vested_amount !== "0") { + obj.total_vested_amount = message.total_vested_amount; + } + if (message.total_unlocked_amount !== "0") { + obj.total_unlocked_amount = message.total_unlocked_amount; + } + if (message.current_claimable_amount !== "0") { + obj.current_claimable_amount = message.current_claimable_amount; + } + if (message.locked_vested_amount !== "0") { + obj.locked_vested_amount = message.locked_vested_amount; + } + if (message.remaining_unvested_amount !== "0") { + obj.remaining_unvested_amount = message.remaining_unvested_amount; + } + if (message.claimed_amount !== "0") { + obj.claimed_amount = message.claimed_amount; + } + if (message.total_rewards !== "0") { + obj.total_rewards = message.total_rewards; + } + if (message.claimed_rewards !== "0") { + obj.claimed_rewards = message.claimed_rewards; + } + if (message.available_rewards !== "0") { + obj.available_rewards = message.available_rewards; + } return obj; }, + create, I>>(base?: I): QueryVestingStatus { + return QueryVestingStatus.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVestingStatus { const message = createBaseQueryVestingStatus(); message.total_vested_amount = object.total_vested_amount ?? "0"; @@ -994,70 +1261,126 @@ export const QueryVestingPlan = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVestingPlan { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVestingPlan(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.commencement = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.token_vesting_start = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.token_vesting_finished = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.token_unlock_start = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.token_unlock_finished = reader.string(); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.clawback = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.clawback_amount = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.maximum_vesting_amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryVestingPlan { return { - commencement: isSet(object.commencement) ? String(object.commencement) : "", - token_vesting_start: isSet(object.token_vesting_start) ? String(object.token_vesting_start) : "", - token_vesting_finished: isSet(object.token_vesting_finished) ? String(object.token_vesting_finished) : "", - token_unlock_start: isSet(object.token_unlock_start) ? String(object.token_unlock_start) : "", - token_unlock_finished: isSet(object.token_unlock_finished) ? String(object.token_unlock_finished) : "", - clawback: isSet(object.clawback) ? String(object.clawback) : "0", - clawback_amount: isSet(object.clawback_amount) ? String(object.clawback_amount) : "0", - maximum_vesting_amount: isSet(object.maximum_vesting_amount) ? String(object.maximum_vesting_amount) : "0", + commencement: isSet(object.commencement) ? globalThis.String(object.commencement) : "", + token_vesting_start: isSet(object.token_vesting_start) ? globalThis.String(object.token_vesting_start) : "", + token_vesting_finished: isSet(object.token_vesting_finished) + ? globalThis.String(object.token_vesting_finished) + : "", + token_unlock_start: isSet(object.token_unlock_start) ? globalThis.String(object.token_unlock_start) : "", + token_unlock_finished: isSet(object.token_unlock_finished) ? globalThis.String(object.token_unlock_finished) : "", + clawback: isSet(object.clawback) ? globalThis.String(object.clawback) : "0", + clawback_amount: isSet(object.clawback_amount) ? globalThis.String(object.clawback_amount) : "0", + maximum_vesting_amount: isSet(object.maximum_vesting_amount) + ? globalThis.String(object.maximum_vesting_amount) + : "0", }; }, toJSON(message: QueryVestingPlan): unknown { const obj: any = {}; - message.commencement !== undefined && (obj.commencement = message.commencement); - message.token_vesting_start !== undefined && (obj.token_vesting_start = message.token_vesting_start); - message.token_vesting_finished !== undefined && (obj.token_vesting_finished = message.token_vesting_finished); - message.token_unlock_start !== undefined && (obj.token_unlock_start = message.token_unlock_start); - message.token_unlock_finished !== undefined && (obj.token_unlock_finished = message.token_unlock_finished); - message.clawback !== undefined && (obj.clawback = message.clawback); - message.clawback_amount !== undefined && (obj.clawback_amount = message.clawback_amount); - message.maximum_vesting_amount !== undefined && (obj.maximum_vesting_amount = message.maximum_vesting_amount); + if (message.commencement !== "") { + obj.commencement = message.commencement; + } + if (message.token_vesting_start !== "") { + obj.token_vesting_start = message.token_vesting_start; + } + if (message.token_vesting_finished !== "") { + obj.token_vesting_finished = message.token_vesting_finished; + } + if (message.token_unlock_start !== "") { + obj.token_unlock_start = message.token_unlock_start; + } + if (message.token_unlock_finished !== "") { + obj.token_unlock_finished = message.token_unlock_finished; + } + if (message.clawback !== "0") { + obj.clawback = message.clawback; + } + if (message.clawback_amount !== "0") { + obj.clawback_amount = message.clawback_amount; + } + if (message.maximum_vesting_amount !== "0") { + obj.maximum_vesting_amount = message.maximum_vesting_amount; + } return obj; }, + create, I>>(base?: I): QueryVestingPlan { + return QueryVestingPlan.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVestingPlan { const message = createBaseQueryVestingPlan(); message.commencement = object.commencement ?? ""; @@ -1086,11 +1409,12 @@ export interface Query { TeamVestingStatusByTime(request: QueryTeamVestingStatusByTimeRequest): Promise; } +export const QueryServiceName = "kyve.team.v1beta1.Query"; export class QueryClientImpl implements Query { private readonly rpc: Rpc; private readonly service: string; constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || "kyve.team.v1beta1.Query"; + this.service = opts?.service || QueryServiceName; this.rpc = rpc; this.TeamInfo = this.TeamInfo.bind(this); this.TeamVestingAccounts = this.TeamVestingAccounts.bind(this); @@ -1101,31 +1425,31 @@ export class QueryClientImpl implements Query { TeamInfo(request: QueryTeamInfoRequest): Promise { const data = QueryTeamInfoRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "TeamInfo", data); - return promise.then((data) => QueryTeamInfoResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryTeamInfoResponse.decode(_m0.Reader.create(data))); } TeamVestingAccounts(request: QueryTeamVestingAccountsRequest): Promise { const data = QueryTeamVestingAccountsRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "TeamVestingAccounts", data); - return promise.then((data) => QueryTeamVestingAccountsResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryTeamVestingAccountsResponse.decode(_m0.Reader.create(data))); } TeamVestingAccount(request: QueryTeamVestingAccountRequest): Promise { const data = QueryTeamVestingAccountRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "TeamVestingAccount", data); - return promise.then((data) => QueryTeamVestingAccountResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryTeamVestingAccountResponse.decode(_m0.Reader.create(data))); } TeamVestingStatus(request: QueryTeamVestingStatusRequest): Promise { const data = QueryTeamVestingStatusRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "TeamVestingStatus", data); - return promise.then((data) => QueryTeamVestingStatusResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryTeamVestingStatusResponse.decode(_m0.Reader.create(data))); } TeamVestingStatusByTime(request: QueryTeamVestingStatusByTimeRequest): Promise { const data = QueryTeamVestingStatusByTimeRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "TeamVestingStatusByTime", data); - return promise.then((data) => QueryTeamVestingStatusByTimeResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryTeamVestingStatusByTimeResponse.decode(_m0.Reader.create(data))); } } @@ -1136,7 +1460,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/team/v1beta1/team.ts b/common/types/src/client/kyve/team/v1beta1/team.ts index c96e4d32..34e956ac 100644 --- a/common/types/src/client/kyve/team/v1beta1/team.ts +++ b/common/types/src/client/kyve/team/v1beta1/team.ts @@ -51,40 +51,56 @@ export const Authority = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Authority { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAuthority(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.total_rewards = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.rewards_claimed = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Authority { return { - total_rewards: isSet(object.total_rewards) ? String(object.total_rewards) : "0", - rewards_claimed: isSet(object.rewards_claimed) ? String(object.rewards_claimed) : "0", + total_rewards: isSet(object.total_rewards) ? globalThis.String(object.total_rewards) : "0", + rewards_claimed: isSet(object.rewards_claimed) ? globalThis.String(object.rewards_claimed) : "0", }; }, toJSON(message: Authority): unknown { const obj: any = {}; - message.total_rewards !== undefined && (obj.total_rewards = message.total_rewards); - message.rewards_claimed !== undefined && (obj.rewards_claimed = message.rewards_claimed); + if (message.total_rewards !== "0") { + obj.total_rewards = message.total_rewards; + } + if (message.rewards_claimed !== "0") { + obj.rewards_claimed = message.rewards_claimed; + } return obj; }, + create, I>>(base?: I): Authority { + return Authority.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Authority { const message = createBaseAuthority(); message.total_rewards = object.total_rewards ?? "0"; @@ -136,70 +152,122 @@ export const TeamVestingAccount = { }, decode(input: _m0.Reader | Uint8Array, length?: number): TeamVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTeamVestingAccount(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.total_allocation = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.commencement = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.clawback = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.unlocked_claimed = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.last_claimed_time = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.total_rewards = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.rewards_claimed = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): TeamVestingAccount { return { - id: isSet(object.id) ? String(object.id) : "0", - total_allocation: isSet(object.total_allocation) ? String(object.total_allocation) : "0", - commencement: isSet(object.commencement) ? String(object.commencement) : "0", - clawback: isSet(object.clawback) ? String(object.clawback) : "0", - unlocked_claimed: isSet(object.unlocked_claimed) ? String(object.unlocked_claimed) : "0", - last_claimed_time: isSet(object.last_claimed_time) ? String(object.last_claimed_time) : "0", - total_rewards: isSet(object.total_rewards) ? String(object.total_rewards) : "0", - rewards_claimed: isSet(object.rewards_claimed) ? String(object.rewards_claimed) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + total_allocation: isSet(object.total_allocation) ? globalThis.String(object.total_allocation) : "0", + commencement: isSet(object.commencement) ? globalThis.String(object.commencement) : "0", + clawback: isSet(object.clawback) ? globalThis.String(object.clawback) : "0", + unlocked_claimed: isSet(object.unlocked_claimed) ? globalThis.String(object.unlocked_claimed) : "0", + last_claimed_time: isSet(object.last_claimed_time) ? globalThis.String(object.last_claimed_time) : "0", + total_rewards: isSet(object.total_rewards) ? globalThis.String(object.total_rewards) : "0", + rewards_claimed: isSet(object.rewards_claimed) ? globalThis.String(object.rewards_claimed) : "0", }; }, toJSON(message: TeamVestingAccount): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); - message.total_allocation !== undefined && (obj.total_allocation = message.total_allocation); - message.commencement !== undefined && (obj.commencement = message.commencement); - message.clawback !== undefined && (obj.clawback = message.clawback); - message.unlocked_claimed !== undefined && (obj.unlocked_claimed = message.unlocked_claimed); - message.last_claimed_time !== undefined && (obj.last_claimed_time = message.last_claimed_time); - message.total_rewards !== undefined && (obj.total_rewards = message.total_rewards); - message.rewards_claimed !== undefined && (obj.rewards_claimed = message.rewards_claimed); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.total_allocation !== "0") { + obj.total_allocation = message.total_allocation; + } + if (message.commencement !== "0") { + obj.commencement = message.commencement; + } + if (message.clawback !== "0") { + obj.clawback = message.clawback; + } + if (message.unlocked_claimed !== "0") { + obj.unlocked_claimed = message.unlocked_claimed; + } + if (message.last_claimed_time !== "0") { + obj.last_claimed_time = message.last_claimed_time; + } + if (message.total_rewards !== "0") { + obj.total_rewards = message.total_rewards; + } + if (message.rewards_claimed !== "0") { + obj.rewards_claimed = message.rewards_claimed; + } return obj; }, + create, I>>(base?: I): TeamVestingAccount { + return TeamVestingAccount.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): TeamVestingAccount { const message = createBaseTeamVestingAccount(); message.id = object.id ?? "0"; @@ -217,7 +285,8 @@ export const TeamVestingAccount = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/kyve/team/v1beta1/tx.ts b/common/types/src/client/kyve/team/v1beta1/tx.ts index 5d65e616..cfc7ff57 100644 --- a/common/types/src/client/kyve/team/v1beta1/tx.ts +++ b/common/types/src/client/kyve/team/v1beta1/tx.ts @@ -100,50 +100,78 @@ export const MsgClaimUnlocked = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUnlocked { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimUnlocked(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgClaimUnlocked { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: MsgClaimUnlocked): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): MsgClaimUnlocked { + return MsgClaimUnlocked.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClaimUnlocked { const message = createBaseMsgClaimUnlocked(); message.authority = object.authority ?? ""; @@ -164,16 +192,17 @@ export const MsgClaimUnlockedResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUnlockedResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimUnlockedResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -187,6 +216,9 @@ export const MsgClaimUnlockedResponse = { return obj; }, + create, I>>(base?: I): MsgClaimUnlockedResponse { + return MsgClaimUnlockedResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgClaimUnlockedResponse { const message = createBaseMsgClaimUnlockedResponse(); return message; @@ -212,45 +244,67 @@ export const MsgClaimAuthorityRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimAuthorityRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimAuthorityRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgClaimAuthorityRewards { return { - authority: isSet(object.authority) ? String(object.authority) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: MsgClaimAuthorityRewards): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): MsgClaimAuthorityRewards { + return MsgClaimAuthorityRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClaimAuthorityRewards { const message = createBaseMsgClaimAuthorityRewards(); message.authority = object.authority ?? ""; @@ -270,16 +324,17 @@ export const MsgClaimAuthorityRewardsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimAuthorityRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimAuthorityRewardsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -293,6 +348,11 @@ export const MsgClaimAuthorityRewardsResponse = { return obj; }, + create, I>>( + base?: I, + ): MsgClaimAuthorityRewardsResponse { + return MsgClaimAuthorityRewardsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( _: I, ): MsgClaimAuthorityRewardsResponse { @@ -323,50 +383,78 @@ export const MsgClaimAccountRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimAccountRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimAccountRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgClaimAccountRewards { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: MsgClaimAccountRewards): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): MsgClaimAccountRewards { + return MsgClaimAccountRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClaimAccountRewards { const message = createBaseMsgClaimAccountRewards(); message.authority = object.authority ?? ""; @@ -387,16 +475,17 @@ export const MsgClaimAccountRewardsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimAccountRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimAccountRewardsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -410,6 +499,9 @@ export const MsgClaimAccountRewardsResponse = { return obj; }, + create, I>>(base?: I): MsgClaimAccountRewardsResponse { + return MsgClaimAccountRewardsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgClaimAccountRewardsResponse { const message = createBaseMsgClaimAccountRewardsResponse(); return message; @@ -435,45 +527,67 @@ export const MsgClawback = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClawback { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClawback(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.clawback = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgClawback { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - clawback: isSet(object.clawback) ? String(object.clawback) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + clawback: isSet(object.clawback) ? globalThis.String(object.clawback) : "0", }; }, toJSON(message: MsgClawback): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.clawback !== undefined && (obj.clawback = message.clawback); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.clawback !== "0") { + obj.clawback = message.clawback; + } return obj; }, + create, I>>(base?: I): MsgClawback { + return MsgClawback.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClawback { const message = createBaseMsgClawback(); message.authority = object.authority ?? ""; @@ -493,16 +607,17 @@ export const MsgClawbackResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClawbackResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClawbackResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -516,6 +631,9 @@ export const MsgClawbackResponse = { return obj; }, + create, I>>(base?: I): MsgClawbackResponse { + return MsgClawbackResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgClawbackResponse { const message = createBaseMsgClawbackResponse(); return message; @@ -541,45 +659,67 @@ export const MsgCreateTeamVestingAccount = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateTeamVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateTeamVestingAccount(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.total_allocation = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.commencement = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgCreateTeamVestingAccount { return { - authority: isSet(object.authority) ? String(object.authority) : "", - total_allocation: isSet(object.total_allocation) ? String(object.total_allocation) : "0", - commencement: isSet(object.commencement) ? String(object.commencement) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + total_allocation: isSet(object.total_allocation) ? globalThis.String(object.total_allocation) : "0", + commencement: isSet(object.commencement) ? globalThis.String(object.commencement) : "0", }; }, toJSON(message: MsgCreateTeamVestingAccount): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.total_allocation !== undefined && (obj.total_allocation = message.total_allocation); - message.commencement !== undefined && (obj.commencement = message.commencement); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.total_allocation !== "0") { + obj.total_allocation = message.total_allocation; + } + if (message.commencement !== "0") { + obj.commencement = message.commencement; + } return obj; }, + create, I>>(base?: I): MsgCreateTeamVestingAccount { + return MsgCreateTeamVestingAccount.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgCreateTeamVestingAccount { const message = createBaseMsgCreateTeamVestingAccount(); message.authority = object.authority ?? ""; @@ -599,16 +739,17 @@ export const MsgCreateTeamVestingAccountResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateTeamVestingAccountResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateTeamVestingAccountResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -622,6 +763,11 @@ export const MsgCreateTeamVestingAccountResponse = { return obj; }, + create, I>>( + base?: I, + ): MsgCreateTeamVestingAccountResponse { + return MsgCreateTeamVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( _: I, ): MsgCreateTeamVestingAccountResponse { @@ -644,11 +790,12 @@ export interface Msg { ClaimAccountRewards(request: MsgClaimAccountRewards): Promise; } +export const MsgServiceName = "kyve.team.v1beta1.Msg"; export class MsgClientImpl implements Msg { private readonly rpc: Rpc; private readonly service: string; constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || "kyve.team.v1beta1.Msg"; + this.service = opts?.service || MsgServiceName; this.rpc = rpc; this.ClaimUnlocked = this.ClaimUnlocked.bind(this); this.Clawback = this.Clawback.bind(this); @@ -659,31 +806,31 @@ export class MsgClientImpl implements Msg { ClaimUnlocked(request: MsgClaimUnlocked): Promise { const data = MsgClaimUnlocked.encode(request).finish(); const promise = this.rpc.request(this.service, "ClaimUnlocked", data); - return promise.then((data) => MsgClaimUnlockedResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgClaimUnlockedResponse.decode(_m0.Reader.create(data))); } Clawback(request: MsgClawback): Promise { const data = MsgClawback.encode(request).finish(); const promise = this.rpc.request(this.service, "Clawback", data); - return promise.then((data) => MsgClawbackResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgClawbackResponse.decode(_m0.Reader.create(data))); } CreateTeamVestingAccount(request: MsgCreateTeamVestingAccount): Promise { const data = MsgCreateTeamVestingAccount.encode(request).finish(); const promise = this.rpc.request(this.service, "CreateTeamVestingAccount", data); - return promise.then((data) => MsgCreateTeamVestingAccountResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgCreateTeamVestingAccountResponse.decode(_m0.Reader.create(data))); } ClaimAuthorityRewards(request: MsgClaimAuthorityRewards): Promise { const data = MsgClaimAuthorityRewards.encode(request).finish(); const promise = this.rpc.request(this.service, "ClaimAuthorityRewards", data); - return promise.then((data) => MsgClaimAuthorityRewardsResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgClaimAuthorityRewardsResponse.decode(_m0.Reader.create(data))); } ClaimAccountRewards(request: MsgClaimAccountRewards): Promise { const data = MsgClaimAccountRewards.encode(request).finish(); const promise = this.rpc.request(this.service, "ClaimAccountRewards", data); - return promise.then((data) => MsgClaimAccountRewardsResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgClaimAccountRewardsResponse.decode(_m0.Reader.create(data))); } } @@ -694,7 +841,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/client/tendermint/abci/types.ts b/common/types/src/client/tendermint/abci/types.ts deleted file mode 100644 index 2e7cfd14..00000000 --- a/common/types/src/client/tendermint/abci/types.ts +++ /dev/null @@ -1,4121 +0,0 @@ -/* 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 deleted file mode 100644 index a3f5f88f..00000000 --- a/common/types/src/client/tendermint/crypto/keys.ts +++ /dev/null @@ -1,129 +0,0 @@ -/* 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 deleted file mode 100644 index 5c9e78de..00000000 --- a/common/types/src/client/tendermint/crypto/proof.ts +++ /dev/null @@ -1,436 +0,0 @@ -/* 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 deleted file mode 100644 index ddef8ae2..00000000 --- a/common/types/src/client/tendermint/libs/bits/types.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* 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 deleted file mode 100644 index 8c8f4f0c..00000000 --- a/common/types/src/client/tendermint/p2p/types.ts +++ /dev/null @@ -1,532 +0,0 @@ -/* 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 deleted file mode 100644 index beb4c40b..00000000 --- a/common/types/src/client/tendermint/types/block.ts +++ /dev/null @@ -1,112 +0,0 @@ -/* 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 deleted file mode 100644 index d4d5ed66..00000000 --- a/common/types/src/client/tendermint/types/evidence.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* 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 deleted file mode 100644 index c5e07f0b..00000000 --- a/common/types/src/client/tendermint/types/params.ts +++ /dev/null @@ -1,492 +0,0 @@ -/* 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 deleted file mode 100644 index 9cad789b..00000000 --- a/common/types/src/client/tendermint/types/types.ts +++ /dev/null @@ -1,1445 +0,0 @@ -/* 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 deleted file mode 100644 index 41b2d2dc..00000000 --- a/common/types/src/client/tendermint/types/validator.ts +++ /dev/null @@ -1,305 +0,0 @@ -/* 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 deleted file mode 100644 index 3eda3af6..00000000 --- a/common/types/src/client/tendermint/version/types.ts +++ /dev/null @@ -1,165 +0,0 @@ -/* 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 deleted file mode 100644 index 2a4ecfb5..00000000 --- a/common/types/src/lcd/cosmos/app/v1alpha1/config.ts +++ /dev/null @@ -1,167 +0,0 @@ -/* 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 deleted file mode 100644 index eaebc57e..00000000 --- a/common/types/src/lcd/cosmos/app/v1alpha1/module.ts +++ /dev/null @@ -1,288 +0,0 @@ -/* 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 deleted file mode 100644 index bffe40f9..00000000 --- a/common/types/src/lcd/cosmos/app/v1alpha1/query.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* 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 deleted file mode 100644 index 7f0c9d19..00000000 --- a/common/types/src/lcd/cosmos/auth/v1beta1/auth.ts +++ /dev/null @@ -1,304 +0,0 @@ -/* 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 deleted file mode 100644 index c67683fe..00000000 --- a/common/types/src/lcd/cosmos/auth/v1beta1/genesis.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* 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 deleted file mode 100644 index 4fe0cbf9..00000000 --- a/common/types/src/lcd/cosmos/auth/v1beta1/query.ts +++ /dev/null @@ -1,900 +0,0 @@ -/* 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 deleted file mode 100644 index 13d9662e..00000000 --- a/common/types/src/lcd/cosmos/authz/v1beta1/authz.ts +++ /dev/null @@ -1,325 +0,0 @@ -/* 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 deleted file mode 100644 index 6a9f5469..00000000 --- a/common/types/src/lcd/cosmos/authz/v1beta1/event.ts +++ /dev/null @@ -1,175 +0,0 @@ -/* 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 deleted file mode 100644 index 5eb22427..00000000 --- a/common/types/src/lcd/cosmos/authz/v1beta1/genesis.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* 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 deleted file mode 100644 index f8fa6414..00000000 --- a/common/types/src/lcd/cosmos/authz/v1beta1/query.ts +++ /dev/null @@ -1,518 +0,0 @@ -/* 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 deleted file mode 100644 index 8341fcff..00000000 --- a/common/types/src/lcd/cosmos/authz/v1beta1/tx.ts +++ /dev/null @@ -1,495 +0,0 @@ -/* 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 deleted file mode 100644 index ddcc3b3f..00000000 --- a/common/types/src/lcd/cosmos/bank/v1beta1/authz.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* 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 deleted file mode 100644 index 6ad552cf..00000000 --- a/common/types/src/lcd/cosmos/bank/v1beta1/bank.ts +++ /dev/null @@ -1,604 +0,0 @@ -/* 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 deleted file mode 100644 index b0a000e9..00000000 --- a/common/types/src/lcd/cosmos/bank/v1beta1/genesis.ts +++ /dev/null @@ -1,201 +0,0 @@ -/* 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 deleted file mode 100644 index 5f7176bd..00000000 --- a/common/types/src/lcd/cosmos/bank/v1beta1/query.ts +++ /dev/null @@ -1,1356 +0,0 @@ -/* 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 deleted file mode 100644 index 034e8c6e..00000000 --- a/common/types/src/lcd/cosmos/bank/v1beta1/tx.ts +++ /dev/null @@ -1,291 +0,0 @@ -/* 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 deleted file mode 100644 index b3aaa489..00000000 --- a/common/types/src/lcd/cosmos/base/abci/v1beta1/abci.ts +++ /dev/null @@ -1,1035 +0,0 @@ -/* 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 deleted file mode 100644 index c9269e4c..00000000 --- a/common/types/src/lcd/cosmos/base/kv/v1beta1/kv.ts +++ /dev/null @@ -1,185 +0,0 @@ -/* 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 index f35cb45d..0c3902cf 100644 --- a/common/types/src/lcd/cosmos/base/query/v1beta1/pagination.ts +++ b/common/types/src/lcd/cosmos/base/query/v1beta1/pagination.ts @@ -70,7 +70,7 @@ export interface PageResponse { } function createBasePageRequest(): PageRequest { - return { key: new Uint8Array(), offset: "0", limit: "0", count_total: false, reverse: false }; + return { key: new Uint8Array(0), offset: "0", limit: "0", count_total: false, reverse: false }; } export const PageRequest = { @@ -94,59 +94,92 @@ export const PageRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.key = reader.bytes(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.offset = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.limit = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.count_total = reader.bool(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.reverse = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.String(object.offset) : "0", + limit: isSet(object.limit) ? globalThis.String(object.limit) : "0", + count_total: isSet(object.count_total) ? globalThis.Boolean(object.count_total) : false, + reverse: isSet(object.reverse) ? globalThis.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); + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== "0") { + obj.offset = message.offset; + } + if (message.limit !== "0") { + obj.limit = message.limit; + } + if (message.count_total === true) { + obj.count_total = message.count_total; + } + if (message.reverse === true) { + obj.reverse = message.reverse; + } return obj; }, + create, I>>(base?: I): PageRequest { + return PageRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): PageRequest { const message = createBasePageRequest(); - message.key = object.key ?? new Uint8Array(); + message.key = object.key ?? new Uint8Array(0); message.offset = object.offset ?? "0"; message.limit = object.limit ?? "0"; message.count_total = object.count_total ?? false; @@ -156,7 +189,7 @@ export const PageRequest = { }; function createBasePageResponse(): PageResponse { - return { next_key: new Uint8Array(), total: "0" }; + return { next_key: new Uint8Array(0), total: "0" }; } export const PageResponse = { @@ -171,68 +204,64 @@ export const PageResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.next_key = reader.bytes(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.total = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + next_key: isSet(object.next_key) ? bytesFromBase64(object.next_key) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.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); + if (message.next_key.length !== 0) { + obj.next_key = base64FromBytes(message.next_key); + } + if (message.total !== "0") { + obj.total = message.total; + } return obj; }, + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): PageResponse { const message = createBasePageResponse(); - message.next_key = object.next_key ?? new Uint8Array(); + message.next_key = object.next_key ?? new Uint8Array(0); 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")); @@ -252,7 +281,7 @@ function base64FromBytes(arr: Uint8Array): string { } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); return globalThis.btoa(bin.join("")); } @@ -261,7 +290,8 @@ function base64FromBytes(arr: Uint8Array): string { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/cosmos/base/reflection/v1beta1/reflection.ts b/common/types/src/lcd/cosmos/base/reflection/v1beta1/reflection.ts deleted file mode 100644 index b9491b68..00000000 --- a/common/types/src/lcd/cosmos/base/reflection/v1beta1/reflection.ts +++ /dev/null @@ -1,280 +0,0 @@ -/* 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 deleted file mode 100644 index 61d766d8..00000000 --- a/common/types/src/lcd/cosmos/base/reflection/v2alpha1/reflection.ts +++ /dev/null @@ -1,1750 +0,0 @@ -/* 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 deleted file mode 100644 index 236000e2..00000000 --- a/common/types/src/lcd/cosmos/base/snapshots/v1beta1/snapshot.ts +++ /dev/null @@ -1,734 +0,0 @@ -/* 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 deleted file mode 100644 index fad7da54..00000000 --- a/common/types/src/lcd/cosmos/base/store/v1beta1/commit_info.ts +++ /dev/null @@ -1,282 +0,0 @@ -/* 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 deleted file mode 100644 index aefc9d0f..00000000 --- a/common/types/src/lcd/cosmos/base/store/v1beta1/listening.ts +++ /dev/null @@ -1,157 +0,0 @@ -/* 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 deleted file mode 100644 index 1e02d7d7..00000000 --- a/common/types/src/lcd/cosmos/base/tendermint/v1beta1/query.ts +++ /dev/null @@ -1,1137 +0,0 @@ -/* 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 index b28eec03..70abf752 100644 --- a/common/types/src/lcd/cosmos/base/v1beta1/coin.ts +++ b/common/types/src/lcd/cosmos/base/v1beta1/coin.ts @@ -51,40 +51,56 @@ export const Coin = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Coin { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.denom = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.amount = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Coin { return { - denom: isSet(object.denom) ? String(object.denom) : "", - amount: isSet(object.amount) ? String(object.amount) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", }; }, toJSON(message: Coin): unknown { const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.amount !== undefined && (obj.amount = message.amount); + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): Coin { + return Coin.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Coin { const message = createBaseCoin(); message.denom = object.denom ?? ""; @@ -109,40 +125,56 @@ export const DecCoin = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.denom = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.amount = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): DecCoin { return { - denom: isSet(object.denom) ? String(object.denom) : "", - amount: isSet(object.amount) ? String(object.amount) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", }; }, toJSON(message: DecCoin): unknown { const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.amount !== undefined && (obj.amount = message.amount); + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): DecCoin { + return DecCoin.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DecCoin { const message = createBaseDecCoin(); message.denom = object.denom ?? ""; @@ -164,33 +196,43 @@ export const IntProto = { }, decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.int = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): IntProto { - return { int: isSet(object.int) ? String(object.int) : "" }; + return { int: isSet(object.int) ? globalThis.String(object.int) : "" }; }, toJSON(message: IntProto): unknown { const obj: any = {}; - message.int !== undefined && (obj.int = message.int); + if (message.int !== "") { + obj.int = message.int; + } return obj; }, + create, I>>(base?: I): IntProto { + return IntProto.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): IntProto { const message = createBaseIntProto(); message.int = object.int ?? ""; @@ -211,33 +253,43 @@ export const DecProto = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.dec = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): DecProto { - return { dec: isSet(object.dec) ? String(object.dec) : "" }; + return { dec: isSet(object.dec) ? globalThis.String(object.dec) : "" }; }, toJSON(message: DecProto): unknown { const obj: any = {}; - message.dec !== undefined && (obj.dec = message.dec); + if (message.dec !== "") { + obj.dec = message.dec; + } return obj; }, + create, I>>(base?: I): DecProto { + return DecProto.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DecProto { const message = createBaseDecProto(); message.dec = object.dec ?? ""; @@ -248,7 +300,8 @@ export const DecProto = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/cosmos/capability/v1beta1/capability.ts b/common/types/src/lcd/cosmos/capability/v1beta1/capability.ts deleted file mode 100644 index db10e372..00000000 --- a/common/types/src/lcd/cosmos/capability/v1beta1/capability.ts +++ /dev/null @@ -1,210 +0,0 @@ -/* 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 deleted file mode 100644 index eab16eaa..00000000 --- a/common/types/src/lcd/cosmos/capability/v1beta1/genesis.ts +++ /dev/null @@ -1,172 +0,0 @@ -/* 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 deleted file mode 100644 index ea45d3e8..00000000 --- a/common/types/src/lcd/cosmos/crisis/v1beta1/genesis.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* 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 deleted file mode 100644 index 34aef3b9..00000000 --- a/common/types/src/lcd/cosmos/crisis/v1beta1/tx.ts +++ /dev/null @@ -1,161 +0,0 @@ -/* 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 deleted file mode 100644 index b774ec88..00000000 --- a/common/types/src/lcd/cosmos/crypto/ed25519/keys.ts +++ /dev/null @@ -1,178 +0,0 @@ -/* 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 deleted file mode 100644 index 622c613c..00000000 --- a/common/types/src/lcd/cosmos/crypto/hd/v1/hd.ts +++ /dev/null @@ -1,121 +0,0 @@ -/* 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 deleted file mode 100644 index 953bfbb9..00000000 --- a/common/types/src/lcd/cosmos/crypto/keyring/v1/record.ts +++ /dev/null @@ -1,357 +0,0 @@ -/* 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 deleted file mode 100644 index 22f0af90..00000000 --- a/common/types/src/lcd/cosmos/crypto/multisig/keys.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* 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 deleted file mode 100644 index 5eeeef5a..00000000 --- a/common/types/src/lcd/cosmos/crypto/multisig/v1beta1/multisig.ts +++ /dev/null @@ -1,195 +0,0 @@ -/* 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 deleted file mode 100644 index 379a8913..00000000 --- a/common/types/src/lcd/cosmos/crypto/secp256k1/keys.ts +++ /dev/null @@ -1,175 +0,0 @@ -/* 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 deleted file mode 100644 index 25234f80..00000000 --- a/common/types/src/lcd/cosmos/crypto/secp256r1/keys.ts +++ /dev/null @@ -1,176 +0,0 @@ -/* 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 deleted file mode 100644 index 9bec5691..00000000 --- a/common/types/src/lcd/cosmos/distribution/v1beta1/distribution.ts +++ /dev/null @@ -1,926 +0,0 @@ -/* 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 deleted file mode 100644 index c07645dd..00000000 --- a/common/types/src/lcd/cosmos/distribution/v1beta1/genesis.ts +++ /dev/null @@ -1,822 +0,0 @@ -/* 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 deleted file mode 100644 index 50a90ca0..00000000 --- a/common/types/src/lcd/cosmos/distribution/v1beta1/query.ts +++ /dev/null @@ -1,1269 +0,0 @@ -/* 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 deleted file mode 100644 index 5232c4d1..00000000 --- a/common/types/src/lcd/cosmos/distribution/v1beta1/tx.ts +++ /dev/null @@ -1,550 +0,0 @@ -/* 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 deleted file mode 100644 index 8ea296ed..00000000 --- a/common/types/src/lcd/cosmos/evidence/v1beta1/evidence.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* 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 deleted file mode 100644 index 1c72de38..00000000 --- a/common/types/src/lcd/cosmos/evidence/v1beta1/genesis.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 deleted file mode 100644 index 00a3f793..00000000 --- a/common/types/src/lcd/cosmos/evidence/v1beta1/query.ts +++ /dev/null @@ -1,345 +0,0 @@ -/* 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 deleted file mode 100644 index 1901a2ee..00000000 --- a/common/types/src/lcd/cosmos/evidence/v1beta1/tx.ts +++ /dev/null @@ -1,215 +0,0 @@ -/* 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 deleted file mode 100644 index d10f8c3d..00000000 --- a/common/types/src/lcd/cosmos/feegrant/v1beta1/feegrant.ts +++ /dev/null @@ -1,405 +0,0 @@ -/* 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 deleted file mode 100644 index ff8d4af5..00000000 --- a/common/types/src/lcd/cosmos/feegrant/v1beta1/genesis.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* 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 deleted file mode 100644 index d848ef96..00000000 --- a/common/types/src/lcd/cosmos/feegrant/v1beta1/query.ts +++ /dev/null @@ -1,477 +0,0 @@ -/* 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 deleted file mode 100644 index 52ae7023..00000000 --- a/common/types/src/lcd/cosmos/feegrant/v1beta1/tx.ts +++ /dev/null @@ -1,296 +0,0 @@ -/* 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 deleted file mode 100644 index 1c42d365..00000000 --- a/common/types/src/lcd/cosmos/genutil/v1beta1/genesis.ts +++ /dev/null @@ -1,116 +0,0 @@ -/* 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 deleted file mode 100644 index 196797c7..00000000 --- a/common/types/src/lcd/cosmos/gov/v1/genesis.ts +++ /dev/null @@ -1,182 +0,0 @@ -/* 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 index cf919854..37847096 100644 --- a/common/types/src/lcd/cosmos/gov/v1/gov.ts +++ b/common/types/src/lcd/cosmos/gov/v1/gov.ts @@ -87,7 +87,7 @@ export function voteOptionToNumber(object: VoteOption): number { /** 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 defines the default proposal status. */ PROPOSAL_STATUS_UNSPECIFIED = "PROPOSAL_STATUS_UNSPECIFIED", /** * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit @@ -210,12 +210,14 @@ export interface Proposal { * 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; + final_tally_result?: TallyResult | undefined; + submit_time?: Date | undefined; + deposit_end_time?: Date | undefined; total_deposit: Coin[]; - voting_start_time?: Date; - voting_end_time?: Date; + voting_start_time?: Date | undefined; + voting_end_time?: + | Date + | undefined; /** metadata is any arbitrary metadata attached to the proposal. */ metadata: string; } @@ -248,13 +250,13 @@ export interface DepositParams { * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 * months. */ - max_deposit_period?: Duration; + max_deposit_period?: Duration | undefined; } /** VotingParams defines the params for voting on governance proposals. */ export interface VotingParams { /** Length of the voting period. */ - voting_period?: Duration; + voting_period?: Duration | undefined; } /** TallyParams defines the params for tallying votes on governance proposals. */ @@ -289,22 +291,31 @@ export const WeightedVoteOption = { }, decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.option = voteOptionFromJSON(reader.int32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.weight = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -312,17 +323,24 @@ export const WeightedVoteOption = { fromJSON(object: any): WeightedVoteOption { return { option: isSet(object.option) ? voteOptionFromJSON(object.option) : VoteOption.VOTE_OPTION_UNSPECIFIED, - weight: isSet(object.weight) ? String(object.weight) : "", + weight: isSet(object.weight) ? globalThis.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); + if (message.option !== VoteOption.VOTE_OPTION_UNSPECIFIED) { + obj.option = voteOptionToJSON(message.option); + } + if (message.weight !== "") { + obj.weight = message.weight; + } return obj; }, + create, I>>(base?: I): WeightedVoteOption { + return WeightedVoteOption.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): WeightedVoteOption { const message = createBaseWeightedVoteOption(); message.option = object.option ?? VoteOption.VOTE_OPTION_UNSPECIFIED; @@ -350,49 +368,67 @@ export const Deposit = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Deposit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.depositor = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.amount.push(Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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)) : [], + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + amount: globalThis.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 = []; + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); } return obj; }, + create, I>>(base?: I): Deposit { + return Deposit.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Deposit { const message = createBaseDeposit(); message.proposal_id = object.proposal_id ?? "0"; @@ -453,93 +489,148 @@ export const Proposal = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.messages.push(Any.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.status = proposalStatusFromJSON(reader.int32()); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.final_tally_result = TallyResult.decode(reader, reader.uint32()); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.deposit_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.total_deposit.push(Coin.decode(reader, reader.uint32())); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.voting_start_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; + continue; case 9: + if (tag !== 74) { + break; + } + message.voting_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; + continue; case 10: + if (tag !== 82) { + break; + } + message.metadata = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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)) : [], + id: isSet(object.id) ? globalThis.String(object.id) : "0", + messages: globalThis.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)) : [], + total_deposit: globalThis.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) : "", + metadata: isSet(object.metadata) ? globalThis.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); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.status !== ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.final_tally_result !== undefined) { + obj.final_tally_result = TallyResult.toJSON(message.final_tally_result); + } + if (message.submit_time !== undefined) { + obj.submit_time = message.submit_time.toISOString(); + } + if (message.deposit_end_time !== undefined) { + obj.deposit_end_time = message.deposit_end_time.toISOString(); + } + if (message.total_deposit?.length) { + obj.total_deposit = message.total_deposit.map((e) => Coin.toJSON(e)); + } + if (message.voting_start_time !== undefined) { + obj.voting_start_time = message.voting_start_time.toISOString(); + } + if (message.voting_end_time !== undefined) { + obj.voting_end_time = message.voting_end_time.toISOString(); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } return obj; }, + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Proposal { const message = createBaseProposal(); message.id = object.id ?? "0"; @@ -580,50 +671,78 @@ export const TallyResult = { }, decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.yes_count = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.abstain_count = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.no_count = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.no_with_veto_count = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + yes_count: isSet(object.yes_count) ? globalThis.String(object.yes_count) : "", + abstain_count: isSet(object.abstain_count) ? globalThis.String(object.abstain_count) : "", + no_count: isSet(object.no_count) ? globalThis.String(object.no_count) : "", + no_with_veto_count: isSet(object.no_with_veto_count) ? globalThis.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); + if (message.yes_count !== "") { + obj.yes_count = message.yes_count; + } + if (message.abstain_count !== "") { + obj.abstain_count = message.abstain_count; + } + if (message.no_count !== "") { + obj.no_count = message.no_count; + } + if (message.no_with_veto_count !== "") { + obj.no_with_veto_count = message.no_with_veto_count; + } return obj; }, + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): TallyResult { const message = createBaseTallyResult(); message.yes_count = object.yes_count ?? ""; @@ -656,54 +775,80 @@ export const Vote = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Vote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.voter = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.metadata = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } return obj; }, + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Vote { const message = createBaseVote(); message.proposal_id = object.proposal_id ?? "0"; @@ -730,45 +875,58 @@ export const DepositParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.min_deposit.push(Coin.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.max_deposit_period = Duration.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): DepositParams { return { - min_deposit: Array.isArray(object?.min_deposit) ? object.min_deposit.map((e: any) => Coin.fromJSON(e)) : [], + min_deposit: globalThis.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 = []; + if (message.min_deposit?.length) { + obj.min_deposit = message.min_deposit.map((e) => Coin.toJSON(e)); + } + if (message.max_deposit_period !== undefined) { + obj.max_deposit_period = Duration.toJSON(message.max_deposit_period); } - message.max_deposit_period !== undefined && - (obj.max_deposit_period = message.max_deposit_period ? Duration.toJSON(message.max_deposit_period) : undefined); return obj; }, + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DepositParams { const message = createBaseDepositParams(); message.min_deposit = object.min_deposit?.map((e) => Coin.fromPartial(e)) || []; @@ -792,19 +950,24 @@ export const VotingParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.voting_period = Duration.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -815,11 +978,15 @@ export const VotingParams = { toJSON(message: VotingParams): unknown { const obj: any = {}; - message.voting_period !== undefined && - (obj.voting_period = message.voting_period ? Duration.toJSON(message.voting_period) : undefined); + if (message.voting_period !== undefined) { + obj.voting_period = Duration.toJSON(message.voting_period); + } return obj; }, + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): VotingParams { const message = createBaseVotingParams(); message.voting_period = (object.voting_period !== undefined && object.voting_period !== null) @@ -848,45 +1015,67 @@ export const TallyParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.quorum = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.threshold = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.veto_threshold = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + quorum: isSet(object.quorum) ? globalThis.String(object.quorum) : "", + threshold: isSet(object.threshold) ? globalThis.String(object.threshold) : "", + veto_threshold: isSet(object.veto_threshold) ? globalThis.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); + if (message.quorum !== "") { + obj.quorum = message.quorum; + } + if (message.threshold !== "") { + obj.threshold = message.threshold; + } + if (message.veto_threshold !== "") { + obj.veto_threshold = message.veto_threshold; + } return obj; }, + create, I>>(base?: I): TallyParams { + return TallyParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): TallyParams { const message = createBaseTallyParams(); message.quorum = object.quorum ?? ""; @@ -899,7 +1088,8 @@ export const TallyParams = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; @@ -914,16 +1104,16 @@ function toTimestamp(date: Date): Timestamp { } function fromTimestamp(t: Timestamp): Date { - let millis = Number(t.seconds) * 1_000; - millis += t.nanos / 1_000_000; - return new Date(millis); + let millis = (globalThis.Number(t.seconds) || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); } function fromJsonTimestamp(o: any): Date { - if (o instanceof Date) { + if (o instanceof globalThis.Date) { return o; } else if (typeof o === "string") { - return new Date(o); + return new globalThis.Date(o); } else { return fromTimestamp(Timestamp.fromJSON(o)); } diff --git a/common/types/src/lcd/cosmos/gov/v1/query.ts b/common/types/src/lcd/cosmos/gov/v1/query.ts index e130da7a..9fc750d0 100644 --- a/common/types/src/lcd/cosmos/gov/v1/query.ts +++ b/common/types/src/lcd/cosmos/gov/v1/query.ts @@ -28,7 +28,7 @@ export interface QueryProposalRequest { /** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ export interface QueryProposalResponse { - proposal?: Proposal; + proposal?: Proposal | undefined; } /** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ @@ -40,7 +40,7 @@ export interface QueryProposalsRequest { /** depositor defines the deposit addresses from the proposals. */ depositor: string; /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: PageRequest | undefined; } /** @@ -50,21 +50,21 @@ export interface QueryProposalsRequest { export interface QueryProposalsResponse { proposals: Proposal[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** 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 defines the voter 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; + vote?: Vote | undefined; } /** QueryVotesRequest is the request type for the Query/Votes RPC method. */ @@ -72,7 +72,7 @@ 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; + pagination?: PageRequest | undefined; } /** QueryVotesResponse is the response type for the Query/Votes RPC method. */ @@ -80,7 +80,7 @@ export interface QueryVotesResponse { /** votes defined the queried votes. */ votes: Vote[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ @@ -95,11 +95,15 @@ export interface QueryParamsRequest { /** 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; + voting_params?: + | VotingParams + | undefined; /** deposit_params defines the parameters related to deposit. */ - deposit_params?: DepositParams; + deposit_params?: + | DepositParams + | undefined; /** tally_params defines the parameters related to tally. */ - tally_params?: TallyParams; + tally_params?: TallyParams | undefined; } /** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ @@ -113,7 +117,7 @@ export interface QueryDepositRequest { /** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ export interface QueryDepositResponse { /** deposit defines the requested deposit. */ - deposit?: Deposit; + deposit?: Deposit | undefined; } /** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ @@ -121,14 +125,14 @@ 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; + pagination?: PageRequest | undefined; } /** 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; + pagination?: PageResponse | undefined; } /** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ @@ -140,7 +144,7 @@ export interface QueryTallyResultRequest { /** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ export interface QueryTallyResultResponse { /** tally defines the requested tally. */ - tally?: TallyResult; + tally?: TallyResult | undefined; } function createBaseQueryProposalRequest(): QueryProposalRequest { @@ -156,33 +160,43 @@ export const QueryProposalRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryProposalRequest { - return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + return { proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0" }; }, toJSON(message: QueryProposalRequest): unknown { const obj: any = {}; - message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } return obj; }, + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryProposalRequest { const message = createBaseQueryProposalRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -203,19 +217,24 @@ export const QueryProposalResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.proposal = Proposal.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -226,10 +245,15 @@ export const QueryProposalResponse = { toJSON(message: QueryProposalResponse): unknown { const obj: any = {}; - message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); + if (message.proposal !== undefined) { + obj.proposal = Proposal.toJSON(message.proposal); + } return obj; }, + create, I>>(base?: I): QueryProposalResponse { + return QueryProposalResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryProposalResponse { const message = createBaseQueryProposalResponse(); message.proposal = (object.proposal !== undefined && object.proposal !== null) @@ -266,28 +290,45 @@ export const QueryProposalsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_status = proposalStatusFromJSON(reader.int32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.voter = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.depositor = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -297,22 +338,32 @@ export const QueryProposalsRequest = { 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) : "", + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + depositor: isSet(object.depositor) ? globalThis.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); + if (message.proposal_status !== ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED) { + obj.proposal_status = proposalStatusToJSON(message.proposal_status); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryProposalsRequest { + return QueryProposalsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); message.proposal_status = object.proposal_status ?? ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; @@ -341,45 +392,58 @@ export const QueryProposalsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryProposalsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.proposals.push(Proposal.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryProposalsResponse { return { - proposals: Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + proposals: globalThis.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 = []; + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryProposalsResponse { + return QueryProposalsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryProposalsResponse { const message = createBaseQueryProposalsResponse(); message.proposals = object.proposals?.map((e) => Proposal.fromPartial(e)) || []; @@ -406,40 +470,56 @@ export const QueryVoteRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.voter = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + voter: isSet(object.voter) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.voter !== "") { + obj.voter = message.voter; + } return obj; }, + create, I>>(base?: I): QueryVoteRequest { + return QueryVoteRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVoteRequest { const message = createBaseQueryVoteRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -461,19 +541,24 @@ export const QueryVoteResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.vote = Vote.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -484,10 +569,15 @@ export const QueryVoteResponse = { toJSON(message: QueryVoteResponse): unknown { const obj: any = {}; - message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); + if (message.vote !== undefined) { + obj.vote = Vote.toJSON(message.vote); + } return obj; }, + create, I>>(base?: I): QueryVoteResponse { + return QueryVoteResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVoteResponse { const message = createBaseQueryVoteResponse(); message.vote = (object.vote !== undefined && object.vote !== null) ? Vote.fromPartial(object.vote) : undefined; @@ -511,41 +601,56 @@ export const QueryVotesRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryVotesRequest { return { - proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + proposal_id: isSet(object.proposal_id) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryVotesRequest { + return QueryVotesRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVotesRequest { const message = createBaseQueryVotesRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -572,45 +677,56 @@ export const QueryVotesResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.votes.push(Vote.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryVotesResponse { return { - votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + votes: globalThis.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 = []; + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryVotesResponse { + return QueryVotesResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVotesResponse { const message = createBaseQueryVotesResponse(); message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; @@ -634,33 +750,43 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params_type = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryParamsRequest { - return { params_type: isSet(object.params_type) ? String(object.params_type) : "" }; + return { params_type: isSet(object.params_type) ? globalThis.String(object.params_type) : "" }; }, toJSON(message: QueryParamsRequest): unknown { const obj: any = {}; - message.params_type !== undefined && (obj.params_type = message.params_type); + if (message.params_type !== "") { + obj.params_type = message.params_type; + } return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); message.params_type = object.params_type ?? ""; @@ -687,25 +813,38 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.voting_params = VotingParams.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.deposit_params = DepositParams.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.tally_params = TallyParams.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -720,15 +859,21 @@ export const QueryParamsResponse = { 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); + if (message.voting_params !== undefined) { + obj.voting_params = VotingParams.toJSON(message.voting_params); + } + if (message.deposit_params !== undefined) { + obj.deposit_params = DepositParams.toJSON(message.deposit_params); + } + if (message.tally_params !== undefined) { + obj.tally_params = TallyParams.toJSON(message.tally_params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.voting_params = (object.voting_params !== undefined && object.voting_params !== null) @@ -760,40 +905,56 @@ export const QueryDepositRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.depositor = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } return obj; }, + create, I>>(base?: I): QueryDepositRequest { + return QueryDepositRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDepositRequest { const message = createBaseQueryDepositRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -815,19 +976,24 @@ export const QueryDepositResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.deposit = Deposit.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -838,10 +1004,15 @@ export const QueryDepositResponse = { toJSON(message: QueryDepositResponse): unknown { const obj: any = {}; - message.deposit !== undefined && (obj.deposit = message.deposit ? Deposit.toJSON(message.deposit) : undefined); + if (message.deposit !== undefined) { + obj.deposit = Deposit.toJSON(message.deposit); + } return obj; }, + create, I>>(base?: I): QueryDepositResponse { + return QueryDepositResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDepositResponse { const message = createBaseQueryDepositResponse(); message.deposit = (object.deposit !== undefined && object.deposit !== null) @@ -867,41 +1038,56 @@ export const QueryDepositsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryDepositsRequest { return { - proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0", + proposal_id: isSet(object.proposal_id) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryDepositsRequest { + return QueryDepositsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDepositsRequest { const message = createBaseQueryDepositsRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -928,45 +1114,56 @@ export const QueryDepositsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.deposits.push(Deposit.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryDepositsResponse { return { - deposits: Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + deposits: globalThis.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 = []; + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryDepositsResponse { + return QueryDepositsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDepositsResponse { const message = createBaseQueryDepositsResponse(); message.deposits = object.deposits?.map((e) => Deposit.fromPartial(e)) || []; @@ -990,33 +1187,43 @@ export const QueryTallyResultRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTallyResultRequest { - return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + return { proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0" }; }, toJSON(message: QueryTallyResultRequest): unknown { const obj: any = {}; - message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } return obj; }, + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryTallyResultRequest { const message = createBaseQueryTallyResultRequest(); message.proposal_id = object.proposal_id ?? "0"; @@ -1037,19 +1244,24 @@ export const QueryTallyResultResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTallyResultResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.tally = TallyResult.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -1060,10 +1272,15 @@ export const QueryTallyResultResponse = { toJSON(message: QueryTallyResultResponse): unknown { const obj: any = {}; - message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); + if (message.tally !== undefined) { + obj.tally = TallyResult.toJSON(message.tally); + } return obj; }, + create, I>>(base?: I): QueryTallyResultResponse { + return QueryTallyResultResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryTallyResultResponse { const message = createBaseQueryTallyResultResponse(); message.tally = (object.tally !== undefined && object.tally !== null) @@ -1093,11 +1310,12 @@ export interface Query { TallyResult(request: QueryTallyResultRequest): Promise; } +export const QueryServiceName = "cosmos.gov.v1.Query"; 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.service = opts?.service || QueryServiceName; this.rpc = rpc; this.Proposal = this.Proposal.bind(this); this.Proposals = this.Proposals.bind(this); @@ -1111,49 +1329,49 @@ export class QueryClientImpl implements Query { 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))); + return promise.then((data) => QueryProposalResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryProposalsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryVoteResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryVotesResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryDepositResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryDepositsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryTallyResultResponse.decode(_m0.Reader.create(data))); } } @@ -1164,7 +1382,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/cosmos/gov/v1/tx.ts b/common/types/src/lcd/cosmos/gov/v1/tx.ts index d4ff3aeb..46d5d5cd 100644 --- a/common/types/src/lcd/cosmos/gov/v1/tx.ts +++ b/common/types/src/lcd/cosmos/gov/v1/tx.ts @@ -32,7 +32,9 @@ export interface MsgSubmitProposalResponse { */ export interface MsgExecLegacyContent { /** content is the proposal's content. */ - content?: Any; + content?: + | Any + | undefined; /** authority must be the gov module address. */ authority: string; } @@ -98,60 +100,80 @@ export const MsgSubmitProposal = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.messages.push(Any.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.initial_deposit.push(Coin.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.proposer = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.metadata = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + initial_deposit: globalThis.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) : "", + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + metadata: isSet(object.metadata) ? globalThis.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); + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.initial_deposit?.length) { + obj.initial_deposit = message.initial_deposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } return obj; }, + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; @@ -175,33 +197,43 @@ export const MsgSubmitProposalResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgSubmitProposalResponse { - return { proposal_id: isSet(object.proposal_id) ? String(object.proposal_id) : "0" }; + return { proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0" }; }, toJSON(message: MsgSubmitProposalResponse): unknown { const obj: any = {}; - message.proposal_id !== undefined && (obj.proposal_id = message.proposal_id); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } return obj; }, + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgSubmitProposalResponse { const message = createBaseMsgSubmitProposalResponse(); message.proposal_id = object.proposal_id ?? "0"; @@ -225,22 +257,31 @@ export const MsgExecLegacyContent = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecLegacyContent { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.content = Any.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.authority = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -248,17 +289,24 @@ export const MsgExecLegacyContent = { fromJSON(object: any): MsgExecLegacyContent { return { content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, - authority: isSet(object.authority) ? String(object.authority) : "", + authority: isSet(object.authority) ? globalThis.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); + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.authority !== "") { + obj.authority = message.authority; + } return obj; }, + create, I>>(base?: I): MsgExecLegacyContent { + return MsgExecLegacyContent.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgExecLegacyContent { const message = createBaseMsgExecLegacyContent(); message.content = (object.content !== undefined && object.content !== null) @@ -279,16 +327,17 @@ export const MsgExecLegacyContentResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecLegacyContentResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -302,6 +351,9 @@ export const MsgExecLegacyContentResponse = { return obj; }, + create, I>>(base?: I): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgExecLegacyContentResponse { const message = createBaseMsgExecLegacyContentResponse(); return message; @@ -330,50 +382,78 @@ export const MsgVote = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.voter = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.option = voteOptionFromJSON(reader.int32()); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.metadata = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", option: isSet(object.option) ? voteOptionFromJSON(object.option) : VoteOption.VOTE_OPTION_UNSPECIFIED, - metadata: isSet(object.metadata) ? String(object.metadata) : "", + metadata: isSet(object.metadata) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== VoteOption.VOTE_OPTION_UNSPECIFIED) { + obj.option = voteOptionToJSON(message.option); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } return obj; }, + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgVote { const message = createBaseMsgVote(); message.proposal_id = object.proposal_id ?? "0"; @@ -394,16 +474,17 @@ export const MsgVoteResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -417,6 +498,9 @@ export const MsgVoteResponse = { return obj; }, + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgVoteResponse { const message = createBaseMsgVoteResponse(); return message; @@ -445,54 +529,80 @@ export const MsgVoteWeighted = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeighted { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.voter = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.metadata = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? globalThis.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); + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } return obj; }, + create, I>>(base?: I): MsgVoteWeighted { + return MsgVoteWeighted.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgVoteWeighted { const message = createBaseMsgVoteWeighted(); message.proposal_id = object.proposal_id ?? "0"; @@ -513,16 +623,17 @@ export const MsgVoteWeightedResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeightedResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -536,6 +647,9 @@ export const MsgVoteWeightedResponse = { return obj; }, + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgVoteWeightedResponse { const message = createBaseMsgVoteWeightedResponse(); return message; @@ -561,49 +675,67 @@ export const MsgDeposit = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeposit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.proposal_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.depositor = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.amount.push(Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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)) : [], + proposal_id: isSet(object.proposal_id) ? globalThis.String(object.proposal_id) : "0", + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + amount: globalThis.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 = []; + if (message.proposal_id !== "0") { + obj.proposal_id = message.proposal_id; + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); } return obj; }, + create, I>>(base?: I): MsgDeposit { + return MsgDeposit.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgDeposit { const message = createBaseMsgDeposit(); message.proposal_id = object.proposal_id ?? "0"; @@ -623,16 +755,17 @@ export const MsgDepositResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -646,6 +779,9 @@ export const MsgDepositResponse = { return obj; }, + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgDepositResponse { const message = createBaseMsgDepositResponse(); return message; @@ -669,11 +805,12 @@ export interface Msg { Deposit(request: MsgDeposit): Promise; } +export const MsgServiceName = "cosmos.gov.v1.Msg"; 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.service = opts?.service || MsgServiceName; this.rpc = rpc; this.SubmitProposal = this.SubmitProposal.bind(this); this.ExecLegacyContent = this.ExecLegacyContent.bind(this); @@ -684,31 +821,31 @@ export class MsgClientImpl implements Msg { 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))); + return promise.then((data) => MsgSubmitProposalResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgExecLegacyContentResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgVoteResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgVoteWeightedResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgDepositResponse.decode(_m0.Reader.create(data))); } } @@ -719,7 +856,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/cosmos/gov/v1beta1/genesis.ts b/common/types/src/lcd/cosmos/gov/v1beta1/genesis.ts deleted file mode 100644 index 8ef52afc..00000000 --- a/common/types/src/lcd/cosmos/gov/v1beta1/genesis.ts +++ /dev/null @@ -1,180 +0,0 @@ -/* 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 deleted file mode 100644 index add603cb..00000000 --- a/common/types/src/lcd/cosmos/gov/v1beta1/gov.ts +++ /dev/null @@ -1,1054 +0,0 @@ -/* 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 deleted file mode 100644 index 5b2ac2a5..00000000 --- a/common/types/src/lcd/cosmos/gov/v1beta1/query.ts +++ /dev/null @@ -1,1184 +0,0 @@ -/* 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 deleted file mode 100644 index 44101be2..00000000 --- a/common/types/src/lcd/cosmos/gov/v1beta1/tx.ts +++ /dev/null @@ -1,592 +0,0 @@ -/* 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 deleted file mode 100644 index cb80cf9c..00000000 --- a/common/types/src/lcd/cosmos/group/v1/events.ts +++ /dev/null @@ -1,540 +0,0 @@ -/* 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 deleted file mode 100644 index d9da567e..00000000 --- a/common/types/src/lcd/cosmos/group/v1/genesis.ts +++ /dev/null @@ -1,204 +0,0 @@ -/* 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 deleted file mode 100644 index a8c76c01..00000000 --- a/common/types/src/lcd/cosmos/group/v1/query.ts +++ /dev/null @@ -1,1869 +0,0 @@ -/* 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 deleted file mode 100644 index 2eb9ea22..00000000 --- a/common/types/src/lcd/cosmos/group/v1/tx.ts +++ /dev/null @@ -1,2088 +0,0 @@ -/* 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 deleted file mode 100644 index be385da8..00000000 --- a/common/types/src/lcd/cosmos/group/v1/types.ts +++ /dev/null @@ -1,1470 +0,0 @@ -/* 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 deleted file mode 100644 index b1725bfe..00000000 --- a/common/types/src/lcd/cosmos/mint/v1beta1/genesis.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* 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 deleted file mode 100644 index 2606feac..00000000 --- a/common/types/src/lcd/cosmos/mint/v1beta1/mint.ts +++ /dev/null @@ -1,212 +0,0 @@ -/* 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 deleted file mode 100644 index 20642bf4..00000000 --- a/common/types/src/lcd/cosmos/mint/v1beta1/query.ts +++ /dev/null @@ -1,414 +0,0 @@ -/* 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/nft/v1beta1/event.ts b/common/types/src/lcd/cosmos/nft/v1beta1/event.ts deleted file mode 100644 index ce6086aa..00000000 --- a/common/types/src/lcd/cosmos/nft/v1beta1/event.ts +++ /dev/null @@ -1,251 +0,0 @@ -/* 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 deleted file mode 100644 index 6257458c..00000000 --- a/common/types/src/lcd/cosmos/nft/v1beta1/genesis.ts +++ /dev/null @@ -1,163 +0,0 @@ -/* 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 deleted file mode 100644 index d98d6e78..00000000 --- a/common/types/src/lcd/cosmos/nft/v1beta1/nft.ts +++ /dev/null @@ -1,240 +0,0 @@ -/* 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 deleted file mode 100644 index 53e32d15..00000000 --- a/common/types/src/lcd/cosmos/nft/v1beta1/query.ts +++ /dev/null @@ -1,944 +0,0 @@ -/* 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 deleted file mode 100644 index e0a8855a..00000000 --- a/common/types/src/lcd/cosmos/nft/v1beta1/tx.ts +++ /dev/null @@ -1,175 +0,0 @@ -/* 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 deleted file mode 100644 index 512affa0..00000000 --- a/common/types/src/lcd/cosmos/orm/v1/orm.ts +++ /dev/null @@ -1,356 +0,0 @@ -/* 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 deleted file mode 100644 index f316cdc5..00000000 --- a/common/types/src/lcd/cosmos/orm/v1alpha1/schema.ts +++ /dev/null @@ -1,334 +0,0 @@ -/* 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 deleted file mode 100644 index ebcaa371..00000000 --- a/common/types/src/lcd/cosmos/params/v1beta1/params.ts +++ /dev/null @@ -1,174 +0,0 @@ -/* 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 deleted file mode 100644 index f70bdfcc..00000000 --- a/common/types/src/lcd/cosmos/params/v1beta1/query.ts +++ /dev/null @@ -1,356 +0,0 @@ -/* 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 deleted file mode 100644 index 01f795e0..00000000 --- a/common/types/src/lcd/cosmos/slashing/v1beta1/genesis.ts +++ /dev/null @@ -1,341 +0,0 @@ -/* 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 deleted file mode 100644 index 5150df45..00000000 --- a/common/types/src/lcd/cosmos/slashing/v1beta1/query.ts +++ /dev/null @@ -1,414 +0,0 @@ -/* 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 deleted file mode 100644 index 6f15c86e..00000000 --- a/common/types/src/lcd/cosmos/slashing/v1beta1/slashing.ts +++ /dev/null @@ -1,348 +0,0 @@ -/* 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 deleted file mode 100644 index 54d56e48..00000000 --- a/common/types/src/lcd/cosmos/slashing/v1beta1/tx.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* 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 deleted file mode 100644 index 9c1ff92f..00000000 --- a/common/types/src/lcd/cosmos/staking/v1beta1/authz.ts +++ /dev/null @@ -1,267 +0,0 @@ -/* 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 deleted file mode 100644 index e4bad586..00000000 --- a/common/types/src/lcd/cosmos/staking/v1beta1/genesis.ts +++ /dev/null @@ -1,321 +0,0 @@ -/* 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 deleted file mode 100644 index d0d16cfe..00000000 --- a/common/types/src/lcd/cosmos/staking/v1beta1/query.ts +++ /dev/null @@ -1,2090 +0,0 @@ -/* 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 deleted file mode 100644 index d5851fce..00000000 --- a/common/types/src/lcd/cosmos/staking/v1beta1/staking.ts +++ /dev/null @@ -1,1803 +0,0 @@ -/* 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 deleted file mode 100644 index b38c9f5c..00000000 --- a/common/types/src/lcd/cosmos/staking/v1beta1/tx.ts +++ /dev/null @@ -1,818 +0,0 @@ -/* 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 deleted file mode 100644 index 58a93851..00000000 --- a/common/types/src/lcd/cosmos/tx/signing/v1beta1/signing.ts +++ /dev/null @@ -1,550 +0,0 @@ -/* 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 deleted file mode 100644 index d6658719..00000000 --- a/common/types/src/lcd/cosmos/tx/v1beta1/service.ts +++ /dev/null @@ -1,1032 +0,0 @@ -/* 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 deleted file mode 100644 index 43a6358a..00000000 --- a/common/types/src/lcd/cosmos/tx/v1beta1/tx.ts +++ /dev/null @@ -1,1338 +0,0 @@ -/* 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 deleted file mode 100644 index 108af104..00000000 --- a/common/types/src/lcd/cosmos/upgrade/v1beta1/query.ts +++ /dev/null @@ -1,723 +0,0 @@ -/* 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 deleted file mode 100644 index 0504de6b..00000000 --- a/common/types/src/lcd/cosmos/upgrade/v1beta1/tx.ts +++ /dev/null @@ -1,284 +0,0 @@ -/* 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 deleted file mode 100644 index db2b9503..00000000 --- a/common/types/src/lcd/cosmos/upgrade/v1beta1/upgrade.ts +++ /dev/null @@ -1,410 +0,0 @@ -/* 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 deleted file mode 100644 index c3fad147..00000000 --- a/common/types/src/lcd/cosmos/vesting/v1beta1/tx.ts +++ /dev/null @@ -1,506 +0,0 @@ -/* 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 deleted file mode 100644 index bf2ce510..00000000 --- a/common/types/src/lcd/cosmos/vesting/v1beta1/vesting.ts +++ /dev/null @@ -1,509 +0,0 @@ -/* 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 index 8287baac..d40e6d68 100644 --- a/common/types/src/lcd/cosmos_proto/cosmos.ts +++ b/common/types/src/lcd/cosmos_proto/cosmos.ts @@ -123,40 +123,56 @@ export const InterfaceDescriptor = { }, decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.name = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.description = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): InterfaceDescriptor { return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", }; }, toJSON(message: InterfaceDescriptor): unknown { const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.description !== undefined && (obj.description = message.description); + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } return obj; }, + create, I>>(base?: I): InterfaceDescriptor { + return InterfaceDescriptor.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): InterfaceDescriptor { const message = createBaseInterfaceDescriptor(); message.name = object.name ?? ""; @@ -186,56 +202,79 @@ export const ScalarDescriptor = { }, decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.name = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.description = reader.string(); - break; + continue; case 3: - if ((tag & 7) === 2) { + if (tag === 24) { + message.field_type.push(scalarTypeFromJSON(reader.int32())); + + continue; + } + + if (tag === 26) { 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())); + + continue; } - break; - default: - reader.skipType(tag & 7); + break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + field_type: globalThis.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) { + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.field_type?.length) { obj.field_type = message.field_type.map((e) => scalarTypeToJSON(e)); - } else { - obj.field_type = []; } return obj; }, + create, I>>(base?: I): ScalarDescriptor { + return ScalarDescriptor.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): ScalarDescriptor { const message = createBaseScalarDescriptor(); message.name = object.name ?? ""; @@ -248,7 +287,8 @@ export const ScalarDescriptor = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/google/api/http.ts b/common/types/src/lcd/google/api/http.ts index 39f35c73..18b91749 100644 --- a/common/types/src/lcd/google/api/http.ts +++ b/common/types/src/lcd/google/api/http.ts @@ -195,15 +195,18 @@ export interface Http { * 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 + * - 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 + * 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 + * 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 @@ -300,7 +303,8 @@ export interface HttpRule { /** * Selects a method to which this rule applies. * - * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. */ selector: string; /** @@ -385,47 +389,58 @@ export const Http = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.rules.push(HttpRule.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.fully_decode_reserved_expansion = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Http { return { - rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], + rules: globalThis.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) + ? globalThis.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 = []; + if (message.rules?.length) { + obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); + } + if (message.fully_decode_reserved_expansion === true) { + obj.fully_decode_reserved_expansion = message.fully_decode_reserved_expansion; } - message.fully_decode_reserved_expansion !== undefined && - (obj.fully_decode_reserved_expansion = message.fully_decode_reserved_expansion); return obj; }, + create, I>>(base?: I): Http { + return Http.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Http { const message = createBaseHttp(); message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; @@ -485,62 +500,103 @@ export const HttpRule = { }, decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.selector = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.get = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.put = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.post = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.delete = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.patch = reader.string(); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.body = reader.string(); - break; + continue; case 12: + if (tag !== 98) { + break; + } + message.response_body = reader.string(); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.additional_bindings.push(HttpRule.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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, + selector: isSet(object.selector) ? globalThis.String(object.selector) : "", + get: isSet(object.get) ? globalThis.String(object.get) : undefined, + put: isSet(object.put) ? globalThis.String(object.put) : undefined, + post: isSet(object.post) ? globalThis.String(object.post) : undefined, + delete: isSet(object.delete) ? globalThis.String(object.delete) : undefined, + patch: isSet(object.patch) ? globalThis.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) + body: isSet(object.body) ? globalThis.String(object.body) : "", + response_body: isSet(object.response_body) ? globalThis.String(object.response_body) : "", + additional_bindings: globalThis.Array.isArray(object?.additional_bindings) ? object.additional_bindings.map((e: any) => HttpRule.fromJSON(e)) : [], }; @@ -548,24 +604,42 @@ export const HttpRule = { 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 = []; + if (message.selector !== "") { + obj.selector = message.selector; + } + if (message.get !== undefined) { + obj.get = message.get; + } + if (message.put !== undefined) { + obj.put = message.put; + } + if (message.post !== undefined) { + obj.post = message.post; + } + if (message.delete !== undefined) { + obj.delete = message.delete; + } + if (message.patch !== undefined) { + obj.patch = message.patch; + } + if (message.custom !== undefined) { + obj.custom = CustomHttpPattern.toJSON(message.custom); + } + if (message.body !== "") { + obj.body = message.body; + } + if (message.response_body !== "") { + obj.response_body = message.response_body; + } + if (message.additional_bindings?.length) { + obj.additional_bindings = message.additional_bindings.map((e) => HttpRule.toJSON(e)); } return obj; }, + create, I>>(base?: I): HttpRule { + return HttpRule.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): HttpRule { const message = createBaseHttpRule(); message.selector = object.selector ?? ""; @@ -600,37 +674,56 @@ export const CustomHttpPattern = { }, decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.kind = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.path = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): CustomHttpPattern { - return { kind: isSet(object.kind) ? String(object.kind) : "", path: isSet(object.path) ? String(object.path) : "" }; + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + path: isSet(object.path) ? globalThis.String(object.path) : "", + }; }, toJSON(message: CustomHttpPattern): unknown { const obj: any = {}; - message.kind !== undefined && (obj.kind = message.kind); - message.path !== undefined && (obj.path = message.path); + if (message.kind !== "") { + obj.kind = message.kind; + } + if (message.path !== "") { + obj.path = message.path; + } return obj; }, + create, I>>(base?: I): CustomHttpPattern { + return CustomHttpPattern.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): CustomHttpPattern { const message = createBaseCustomHttpPattern(); message.kind = object.kind ?? ""; @@ -642,7 +735,8 @@ export const CustomHttpPattern = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/google/protobuf/any.ts b/common/types/src/lcd/google/protobuf/any.ts index 38da266b..f95d4dd7 100644 --- a/common/types/src/lcd/google/protobuf/any.ts +++ b/common/types/src/lcd/google/protobuf/any.ts @@ -28,8 +28,12 @@ export const protobufPackage = "google.protobuf"; * if (any.is(Foo.class)) { * foo = any.unpack(Foo.class); * } + * // or ... + * if (any.isSameTypeAs(Foo.getDefaultInstance())) { + * foo = any.unpack(Foo.getDefaultInstance()); + * } * - * Example 3: Pack and unpack a message in Python. + * Example 3: Pack and unpack a message in Python. * * foo = Foo(...) * any = Any() @@ -39,13 +43,16 @@ export const protobufPackage = "google.protobuf"; * any.Unpack(foo) * ... * - * Example 4: Pack and unpack a message in Go + * Example 4: Pack and unpack a message in Go * * foo := &pb.Foo{...} - * any, err := ptypes.MarshalAny(foo) + * any, err := anypb.New(foo) + * if err != nil { + * ... + * } * ... * foo := &pb.Foo{} - * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * if err := any.UnmarshalTo(foo); err != nil { * ... * } * @@ -56,7 +63,7 @@ export const protobufPackage = "google.protobuf"; * 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: @@ -119,7 +126,7 @@ export interface Any { } function createBaseAny(): Any { - return { type_url: "", value: new Uint8Array() }; + return { type_url: "", value: new Uint8Array(0) }; } export const Any = { @@ -134,68 +141,64 @@ export const Any = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Any { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.type_url = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.value = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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(), + type_url: isSet(object.type_url) ? globalThis.String(object.type_url) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), }; }, 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())); + if (message.type_url !== "") { + obj.type_url = message.type_url; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } return obj; }, + create, I>>(base?: I): Any { + return Any.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Any { const message = createBaseAny(); message.type_url = object.type_url ?? ""; - message.value = object.value ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(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")); @@ -215,7 +218,7 @@ function base64FromBytes(arr: Uint8Array): string { } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); return globalThis.btoa(bin.join("")); } @@ -224,7 +227,8 @@ function base64FromBytes(arr: Uint8Array): string { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/google/protobuf/descriptor.ts b/common/types/src/lcd/google/protobuf/descriptor.ts deleted file mode 100644 index 21db3717..00000000 --- a/common/types/src/lcd/google/protobuf/descriptor.ts +++ /dev/null @@ -1,3844 +0,0 @@ -/* 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 index 8ea1d106..00080d2e 100644 --- a/common/types/src/lcd/google/protobuf/duration.ts +++ b/common/types/src/lcd/google/protobuf/duration.ts @@ -26,7 +26,7 @@ export const protobufPackage = "google.protobuf"; * if (duration.seconds < 0 && duration.nanos > 0) { * duration.seconds += 1; * duration.nanos -= 1000000000; - * } else if (durations.seconds > 0 && duration.nanos < 0) { + * } else if (duration.seconds > 0 && duration.nanos < 0) { * duration.seconds -= 1; * duration.nanos += 1000000000; * } @@ -98,40 +98,56 @@ export const Duration = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Duration { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.seconds = longToString(reader.int64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Duration { return { - seconds: isSet(object.seconds) ? String(object.seconds) : "0", - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.String(object.seconds) : "0", + nanos: isSet(object.nanos) ? globalThis.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)); + if (message.seconds !== "0") { + obj.seconds = message.seconds; + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } return obj; }, + create, I>>(base?: I): Duration { + return Duration.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Duration { const message = createBaseDuration(); message.seconds = object.seconds ?? "0"; @@ -143,7 +159,8 @@ export const Duration = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/google/protobuf/empty.ts b/common/types/src/lcd/google/protobuf/empty.ts deleted file mode 100644 index 58ef8256..00000000 --- a/common/types/src/lcd/google/protobuf/empty.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 index 8e3ff86f..cd9b753e 100644 --- a/common/types/src/lcd/google/protobuf/timestamp.ts +++ b/common/types/src/lcd/google/protobuf/timestamp.ts @@ -55,7 +55,15 @@ export const protobufPackage = "google.protobuf"; * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) * .setNanos((int) ((millis % 1000) * 1000000)).build(); * - * Example 5: Compute Timestamp from current time in Python. + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. * * timestamp = Timestamp() * timestamp.GetCurrentTime() @@ -119,40 +127,56 @@ export const Timestamp = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.seconds = longToString(reader.int64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Timestamp { return { - seconds: isSet(object.seconds) ? String(object.seconds) : "0", - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + seconds: isSet(object.seconds) ? globalThis.String(object.seconds) : "0", + nanos: isSet(object.nanos) ? globalThis.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)); + if (message.seconds !== "0") { + obj.seconds = message.seconds; + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } return obj; }, + create, I>>(base?: I): Timestamp { + return Timestamp.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? "0"; @@ -164,7 +188,8 @@ export const Timestamp = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/bundles.ts b/common/types/src/lcd/kyve/bundles/v1beta1/bundles.ts index 9cf159f5..e661c9d1 100644 --- a/common/types/src/lcd/kyve/bundles/v1beta1/bundles.ts +++ b/common/types/src/lcd/kyve/bundles/v1beta1/bundles.ts @@ -154,13 +154,17 @@ export interface FinalizedBundle { /** data_hash a sha256 hash of the raw compressed data */ data_hash: string; /** finalized_at contains details of the block that finalized this bundle. */ - finalized_at?: FinalizedAt; + finalized_at?: + | FinalizedAt + | undefined; /** 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; + /** stake_security */ + stake_security?: StakeSecurity | undefined; } /** FinalizedAt ... */ @@ -171,6 +175,44 @@ export interface FinalizedAt { timestamp: string; } +/** StakeSecurity stores information about total stake and valid votes with which the bundle got finalized. */ +export interface StakeSecurity { + /** valid_vote_power is the total amount of stake of all pool stakers which voted valid for the given bundle. */ + valid_vote_power: string; + /** total_vote_power is the total amount of stake that was present during the finalization of the bundle */ + total_vote_power: string; +} + +/** BundleVersionEntry ... */ +export interface BundleVersionEntry { + /** height ... */ + height: string; + /** version ... */ + version: number; +} + +/** BundleVersionMap ... */ +export interface BundleVersionMap { + /** versions ... */ + versions: BundleVersionEntry[]; +} + +/** RoundRobinSingleValidatorProgress ... */ +export interface RoundRobinSingleValidatorProgress { + /** address ... */ + address: string; + /** progress ... */ + progress: string; +} + +/** RoundRobinProgress ... */ +export interface RoundRobinProgress { + /** pool_id ... */ + pool_id: string; + /** progress_list ... */ + progress_list: RoundRobinSingleValidatorProgress[]; +} + function createBaseBundleProposal(): BundleProposal { return { pool_id: "0", @@ -246,122 +288,216 @@ export const BundleProposal = { }, decode(input: _m0.Reader | Uint8Array, length?: number): BundleProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.uploader = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.next_uploader = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.data_size = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.to_key = reader.string(); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.bundle_summary = reader.string(); - break; + continue; case 9: + if (tag !== 74) { + break; + } + message.data_hash = reader.string(); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.updated_at = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.voters_valid.push(reader.string()); - break; + continue; case 12: + if (tag !== 98) { + break; + } + message.voters_invalid.push(reader.string()); - break; + continue; case 13: + if (tag !== 106) { + break; + } + message.voters_abstain.push(reader.string()); - break; + continue; case 14: + if (tag !== 114) { + break; + } + message.from_key = reader.string(); - break; + continue; case 15: + if (tag !== 120) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 16: + if (tag !== 128) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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, + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.String(object.storage_id) : "", + uploader: isSet(object.uploader) ? globalThis.String(object.uploader) : "", + next_uploader: isSet(object.next_uploader) ? globalThis.String(object.next_uploader) : "", + data_size: isSet(object.data_size) ? globalThis.String(object.data_size) : "0", + bundle_size: isSet(object.bundle_size) ? globalThis.String(object.bundle_size) : "0", + to_key: isSet(object.to_key) ? globalThis.String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? globalThis.String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? globalThis.String(object.data_hash) : "", + updated_at: isSet(object.updated_at) ? globalThis.String(object.updated_at) : "0", + voters_valid: globalThis.Array.isArray(object?.voters_valid) + ? object.voters_valid.map((e: any) => globalThis.String(e)) + : [], + voters_invalid: globalThis.Array.isArray(object?.voters_invalid) + ? object.voters_invalid.map((e: any) => globalThis.String(e)) + : [], + voters_abstain: globalThis.Array.isArray(object?.voters_abstain) + ? object.voters_abstain.map((e: any) => globalThis.String(e)) + : [], + from_key: isSet(object.from_key) ? globalThis.String(object.from_key) : "", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.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)); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.uploader !== "") { + obj.uploader = message.uploader; + } + if (message.next_uploader !== "") { + obj.next_uploader = message.next_uploader; + } + if (message.data_size !== "0") { + obj.data_size = message.data_size; + } + if (message.bundle_size !== "0") { + obj.bundle_size = message.bundle_size; + } + if (message.to_key !== "") { + obj.to_key = message.to_key; + } + if (message.bundle_summary !== "") { + obj.bundle_summary = message.bundle_summary; + } + if (message.data_hash !== "") { + obj.data_hash = message.data_hash; + } + if (message.updated_at !== "0") { + obj.updated_at = message.updated_at; + } + if (message.voters_valid?.length) { + obj.voters_valid = message.voters_valid; + } + if (message.voters_invalid?.length) { + obj.voters_invalid = message.voters_invalid; + } + if (message.voters_abstain?.length) { + obj.voters_abstain = message.voters_abstain; + } + if (message.from_key !== "") { + obj.from_key = message.from_key; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } return obj; }, + create, I>>(base?: I): BundleProposal { + return BundleProposal.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): BundleProposal { const message = createBaseBundleProposal(); message.pool_id = object.pool_id ?? "0"; @@ -399,6 +535,7 @@ function createBaseFinalizedBundle(): FinalizedBundle { from_key: "", storage_provider_id: 0, compression_id: 0, + stake_security: undefined, }; } @@ -443,100 +580,195 @@ export const FinalizedBundle = { if (message.compression_id !== 0) { writer.uint32(104).uint32(message.compression_id); } + if (message.stake_security !== undefined) { + StakeSecurity.encode(message.stake_security, writer.uint32(114).fork()).ldelim(); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): FinalizedBundle { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.uploader = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.from_index = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.to_index = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.to_key = reader.string(); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.bundle_summary = reader.string(); - break; + continue; case 9: + if (tag !== 74) { + break; + } + message.data_hash = reader.string(); - break; + continue; case 10: + if (tag !== 82) { + break; + } + message.finalized_at = FinalizedAt.decode(reader, reader.uint32()); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.from_key = reader.string(); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + case 14: + if (tag !== 114) { + break; + } + + message.stake_security = StakeSecurity.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.String(object.storage_id) : "", + uploader: isSet(object.uploader) ? globalThis.String(object.uploader) : "", + from_index: isSet(object.from_index) ? globalThis.String(object.from_index) : "0", + to_index: isSet(object.to_index) ? globalThis.String(object.to_index) : "0", + to_key: isSet(object.to_key) ? globalThis.String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? globalThis.String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? globalThis.String(object.data_hash) : "", finalized_at: isSet(object.finalized_at) ? FinalizedAt.fromJSON(object.finalized_at) : undefined, - 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, + from_key: isSet(object.from_key) ? globalThis.String(object.from_key) : "", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.Number(object.compression_id) : 0, + stake_security: isSet(object.stake_security) ? StakeSecurity.fromJSON(object.stake_security) : undefined, }; }, 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 ? FinalizedAt.toJSON(message.finalized_at) : undefined); - 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)); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.uploader !== "") { + obj.uploader = message.uploader; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } + if (message.to_index !== "0") { + obj.to_index = message.to_index; + } + if (message.to_key !== "") { + obj.to_key = message.to_key; + } + if (message.bundle_summary !== "") { + obj.bundle_summary = message.bundle_summary; + } + if (message.data_hash !== "") { + obj.data_hash = message.data_hash; + } + if (message.finalized_at !== undefined) { + obj.finalized_at = FinalizedAt.toJSON(message.finalized_at); + } + if (message.from_key !== "") { + obj.from_key = message.from_key; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } + if (message.stake_security !== undefined) { + obj.stake_security = StakeSecurity.toJSON(message.stake_security); + } return obj; }, + create, I>>(base?: I): FinalizedBundle { + return FinalizedBundle.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): FinalizedBundle { const message = createBaseFinalizedBundle(); message.pool_id = object.pool_id ?? "0"; @@ -554,6 +786,9 @@ export const FinalizedBundle = { message.from_key = object.from_key ?? ""; message.storage_provider_id = object.storage_provider_id ?? 0; message.compression_id = object.compression_id ?? 0; + message.stake_security = (object.stake_security !== undefined && object.stake_security !== null) + ? StakeSecurity.fromPartial(object.stake_security) + : undefined; return message; }, }; @@ -574,40 +809,56 @@ export const FinalizedAt = { }, decode(input: _m0.Reader | Uint8Array, length?: number): FinalizedAt { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFinalizedAt(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.height = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.timestamp = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): FinalizedAt { return { - height: isSet(object.height) ? String(object.height) : "0", - timestamp: isSet(object.timestamp) ? String(object.timestamp) : "0", + height: isSet(object.height) ? globalThis.String(object.height) : "0", + timestamp: isSet(object.timestamp) ? globalThis.String(object.timestamp) : "0", }; }, toJSON(message: FinalizedAt): unknown { const obj: any = {}; - message.height !== undefined && (obj.height = message.height); - message.timestamp !== undefined && (obj.timestamp = message.timestamp); + if (message.height !== "0") { + obj.height = message.height; + } + if (message.timestamp !== "0") { + obj.timestamp = message.timestamp; + } return obj; }, + create, I>>(base?: I): FinalizedAt { + return FinalizedAt.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): FinalizedAt { const message = createBaseFinalizedAt(); message.height = object.height ?? "0"; @@ -616,10 +867,374 @@ export const FinalizedAt = { }, }; +function createBaseStakeSecurity(): StakeSecurity { + return { valid_vote_power: "0", total_vote_power: "0" }; +} + +export const StakeSecurity = { + encode(message: StakeSecurity, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.valid_vote_power !== "0") { + writer.uint32(8).uint64(message.valid_vote_power); + } + if (message.total_vote_power !== "0") { + writer.uint32(16).uint64(message.total_vote_power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakeSecurity { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeSecurity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.valid_vote_power = longToString(reader.uint64() as Long); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total_vote_power = longToString(reader.uint64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeSecurity { + return { + valid_vote_power: isSet(object.valid_vote_power) ? globalThis.String(object.valid_vote_power) : "0", + total_vote_power: isSet(object.total_vote_power) ? globalThis.String(object.total_vote_power) : "0", + }; + }, + + toJSON(message: StakeSecurity): unknown { + const obj: any = {}; + if (message.valid_vote_power !== "0") { + obj.valid_vote_power = message.valid_vote_power; + } + if (message.total_vote_power !== "0") { + obj.total_vote_power = message.total_vote_power; + } + return obj; + }, + + create, I>>(base?: I): StakeSecurity { + return StakeSecurity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeSecurity { + const message = createBaseStakeSecurity(); + message.valid_vote_power = object.valid_vote_power ?? "0"; + message.total_vote_power = object.total_vote_power ?? "0"; + return message; + }, +}; + +function createBaseBundleVersionEntry(): BundleVersionEntry { + return { height: "0", version: 0 }; +} + +export const BundleVersionEntry = { + encode(message: BundleVersionEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "0") { + writer.uint32(8).uint64(message.height); + } + if (message.version !== 0) { + writer.uint32(16).int32(message.version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BundleVersionEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBundleVersionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToString(reader.uint64() as Long); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.version = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BundleVersionEntry { + return { + height: isSet(object.height) ? globalThis.String(object.height) : "0", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: BundleVersionEntry): unknown { + const obj: any = {}; + if (message.height !== "0") { + obj.height = message.height; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): BundleVersionEntry { + return BundleVersionEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BundleVersionEntry { + const message = createBaseBundleVersionEntry(); + message.height = object.height ?? "0"; + message.version = object.version ?? 0; + return message; + }, +}; + +function createBaseBundleVersionMap(): BundleVersionMap { + return { versions: [] }; +} + +export const BundleVersionMap = { + encode(message: BundleVersionMap, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.versions) { + BundleVersionEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BundleVersionMap { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBundleVersionMap(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.versions.push(BundleVersionEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BundleVersionMap { + return { + versions: globalThis.Array.isArray(object?.versions) + ? object.versions.map((e: any) => BundleVersionEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: BundleVersionMap): unknown { + const obj: any = {}; + if (message.versions?.length) { + obj.versions = message.versions.map((e) => BundleVersionEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): BundleVersionMap { + return BundleVersionMap.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BundleVersionMap { + const message = createBaseBundleVersionMap(); + message.versions = object.versions?.map((e) => BundleVersionEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRoundRobinSingleValidatorProgress(): RoundRobinSingleValidatorProgress { + return { address: "", progress: "0" }; +} + +export const RoundRobinSingleValidatorProgress = { + encode(message: RoundRobinSingleValidatorProgress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.progress !== "0") { + writer.uint32(16).int64(message.progress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RoundRobinSingleValidatorProgress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRoundRobinSingleValidatorProgress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.progress = longToString(reader.int64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RoundRobinSingleValidatorProgress { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + progress: isSet(object.progress) ? globalThis.String(object.progress) : "0", + }; + }, + + toJSON(message: RoundRobinSingleValidatorProgress): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.progress !== "0") { + obj.progress = message.progress; + } + return obj; + }, + + create, I>>( + base?: I, + ): RoundRobinSingleValidatorProgress { + return RoundRobinSingleValidatorProgress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RoundRobinSingleValidatorProgress { + const message = createBaseRoundRobinSingleValidatorProgress(); + message.address = object.address ?? ""; + message.progress = object.progress ?? "0"; + return message; + }, +}; + +function createBaseRoundRobinProgress(): RoundRobinProgress { + return { pool_id: "0", progress_list: [] }; +} + +export const RoundRobinProgress = { + encode(message: RoundRobinProgress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.pool_id !== "0") { + writer.uint32(8).uint64(message.pool_id); + } + for (const v of message.progress_list) { + RoundRobinSingleValidatorProgress.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RoundRobinProgress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRoundRobinProgress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.pool_id = longToString(reader.uint64() as Long); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.progress_list.push(RoundRobinSingleValidatorProgress.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RoundRobinProgress { + return { + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + progress_list: globalThis.Array.isArray(object?.progress_list) + ? object.progress_list.map((e: any) => RoundRobinSingleValidatorProgress.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RoundRobinProgress): unknown { + const obj: any = {}; + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.progress_list?.length) { + obj.progress_list = message.progress_list.map((e) => RoundRobinSingleValidatorProgress.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RoundRobinProgress { + return RoundRobinProgress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RoundRobinProgress { + const message = createBaseRoundRobinProgress(); + message.pool_id = object.pool_id ?? "0"; + message.progress_list = object.progress_list?.map((e) => RoundRobinSingleValidatorProgress.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 globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/events.ts b/common/types/src/lcd/kyve/bundles/v1beta1/events.ts index 5425881f..6c25f31a 100644 --- a/common/types/src/lcd/kyve/bundles/v1beta1/events.ts +++ b/common/types/src/lcd/kyve/bundles/v1beta1/events.ts @@ -13,9 +13,13 @@ export const protobufPackage = "kyve.bundles.v1beta1"; */ export interface EventUpdateParams { /** old_params is the module's old parameters. */ - old_params?: Params; + old_params?: + | Params + | undefined; /** new_params is the module's new parameters. */ - new_params?: Params; + new_params?: + | Params + | undefined; /** payload is the parameter updates that were performed. */ payload: string; } @@ -195,25 +199,38 @@ export const EventUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.old_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.new_params = Params.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -222,20 +239,27 @@ export const EventUpdateParams = { return { old_params: isSet(object.old_params) ? Params.fromJSON(object.old_params) : undefined, new_params: isSet(object.new_params) ? Params.fromJSON(object.new_params) : undefined, - payload: isSet(object.payload) ? String(object.payload) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: EventUpdateParams): unknown { const obj: any = {}; - message.old_params !== undefined && - (obj.old_params = message.old_params ? Params.toJSON(message.old_params) : undefined); - message.new_params !== undefined && - (obj.new_params = message.new_params ? Params.toJSON(message.new_params) : undefined); - message.payload !== undefined && (obj.payload = message.payload); + if (message.old_params !== undefined) { + obj.old_params = Params.toJSON(message.old_params); + } + if (message.new_params !== undefined) { + obj.new_params = Params.toJSON(message.new_params); + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): EventUpdateParams { + return EventUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateParams { const message = createBaseEventUpdateParams(); message.old_params = (object.old_params !== undefined && object.old_params !== null) @@ -271,50 +295,78 @@ export const EventBundleVote = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleVote { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.vote = voteTypeFromJSON(reader.int32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + storage_id: isSet(object.storage_id) ? globalThis.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)); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.vote !== VoteType.VOTE_TYPE_UNSPECIFIED) { + obj.vote = voteTypeToJSON(message.vote); + } return obj; }, + create, I>>(base?: I): EventBundleVote { + return EventBundleVote.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventBundleVote { const message = createBaseEventBundleVote(); message.pool_id = object.pool_id ?? "0"; @@ -392,100 +444,188 @@ export const EventBundleProposed = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleProposed { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.uploader = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.data_size = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.from_index = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.from_key = reader.string(); - break; + continue; case 9: + if (tag !== 74) { + break; + } + message.to_key = reader.string(); - break; + continue; case 10: + if (tag !== 82) { + break; + } + message.bundle_summary = reader.string(); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.data_hash = reader.string(); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.proposed_at = longToString(reader.uint64() as Long); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 14: + if (tag !== 112) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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, + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.String(object.storage_id) : "", + uploader: isSet(object.uploader) ? globalThis.String(object.uploader) : "", + data_size: isSet(object.data_size) ? globalThis.String(object.data_size) : "0", + from_index: isSet(object.from_index) ? globalThis.String(object.from_index) : "0", + bundle_size: isSet(object.bundle_size) ? globalThis.String(object.bundle_size) : "0", + from_key: isSet(object.from_key) ? globalThis.String(object.from_key) : "", + to_key: isSet(object.to_key) ? globalThis.String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? globalThis.String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? globalThis.String(object.data_hash) : "", + proposed_at: isSet(object.proposed_at) ? globalThis.String(object.proposed_at) : "0", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.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)); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.uploader !== "") { + obj.uploader = message.uploader; + } + if (message.data_size !== "0") { + obj.data_size = message.data_size; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } + if (message.bundle_size !== "0") { + obj.bundle_size = message.bundle_size; + } + if (message.from_key !== "") { + obj.from_key = message.from_key; + } + if (message.to_key !== "") { + obj.to_key = message.to_key; + } + if (message.bundle_summary !== "") { + obj.bundle_summary = message.bundle_summary; + } + if (message.data_hash !== "") { + obj.data_hash = message.data_hash; + } + if (message.proposed_at !== "0") { + obj.proposed_at = message.proposed_at; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } return obj; }, + create, I>>(base?: I): EventBundleProposed { + return EventBundleProposed.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventBundleProposed { const message = createBaseEventBundleProposed(); message.pool_id = object.pool_id ?? "0"; @@ -581,110 +721,210 @@ export const EventBundleFinalized = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventBundleFinalized { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.valid = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.invalid = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.abstain = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.total = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.status = bundleStatusFromJSON(reader.int32()); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.funders_payout = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.inflation_payout = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.reward_treasury = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 88) { + break; + } + message.reward_uploader = longToString(reader.uint64() as Long); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.reward_delegation = longToString(reader.uint64() as Long); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.reward_total = longToString(reader.uint64() as Long); - break; + continue; case 14: + if (tag !== 112) { + break; + } + message.finalized_at = longToString(reader.uint64() as Long); - break; + continue; case 15: + if (tag !== 122) { + break; + } + message.uploader = reader.string(); - break; + continue; case 16: + if (tag !== 130) { + break; + } + message.next_uploader = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + valid: isSet(object.valid) ? globalThis.String(object.valid) : "0", + invalid: isSet(object.invalid) ? globalThis.String(object.invalid) : "0", + abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "0", + total: isSet(object.total) ? globalThis.String(object.total) : "0", status: isSet(object.status) ? bundleStatusFromJSON(object.status) : BundleStatus.BUNDLE_STATUS_UNSPECIFIED, - funders_payout: isSet(object.funders_payout) ? String(object.funders_payout) : "0", - inflation_payout: isSet(object.inflation_payout) ? String(object.inflation_payout) : "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) : "", + funders_payout: isSet(object.funders_payout) ? globalThis.String(object.funders_payout) : "0", + inflation_payout: isSet(object.inflation_payout) ? globalThis.String(object.inflation_payout) : "0", + reward_treasury: isSet(object.reward_treasury) ? globalThis.String(object.reward_treasury) : "0", + reward_uploader: isSet(object.reward_uploader) ? globalThis.String(object.reward_uploader) : "0", + reward_delegation: isSet(object.reward_delegation) ? globalThis.String(object.reward_delegation) : "0", + reward_total: isSet(object.reward_total) ? globalThis.String(object.reward_total) : "0", + finalized_at: isSet(object.finalized_at) ? globalThis.String(object.finalized_at) : "0", + uploader: isSet(object.uploader) ? globalThis.String(object.uploader) : "", + next_uploader: isSet(object.next_uploader) ? globalThis.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.funders_payout !== undefined && (obj.funders_payout = message.funders_payout); - message.inflation_payout !== undefined && (obj.inflation_payout = message.inflation_payout); - 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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.valid !== "0") { + obj.valid = message.valid; + } + if (message.invalid !== "0") { + obj.invalid = message.invalid; + } + if (message.abstain !== "0") { + obj.abstain = message.abstain; + } + if (message.total !== "0") { + obj.total = message.total; + } + if (message.status !== BundleStatus.BUNDLE_STATUS_UNSPECIFIED) { + obj.status = bundleStatusToJSON(message.status); + } + if (message.funders_payout !== "0") { + obj.funders_payout = message.funders_payout; + } + if (message.inflation_payout !== "0") { + obj.inflation_payout = message.inflation_payout; + } + if (message.reward_treasury !== "0") { + obj.reward_treasury = message.reward_treasury; + } + if (message.reward_uploader !== "0") { + obj.reward_uploader = message.reward_uploader; + } + if (message.reward_delegation !== "0") { + obj.reward_delegation = message.reward_delegation; + } + if (message.reward_total !== "0") { + obj.reward_total = message.reward_total; + } + if (message.finalized_at !== "0") { + obj.finalized_at = message.finalized_at; + } + if (message.uploader !== "") { + obj.uploader = message.uploader; + } + if (message.next_uploader !== "") { + obj.next_uploader = message.next_uploader; + } return obj; }, + create, I>>(base?: I): EventBundleFinalized { + return EventBundleFinalized.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventBundleFinalized { const message = createBaseEventBundleFinalized(); message.pool_id = object.pool_id ?? "0"; @@ -726,45 +966,67 @@ export const EventClaimedUploaderRole = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimedUploaderRole { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.new_uploader = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + new_uploader: isSet(object.new_uploader) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.new_uploader !== "") { + obj.new_uploader = message.new_uploader; + } return obj; }, + create, I>>(base?: I): EventClaimedUploaderRole { + return EventClaimedUploaderRole.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClaimedUploaderRole { const message = createBaseEventClaimedUploaderRole(); message.pool_id = object.pool_id ?? "0"; @@ -796,50 +1058,78 @@ export const EventSkippedUploaderRole = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventSkippedUploaderRole { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.previous_uploader = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.new_uploader = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + previous_uploader: isSet(object.previous_uploader) ? globalThis.String(object.previous_uploader) : "", + new_uploader: isSet(object.new_uploader) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.previous_uploader !== "") { + obj.previous_uploader = message.previous_uploader; + } + if (message.new_uploader !== "") { + obj.new_uploader = message.new_uploader; + } return obj; }, + create, I>>(base?: I): EventSkippedUploaderRole { + return EventSkippedUploaderRole.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventSkippedUploaderRole { const message = createBaseEventSkippedUploaderRole(); message.pool_id = object.pool_id ?? "0"; @@ -869,45 +1159,67 @@ export const EventPointIncreased = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPointIncreased { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.current_points = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + current_points: isSet(object.current_points) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.current_points !== "0") { + obj.current_points = message.current_points; + } return obj; }, + create, I>>(base?: I): EventPointIncreased { + return EventPointIncreased.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPointIncreased { const message = createBaseEventPointIncreased(); message.pool_id = object.pool_id ?? "0"; @@ -933,40 +1245,56 @@ export const EventPointsReset = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPointsReset { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } return obj; }, + create, I>>(base?: I): EventPointsReset { + return EventPointsReset.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPointsReset { const message = createBaseEventPointsReset(); message.pool_id = object.pool_id ?? "0"; @@ -978,7 +1306,8 @@ export const EventPointsReset = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/genesis.ts b/common/types/src/lcd/kyve/bundles/v1beta1/genesis.ts index 1257e971..3847a7b8 100644 --- a/common/types/src/lcd/kyve/bundles/v1beta1/genesis.ts +++ b/common/types/src/lcd/kyve/bundles/v1beta1/genesis.ts @@ -1,6 +1,6 @@ /* eslint-disable */ import _m0 from "protobufjs/minimal"; -import { BundleProposal, FinalizedBundle } from "./bundles"; +import { BundleProposal, FinalizedBundle, RoundRobinProgress } from "./bundles"; import { Params } from "./params"; export const protobufPackage = "kyve.bundles.v1beta1"; @@ -8,15 +8,19 @@ 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; + params?: + | Params + | undefined; /** bundle_proposal_list ... */ bundle_proposal_list: BundleProposal[]; /** finalized_bundle_list ... */ finalized_bundle_list: FinalizedBundle[]; + /** round_robin_progress_list ... */ + round_robin_progress_list: RoundRobinProgress[]; } function createBaseGenesisState(): GenesisState { - return { params: undefined, bundle_proposal_list: [], finalized_bundle_list: [] }; + return { params: undefined, bundle_proposal_list: [], finalized_bundle_list: [], round_robin_progress_list: [] }; } export const GenesisState = { @@ -30,29 +34,52 @@ export const GenesisState = { for (const v of message.finalized_bundle_list) { FinalizedBundle.encode(v!, writer.uint32(26).fork()).ldelim(); } + for (const v of message.round_robin_progress_list) { + RoundRobinProgress.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); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.bundle_proposal_list.push(BundleProposal.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.finalized_bundle_list.push(FinalizedBundle.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.round_robin_progress_list.push(RoundRobinProgress.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -60,31 +87,38 @@ export const GenesisState = { fromJSON(object: any): GenesisState { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - bundle_proposal_list: Array.isArray(object?.bundle_proposal_list) + bundle_proposal_list: globalThis.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) + finalized_bundle_list: globalThis.Array.isArray(object?.finalized_bundle_list) ? object.finalized_bundle_list.map((e: any) => FinalizedBundle.fromJSON(e)) : [], + round_robin_progress_list: globalThis.Array.isArray(object?.round_robin_progress_list) + ? object.round_robin_progress_list.map((e: any) => RoundRobinProgress.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.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.bundle_proposal_list?.length) { + obj.bundle_proposal_list = message.bundle_proposal_list.map((e) => BundleProposal.toJSON(e)); } - 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 = []; + if (message.finalized_bundle_list?.length) { + obj.finalized_bundle_list = message.finalized_bundle_list.map((e) => FinalizedBundle.toJSON(e)); + } + if (message.round_robin_progress_list?.length) { + obj.round_robin_progress_list = message.round_robin_progress_list.map((e) => RoundRobinProgress.toJSON(e)); } return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) @@ -92,6 +126,8 @@ export const GenesisState = { : 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)) || []; + message.round_robin_progress_list = + object.round_robin_progress_list?.map((e) => RoundRobinProgress.fromPartial(e)) || []; return message; }, }; @@ -99,7 +135,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/params.ts b/common/types/src/lcd/kyve/bundles/v1beta1/params.ts index 4772562b..f9f18d1a 100644 --- a/common/types/src/lcd/kyve/bundles/v1beta1/params.ts +++ b/common/types/src/lcd/kyve/bundles/v1beta1/params.ts @@ -38,50 +38,78 @@ export const Params = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.upload_timeout = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.storage_cost = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.network_fee = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.max_points = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", - network_fee: isSet(object.network_fee) ? String(object.network_fee) : "", - max_points: isSet(object.max_points) ? String(object.max_points) : "0", + upload_timeout: isSet(object.upload_timeout) ? globalThis.String(object.upload_timeout) : "0", + storage_cost: isSet(object.storage_cost) ? globalThis.String(object.storage_cost) : "", + network_fee: isSet(object.network_fee) ? globalThis.String(object.network_fee) : "", + max_points: isSet(object.max_points) ? globalThis.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); + if (message.upload_timeout !== "0") { + obj.upload_timeout = message.upload_timeout; + } + if (message.storage_cost !== "") { + obj.storage_cost = message.storage_cost; + } + if (message.network_fee !== "") { + obj.network_fee = message.network_fee; + } + if (message.max_points !== "0") { + obj.max_points = message.max_points; + } return obj; }, + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Params { const message = createBaseParams(); message.upload_timeout = object.upload_timeout ?? "0"; @@ -95,7 +123,8 @@ export const Params = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/query.ts b/common/types/src/lcd/kyve/bundles/v1beta1/query.ts index e66091c3..ddd88889 100644 --- a/common/types/src/lcd/kyve/bundles/v1beta1/query.ts +++ b/common/types/src/lcd/kyve/bundles/v1beta1/query.ts @@ -11,7 +11,7 @@ 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; + params?: Params | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -24,16 +24,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -47,6 +48,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -66,19 +70,24 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -89,10 +98,15 @@ export const QueryParamsResponse = { toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) @@ -108,18 +122,19 @@ export interface Query { Params(request: QueryParamsRequest): Promise; } +export const QueryServiceName = "kyve.bundles.v1beta1.Query"; 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.service = opts?.service || QueryServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -130,7 +145,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/bundles/v1beta1/tx.ts b/common/types/src/lcd/kyve/bundles/v1beta1/tx.ts index 4587650e..36511c51 100644 --- a/common/types/src/lcd/kyve/bundles/v1beta1/tx.ts +++ b/common/types/src/lcd/kyve/bundles/v1beta1/tx.ts @@ -215,85 +215,155 @@ export const MsgSubmitBundleProposal = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitBundleProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.data_size = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.data_hash = reader.string(); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.from_index = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 74) { + break; + } + message.from_key = reader.string(); - break; + continue; case 10: + if (tag !== 82) { + break; + } + message.to_key = reader.string(); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.bundle_summary = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.String(object.storage_id) : "", + data_size: isSet(object.data_size) ? globalThis.String(object.data_size) : "0", + data_hash: isSet(object.data_hash) ? globalThis.String(object.data_hash) : "", + from_index: isSet(object.from_index) ? globalThis.String(object.from_index) : "0", + bundle_size: isSet(object.bundle_size) ? globalThis.String(object.bundle_size) : "0", + from_key: isSet(object.from_key) ? globalThis.String(object.from_key) : "", + to_key: isSet(object.to_key) ? globalThis.String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.data_size !== "0") { + obj.data_size = message.data_size; + } + if (message.data_hash !== "") { + obj.data_hash = message.data_hash; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } + if (message.bundle_size !== "0") { + obj.bundle_size = message.bundle_size; + } + if (message.from_key !== "") { + obj.from_key = message.from_key; + } + if (message.to_key !== "") { + obj.to_key = message.to_key; + } + if (message.bundle_summary !== "") { + obj.bundle_summary = message.bundle_summary; + } return obj; }, + create, I>>(base?: I): MsgSubmitBundleProposal { + return MsgSubmitBundleProposal.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgSubmitBundleProposal { const message = createBaseMsgSubmitBundleProposal(); message.creator = object.creator ?? ""; @@ -321,16 +391,17 @@ export const MsgSubmitBundleProposalResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitBundleProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -344,6 +415,9 @@ export const MsgSubmitBundleProposalResponse = { return obj; }, + create, I>>(base?: I): MsgSubmitBundleProposalResponse { + return MsgSubmitBundleProposalResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgSubmitBundleProposalResponse { const message = createBaseMsgSubmitBundleProposalResponse(); return message; @@ -375,55 +449,89 @@ export const MsgVoteBundleProposal = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteBundleProposal { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.storage_id = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.vote = voteTypeFromJSON(reader.int32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.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)); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.vote !== VoteType.VOTE_TYPE_UNSPECIFIED) { + obj.vote = voteTypeToJSON(message.vote); + } return obj; }, + create, I>>(base?: I): MsgVoteBundleProposal { + return MsgVoteBundleProposal.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgVoteBundleProposal { const message = createBaseMsgVoteBundleProposal(); message.creator = object.creator ?? ""; @@ -445,16 +553,17 @@ export const MsgVoteBundleProposalResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteBundleProposalResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -468,6 +577,9 @@ export const MsgVoteBundleProposalResponse = { return obj; }, + create, I>>(base?: I): MsgVoteBundleProposalResponse { + return MsgVoteBundleProposalResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgVoteBundleProposalResponse { const message = createBaseMsgVoteBundleProposalResponse(); return message; @@ -493,45 +605,67 @@ export const MsgClaimUploaderRole = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUploaderRole { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + pool_id: isSet(object.pool_id) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } return obj; }, + create, I>>(base?: I): MsgClaimUploaderRole { + return MsgClaimUploaderRole.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClaimUploaderRole { const message = createBaseMsgClaimUploaderRole(); message.creator = object.creator ?? ""; @@ -551,16 +685,17 @@ export const MsgClaimUploaderRoleResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUploaderRoleResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -574,6 +709,9 @@ export const MsgClaimUploaderRoleResponse = { return obj; }, + create, I>>(base?: I): MsgClaimUploaderRoleResponse { + return MsgClaimUploaderRoleResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgClaimUploaderRoleResponse { const message = createBaseMsgClaimUploaderRoleResponse(); return message; @@ -602,50 +740,78 @@ export const MsgSkipUploaderRole = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSkipUploaderRole { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.from_index = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + from_index: isSet(object.from_index) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } return obj; }, + create, I>>(base?: I): MsgSkipUploaderRole { + return MsgSkipUploaderRole.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgSkipUploaderRole { const message = createBaseMsgSkipUploaderRole(); message.creator = object.creator ?? ""; @@ -666,16 +832,17 @@ export const MsgSkipUploaderRoleResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSkipUploaderRoleResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -689,6 +856,9 @@ export const MsgSkipUploaderRoleResponse = { return obj; }, + create, I>>(base?: I): MsgSkipUploaderRoleResponse { + return MsgSkipUploaderRoleResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgSkipUploaderRoleResponse { const message = createBaseMsgSkipUploaderRoleResponse(); return message; @@ -711,40 +881,56 @@ export const MsgUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", - payload: isSet(object.payload) ? String(object.payload) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: MsgUpdateParams): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.payload !== undefined && (obj.payload = message.payload); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateParams { const message = createBaseMsgUpdateParams(); message.authority = object.authority ?? ""; @@ -763,16 +949,17 @@ export const MsgUpdateParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -786,6 +973,9 @@ export const MsgUpdateParamsResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateParamsResponse { const message = createBaseMsgUpdateParamsResponse(); return message; @@ -809,11 +999,12 @@ export interface Msg { UpdateParams(request: MsgUpdateParams): Promise; } +export const MsgServiceName = "kyve.bundles.v1beta1.Msg"; 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.service = opts?.service || MsgServiceName; this.rpc = rpc; this.SubmitBundleProposal = this.SubmitBundleProposal.bind(this); this.VoteBundleProposal = this.VoteBundleProposal.bind(this); @@ -824,31 +1015,31 @@ export class MsgClientImpl implements Msg { 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))); + return promise.then((data) => MsgSubmitBundleProposalResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgVoteBundleProposalResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgClaimUploaderRoleResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgSkipUploaderRoleResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); } } @@ -859,7 +1050,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/delegation.ts b/common/types/src/lcd/kyve/delegation/v1beta1/delegation.ts index d123c63b..9fe6a900 100644 --- a/common/types/src/lcd/kyve/delegation/v1beta1/delegation.ts +++ b/common/types/src/lcd/kyve/delegation/v1beta1/delegation.ts @@ -186,50 +186,78 @@ export const Delegator = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Delegator { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.delegator = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.k_index = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.initial_amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + delegator: isSet(object.delegator) ? globalThis.String(object.delegator) : "", + k_index: isSet(object.k_index) ? globalThis.String(object.k_index) : "0", + initial_amount: isSet(object.initial_amount) ? globalThis.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); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.delegator !== "") { + obj.delegator = message.delegator; + } + if (message.k_index !== "0") { + obj.k_index = message.k_index; + } + if (message.initial_amount !== "0") { + obj.initial_amount = message.initial_amount; + } return obj; }, + create, I>>(base?: I): Delegator { + return Delegator.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Delegator { const message = createBaseDelegator(); message.staker = object.staker ?? ""; @@ -259,45 +287,67 @@ export const DelegationEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegationEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.k_index = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + k_index: isSet(object.k_index) ? globalThis.String(object.k_index) : "0", + value: isSet(object.value) ? globalThis.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); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.k_index !== "0") { + obj.k_index = message.k_index; + } + if (message.value !== "") { + obj.value = message.value; + } return obj; }, + create, I>>(base?: I): DelegationEntry { + return DelegationEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DelegationEntry { const message = createBaseDelegationEntry(); message.staker = object.staker ?? ""; @@ -342,63 +392,102 @@ export const DelegationData = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegationData { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.current_rewards = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.total_delegation = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.latest_index_k = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.delegator_count = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.latest_index_was_undelegation = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + current_rewards: isSet(object.current_rewards) ? globalThis.String(object.current_rewards) : "0", + total_delegation: isSet(object.total_delegation) ? globalThis.String(object.total_delegation) : "0", + latest_index_k: isSet(object.latest_index_k) ? globalThis.String(object.latest_index_k) : "0", + delegator_count: isSet(object.delegator_count) ? globalThis.String(object.delegator_count) : "0", latest_index_was_undelegation: isSet(object.latest_index_was_undelegation) - ? Boolean(object.latest_index_was_undelegation) + ? globalThis.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); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.current_rewards !== "0") { + obj.current_rewards = message.current_rewards; + } + if (message.total_delegation !== "0") { + obj.total_delegation = message.total_delegation; + } + if (message.latest_index_k !== "0") { + obj.latest_index_k = message.latest_index_k; + } + if (message.delegator_count !== "0") { + obj.delegator_count = message.delegator_count; + } + if (message.latest_index_was_undelegation === true) { + obj.latest_index_was_undelegation = message.latest_index_was_undelegation; + } return obj; }, + create, I>>(base?: I): DelegationData { + return DelegationData.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DelegationData { const message = createBaseDelegationData(); message.staker = object.staker ?? ""; @@ -430,45 +519,67 @@ export const DelegationSlash = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegationSlash { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.k_index = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.fraction = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + k_index: isSet(object.k_index) ? globalThis.String(object.k_index) : "0", + fraction: isSet(object.fraction) ? globalThis.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); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.k_index !== "0") { + obj.k_index = message.k_index; + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } return obj; }, + create, I>>(base?: I): DelegationSlash { + return DelegationSlash.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DelegationSlash { const message = createBaseDelegationSlash(); message.staker = object.staker ?? ""; @@ -503,55 +614,89 @@ export const UndelegationQueueEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): UndelegationQueueEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.index = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.delegator = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.creation_time = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + index: isSet(object.index) ? globalThis.String(object.index) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + delegator: isSet(object.delegator) ? globalThis.String(object.delegator) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? globalThis.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); + if (message.index !== "0") { + obj.index = message.index; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.delegator !== "") { + obj.delegator = message.delegator; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.creation_time !== "0") { + obj.creation_time = message.creation_time; + } return obj; }, + create, I>>(base?: I): UndelegationQueueEntry { + return UndelegationQueueEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): UndelegationQueueEntry { const message = createBaseUndelegationQueueEntry(); message.index = object.index ?? "0"; @@ -579,40 +724,56 @@ export const QueueState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueueState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.low_index = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.high_index = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + low_index: isSet(object.low_index) ? globalThis.String(object.low_index) : "0", + high_index: isSet(object.high_index) ? globalThis.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); + if (message.low_index !== "0") { + obj.low_index = message.low_index; + } + if (message.high_index !== "0") { + obj.high_index = message.high_index; + } return obj; }, + create, I>>(base?: I): QueueState { + return QueueState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueueState { const message = createBaseQueueState(); message.low_index = object.low_index ?? "0"; @@ -637,40 +798,56 @@ export const RedelegationCooldown = { }, decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationCooldown { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.creation_date = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + address: isSet(object.address) ? globalThis.String(object.address) : "", + creation_date: isSet(object.creation_date) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.creation_date !== "0") { + obj.creation_date = message.creation_date; + } return obj; }, + create, I>>(base?: I): RedelegationCooldown { + return RedelegationCooldown.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): RedelegationCooldown { const message = createBaseRedelegationCooldown(); message.address = object.address ?? ""; @@ -682,7 +859,8 @@ export const RedelegationCooldown = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/events.ts b/common/types/src/lcd/kyve/delegation/v1beta1/events.ts index 9f8e8520..026a935d 100644 --- a/common/types/src/lcd/kyve/delegation/v1beta1/events.ts +++ b/common/types/src/lcd/kyve/delegation/v1beta1/events.ts @@ -12,9 +12,13 @@ export const protobufPackage = "kyve.delegation.v1beta1"; */ export interface EventUpdateParams { /** old_params is the module's old parameters. */ - old_params?: Params; + old_params?: + | Params + | undefined; /** new_params is the module's new parameters. */ - new_params?: Params; + new_params?: + | Params + | undefined; /** payload is the parameter updates that were performed. */ payload: string; } @@ -125,25 +129,38 @@ export const EventUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.old_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.new_params = Params.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -152,20 +169,27 @@ export const EventUpdateParams = { return { old_params: isSet(object.old_params) ? Params.fromJSON(object.old_params) : undefined, new_params: isSet(object.new_params) ? Params.fromJSON(object.new_params) : undefined, - payload: isSet(object.payload) ? String(object.payload) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: EventUpdateParams): unknown { const obj: any = {}; - message.old_params !== undefined && - (obj.old_params = message.old_params ? Params.toJSON(message.old_params) : undefined); - message.new_params !== undefined && - (obj.new_params = message.new_params ? Params.toJSON(message.new_params) : undefined); - message.payload !== undefined && (obj.payload = message.payload); + if (message.old_params !== undefined) { + obj.old_params = Params.toJSON(message.old_params); + } + if (message.new_params !== undefined) { + obj.new_params = Params.toJSON(message.new_params); + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): EventUpdateParams { + return EventUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateParams { const message = createBaseEventUpdateParams(); message.old_params = (object.old_params !== undefined && object.old_params !== null) @@ -198,45 +222,67 @@ export const EventDelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventDelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + address: isSet(object.address) ? globalThis.String(object.address) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventDelegate { + return EventDelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventDelegate { const message = createBaseEventDelegate(); message.address = object.address ?? ""; @@ -268,53 +314,80 @@ export const EventStartUndelegation = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventStartUndelegation { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventStartUndelegation(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.estimated_undelegation_date = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventStartUndelegation { return { - address: isSet(object.address) ? String(object.address) : "", - staker: isSet(object.staker) ? String(object.staker) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", estimated_undelegation_date: isSet(object.estimated_undelegation_date) - ? String(object.estimated_undelegation_date) + ? globalThis.String(object.estimated_undelegation_date) : "0", }; }, toJSON(message: EventStartUndelegation): 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); - message.estimated_undelegation_date !== undefined && - (obj.estimated_undelegation_date = message.estimated_undelegation_date); + if (message.address !== "") { + obj.address = message.address; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.estimated_undelegation_date !== "0") { + obj.estimated_undelegation_date = message.estimated_undelegation_date; + } return obj; }, + create, I>>(base?: I): EventStartUndelegation { + return EventStartUndelegation.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventStartUndelegation { const message = createBaseEventStartUndelegation(); message.address = object.address ?? ""; @@ -344,45 +417,67 @@ export const EventUndelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUndelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + address: isSet(object.address) ? globalThis.String(object.address) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventUndelegate { + return EventUndelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUndelegate { const message = createBaseEventUndelegate(); message.address = object.address ?? ""; @@ -414,50 +509,78 @@ export const EventRedelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventRedelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.from_staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.to_staker = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + address: isSet(object.address) ? globalThis.String(object.address) : "", + from_staker: isSet(object.from_staker) ? globalThis.String(object.from_staker) : "", + to_staker: isSet(object.to_staker) ? globalThis.String(object.to_staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.from_staker !== "") { + obj.from_staker = message.from_staker; + } + if (message.to_staker !== "") { + obj.to_staker = message.to_staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventRedelegate { + return EventRedelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventRedelegate { const message = createBaseEventRedelegate(); message.address = object.address ?? ""; @@ -487,45 +610,67 @@ export const EventWithdrawRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventWithdrawRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + address: isSet(object.address) ? globalThis.String(object.address) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventWithdrawRewards { + return EventWithdrawRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventWithdrawRewards { const message = createBaseEventWithdrawRewards(); message.address = object.address ?? ""; @@ -557,50 +702,78 @@ export const EventSlash = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventSlash { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.slash_type = slashTypeFromJSON(reader.int32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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)); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.slash_type !== SlashType.SLASH_TYPE_UNSPECIFIED) { + obj.slash_type = slashTypeToJSON(message.slash_type); + } return obj; }, + create, I>>(base?: I): EventSlash { + return EventSlash.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventSlash { const message = createBaseEventSlash(); message.pool_id = object.pool_id ?? "0"; @@ -614,7 +787,8 @@ export const EventSlash = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/genesis.ts b/common/types/src/lcd/kyve/delegation/v1beta1/genesis.ts index a94db103..26474063 100644 --- a/common/types/src/lcd/kyve/delegation/v1beta1/genesis.ts +++ b/common/types/src/lcd/kyve/delegation/v1beta1/genesis.ts @@ -16,7 +16,9 @@ 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; + params?: + | Params + | undefined; /** delegator_list ... */ delegator_list: Delegator[]; /** delegation_entry_list ... */ @@ -28,7 +30,9 @@ export interface GenesisState { /** undelegation_queue_entry_list ... */ undelegation_queue_entry_list: UndelegationQueueEntry[]; /** queue_state_undelegation ... */ - queue_state_undelegation?: QueueState; + queue_state_undelegation?: + | QueueState + | undefined; /** redelegation_cooldown_list ... */ redelegation_cooldown_list: RedelegationCooldown[]; } @@ -76,40 +80,73 @@ export const GenesisState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.delegator_list.push(Delegator.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.delegation_entry_list.push(DelegationEntry.decode(reader, reader.uint32())); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.delegation_data_list.push(DelegationData.decode(reader, reader.uint32())); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.delegation_slash_list.push(DelegationSlash.decode(reader, reader.uint32())); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.undelegation_queue_entry_list.push(UndelegationQueueEntry.decode(reader, reader.uint32())); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.queue_state_undelegation = QueueState.decode(reader, reader.uint32()); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.redelegation_cooldown_list.push(RedelegationCooldown.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -117,25 +154,25 @@ export const GenesisState = { fromJSON(object: any): GenesisState { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - delegator_list: Array.isArray(object?.delegator_list) + delegator_list: globalThis.Array.isArray(object?.delegator_list) ? object.delegator_list.map((e: any) => Delegator.fromJSON(e)) : [], - delegation_entry_list: Array.isArray(object?.delegation_entry_list) + delegation_entry_list: globalThis.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) + delegation_data_list: globalThis.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) + delegation_slash_list: globalThis.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) + undelegation_queue_entry_list: globalThis.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) + redelegation_cooldown_list: globalThis.Array.isArray(object?.redelegation_cooldown_list) ? object.redelegation_cooldown_list.map((e: any) => RedelegationCooldown.fromJSON(e)) : [], }; @@ -143,47 +180,38 @@ export const GenesisState = { 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) { + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.delegator_list?.length) { + obj.delegator_list = message.delegator_list.map((e) => Delegator.toJSON(e)); + } + if (message.delegation_entry_list?.length) { + obj.delegation_entry_list = message.delegation_entry_list.map((e) => DelegationEntry.toJSON(e)); + } + if (message.delegation_data_list?.length) { + obj.delegation_data_list = message.delegation_data_list.map((e) => DelegationData.toJSON(e)); + } + if (message.delegation_slash_list?.length) { + obj.delegation_slash_list = message.delegation_slash_list.map((e) => DelegationSlash.toJSON(e)); + } + if (message.undelegation_queue_entry_list?.length) { obj.undelegation_queue_entry_list = message.undelegation_queue_entry_list.map((e) => - e ? UndelegationQueueEntry.toJSON(e) : undefined + UndelegationQueueEntry.toJSON(e) ); - } 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 = []; + } + if (message.queue_state_undelegation !== undefined) { + obj.queue_state_undelegation = QueueState.toJSON(message.queue_state_undelegation); + } + if (message.redelegation_cooldown_list?.length) { + obj.redelegation_cooldown_list = message.redelegation_cooldown_list.map((e) => RedelegationCooldown.toJSON(e)); } return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) @@ -208,7 +236,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/params.ts b/common/types/src/lcd/kyve/delegation/v1beta1/params.ts index 5e5d02f5..9d495c1f 100644 --- a/common/types/src/lcd/kyve/delegation/v1beta1/params.ts +++ b/common/types/src/lcd/kyve/delegation/v1beta1/params.ts @@ -55,34 +55,59 @@ export const Params = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.unbonding_delegation_time = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.redelegation_cooldown = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.redelegation_max_amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.vote_slash = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.upload_slash = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.timeout_slash = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -90,28 +115,46 @@ export const Params = { fromJSON(object: any): Params { return { unbonding_delegation_time: isSet(object.unbonding_delegation_time) - ? String(object.unbonding_delegation_time) + ? globalThis.String(object.unbonding_delegation_time) + : "0", + redelegation_cooldown: isSet(object.redelegation_cooldown) + ? globalThis.String(object.redelegation_cooldown) + : "0", + redelegation_max_amount: isSet(object.redelegation_max_amount) + ? globalThis.String(object.redelegation_max_amount) : "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) : "", + vote_slash: isSet(object.vote_slash) ? globalThis.String(object.vote_slash) : "", + upload_slash: isSet(object.upload_slash) ? globalThis.String(object.upload_slash) : "", + timeout_slash: isSet(object.timeout_slash) ? globalThis.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); + if (message.unbonding_delegation_time !== "0") { + obj.unbonding_delegation_time = message.unbonding_delegation_time; + } + if (message.redelegation_cooldown !== "0") { + obj.redelegation_cooldown = message.redelegation_cooldown; + } + if (message.redelegation_max_amount !== "0") { + obj.redelegation_max_amount = message.redelegation_max_amount; + } + if (message.vote_slash !== "") { + obj.vote_slash = message.vote_slash; + } + if (message.upload_slash !== "") { + obj.upload_slash = message.upload_slash; + } + if (message.timeout_slash !== "") { + obj.timeout_slash = message.timeout_slash; + } return obj; }, + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Params { const message = createBaseParams(); message.unbonding_delegation_time = object.unbonding_delegation_time ?? "0"; @@ -127,7 +170,8 @@ export const Params = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/query.ts b/common/types/src/lcd/kyve/delegation/v1beta1/query.ts index b1b5f625..fa3a3652 100644 --- a/common/types/src/lcd/kyve/delegation/v1beta1/query.ts +++ b/common/types/src/lcd/kyve/delegation/v1beta1/query.ts @@ -11,7 +11,7 @@ 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; + params?: Params | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -24,16 +24,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -47,6 +48,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -66,19 +70,24 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -89,10 +98,15 @@ export const QueryParamsResponse = { toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) @@ -108,18 +122,19 @@ export interface Query { Params(request: QueryParamsRequest): Promise; } +export const QueryServiceName = "kyve.delegation.v1beta1.Query"; 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.service = opts?.service || QueryServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -130,7 +145,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/delegation/v1beta1/tx.ts b/common/types/src/lcd/kyve/delegation/v1beta1/tx.ts index 257ba0c5..12cbf4c9 100644 --- a/common/types/src/lcd/kyve/delegation/v1beta1/tx.ts +++ b/common/types/src/lcd/kyve/delegation/v1beta1/tx.ts @@ -94,45 +94,67 @@ export const MsgDelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgDelegate { + return MsgDelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgDelegate { const message = createBaseMsgDelegate(); message.creator = object.creator ?? ""; @@ -152,16 +174,17 @@ export const MsgDelegateResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -175,6 +198,9 @@ export const MsgDelegateResponse = { return obj; }, + create, I>>(base?: I): MsgDelegateResponse { + return MsgDelegateResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgDelegateResponse { const message = createBaseMsgDelegateResponse(); return message; @@ -197,40 +223,56 @@ export const MsgWithdrawRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgWithdrawRewards { return { - creator: isSet(object.creator) ? String(object.creator) : "", - staker: isSet(object.staker) ? String(object.staker) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", }; }, toJSON(message: MsgWithdrawRewards): unknown { const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.staker !== undefined && (obj.staker = message.staker); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } return obj; }, + create, I>>(base?: I): MsgWithdrawRewards { + return MsgWithdrawRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgWithdrawRewards { const message = createBaseMsgWithdrawRewards(); message.creator = object.creator ?? ""; @@ -249,16 +291,17 @@ export const MsgWithdrawRewardsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -272,6 +315,9 @@ export const MsgWithdrawRewardsResponse = { return obj; }, + create, I>>(base?: I): MsgWithdrawRewardsResponse { + return MsgWithdrawRewardsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgWithdrawRewardsResponse { const message = createBaseMsgWithdrawRewardsResponse(); return message; @@ -297,45 +343,67 @@ export const MsgUndelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgUndelegate { + return MsgUndelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUndelegate { const message = createBaseMsgUndelegate(); message.creator = object.creator ?? ""; @@ -355,16 +423,17 @@ export const MsgUndelegateResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -378,6 +447,9 @@ export const MsgUndelegateResponse = { return obj; }, + create, I>>(base?: I): MsgUndelegateResponse { + return MsgUndelegateResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUndelegateResponse { const message = createBaseMsgUndelegateResponse(); return message; @@ -406,50 +478,78 @@ export const MsgRedelegate = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgRedelegate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.from_staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.to_staker = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + from_staker: isSet(object.from_staker) ? globalThis.String(object.from_staker) : "", + to_staker: isSet(object.to_staker) ? globalThis.String(object.to_staker) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.from_staker !== "") { + obj.from_staker = message.from_staker; + } + if (message.to_staker !== "") { + obj.to_staker = message.to_staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgRedelegate { + return MsgRedelegate.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgRedelegate { const message = createBaseMsgRedelegate(); message.creator = object.creator ?? ""; @@ -470,16 +570,17 @@ export const MsgRedelegateResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgRedelegateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -493,6 +594,9 @@ export const MsgRedelegateResponse = { return obj; }, + create, I>>(base?: I): MsgRedelegateResponse { + return MsgRedelegateResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgRedelegateResponse { const message = createBaseMsgRedelegateResponse(); return message; @@ -515,40 +619,56 @@ export const MsgUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", - payload: isSet(object.payload) ? String(object.payload) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: MsgUpdateParams): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.payload !== undefined && (obj.payload = message.payload); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateParams { const message = createBaseMsgUpdateParams(); message.authority = object.authority ?? ""; @@ -567,16 +687,17 @@ export const MsgUpdateParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -590,6 +711,9 @@ export const MsgUpdateParamsResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateParamsResponse { const message = createBaseMsgUpdateParamsResponse(); return message; @@ -613,11 +737,12 @@ export interface Msg { UpdateParams(request: MsgUpdateParams): Promise; } +export const MsgServiceName = "kyve.delegation.v1beta1.Msg"; 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.service = opts?.service || MsgServiceName; this.rpc = rpc; this.Delegate = this.Delegate.bind(this); this.WithdrawRewards = this.WithdrawRewards.bind(this); @@ -628,31 +753,31 @@ export class MsgClientImpl implements Msg { 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))); + return promise.then((data) => MsgDelegateResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgWithdrawRewardsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUndelegateResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgRedelegateResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); } } @@ -663,7 +788,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/global/v1beta1/events.ts b/common/types/src/lcd/kyve/global/v1beta1/events.ts index 9c7b2481..0bdef677 100644 --- a/common/types/src/lcd/kyve/global/v1beta1/events.ts +++ b/common/types/src/lcd/kyve/global/v1beta1/events.ts @@ -10,9 +10,13 @@ export const protobufPackage = "kyve.global.v1beta1"; */ export interface EventUpdateParams { /** old_params is the module's old parameters. */ - old_params?: Params; + old_params?: + | Params + | undefined; /** new_params is the module's new parameters. */ - new_params?: Params; + new_params?: + | Params + | undefined; /** payload is the parameter updates that were performed. */ payload: string; } @@ -36,25 +40,38 @@ export const EventUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.old_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.new_params = Params.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -63,20 +80,27 @@ export const EventUpdateParams = { return { old_params: isSet(object.old_params) ? Params.fromJSON(object.old_params) : undefined, new_params: isSet(object.new_params) ? Params.fromJSON(object.new_params) : undefined, - payload: isSet(object.payload) ? String(object.payload) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: EventUpdateParams): unknown { const obj: any = {}; - message.old_params !== undefined && - (obj.old_params = message.old_params ? Params.toJSON(message.old_params) : undefined); - message.new_params !== undefined && - (obj.new_params = message.new_params ? Params.toJSON(message.new_params) : undefined); - message.payload !== undefined && (obj.payload = message.payload); + if (message.old_params !== undefined) { + obj.old_params = Params.toJSON(message.old_params); + } + if (message.new_params !== undefined) { + obj.new_params = Params.toJSON(message.new_params); + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): EventUpdateParams { + return EventUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateParams { const message = createBaseEventUpdateParams(); message.old_params = (object.old_params !== undefined && object.old_params !== null) @@ -93,7 +117,8 @@ export const EventUpdateParams = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/global/v1beta1/genesis.ts b/common/types/src/lcd/kyve/global/v1beta1/genesis.ts index e4cc420d..b71700a5 100644 --- a/common/types/src/lcd/kyve/global/v1beta1/genesis.ts +++ b/common/types/src/lcd/kyve/global/v1beta1/genesis.ts @@ -7,7 +7,7 @@ export const protobufPackage = "kyve.global.v1beta1"; /** GenesisState defines the global module's genesis state. */ export interface GenesisState { /** params defines all the parameters of the module. */ - params?: Params; + params?: Params | undefined; } function createBaseGenesisState(): GenesisState { @@ -23,19 +23,24 @@ export const GenesisState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -46,10 +51,15 @@ export const GenesisState = { toJSON(message: GenesisState): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) @@ -62,7 +72,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/global/v1beta1/global.ts b/common/types/src/lcd/kyve/global/v1beta1/global.ts index b8bbbf01..a23732b9 100644 --- a/common/types/src/lcd/kyve/global/v1beta1/global.ts +++ b/common/types/src/lcd/kyve/global/v1beta1/global.ts @@ -79,68 +79,95 @@ export const Params = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.min_gas_price = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.burn_ratio = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.gas_adjustments.push(GasAdjustment.decode(reader, reader.uint32())); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.gas_refunds.push(GasRefund.decode(reader, reader.uint32())); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.min_initial_deposit_ratio = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) + min_gas_price: isSet(object.min_gas_price) ? globalThis.String(object.min_gas_price) : "", + burn_ratio: isSet(object.burn_ratio) ? globalThis.String(object.burn_ratio) : "", + gas_adjustments: globalThis.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)) : [], + gas_refunds: globalThis.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) + ? globalThis.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.min_gas_price !== "") { + obj.min_gas_price = message.min_gas_price; } - if (message.gas_refunds) { - obj.gas_refunds = message.gas_refunds.map((e) => e ? GasRefund.toJSON(e) : undefined); - } else { - obj.gas_refunds = []; + if (message.burn_ratio !== "") { + obj.burn_ratio = message.burn_ratio; + } + if (message.gas_adjustments?.length) { + obj.gas_adjustments = message.gas_adjustments.map((e) => GasAdjustment.toJSON(e)); + } + if (message.gas_refunds?.length) { + obj.gas_refunds = message.gas_refunds.map((e) => GasRefund.toJSON(e)); + } + if (message.min_initial_deposit_ratio !== "") { + obj.min_initial_deposit_ratio = message.min_initial_deposit_ratio; } - message.min_initial_deposit_ratio !== undefined && - (obj.min_initial_deposit_ratio = message.min_initial_deposit_ratio); return obj; }, + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Params { const message = createBaseParams(); message.min_gas_price = object.min_gas_price ?? ""; @@ -168,40 +195,56 @@ export const GasAdjustment = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GasAdjustment { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.type = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): GasAdjustment { return { - type: isSet(object.type) ? String(object.type) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", + type: isSet(object.type) ? globalThis.String(object.type) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.type !== "") { + obj.type = message.type; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): GasAdjustment { + return GasAdjustment.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GasAdjustment { const message = createBaseGasAdjustment(); message.type = object.type ?? ""; @@ -226,40 +269,56 @@ export const GasRefund = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GasRefund { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.type = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.fraction = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): GasRefund { return { - type: isSet(object.type) ? String(object.type) : "", - fraction: isSet(object.fraction) ? String(object.fraction) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + fraction: isSet(object.fraction) ? globalThis.String(object.fraction) : "", }; }, toJSON(message: GasRefund): unknown { const obj: any = {}; - message.type !== undefined && (obj.type = message.type); - message.fraction !== undefined && (obj.fraction = message.fraction); + if (message.type !== "") { + obj.type = message.type; + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } return obj; }, + create, I>>(base?: I): GasRefund { + return GasRefund.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GasRefund { const message = createBaseGasRefund(); message.type = object.type ?? ""; @@ -271,7 +330,8 @@ export const GasRefund = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/global/v1beta1/query.ts b/common/types/src/lcd/kyve/global/v1beta1/query.ts index 252d319b..21b07e42 100644 --- a/common/types/src/lcd/kyve/global/v1beta1/query.ts +++ b/common/types/src/lcd/kyve/global/v1beta1/query.ts @@ -11,7 +11,7 @@ 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; + params?: Params | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -24,16 +24,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -47,6 +48,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -66,19 +70,24 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -89,10 +98,15 @@ export const QueryParamsResponse = { toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) @@ -108,18 +122,19 @@ export interface Query { Params(request: QueryParamsRequest): Promise; } +export const QueryServiceName = "kyve.global.v1beta1.Query"; export class QueryClientImpl implements Query { private readonly rpc: Rpc; private readonly service: string; constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || "kyve.global.v1beta1.Query"; + this.service = opts?.service || QueryServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -130,7 +145,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/global/v1beta1/tx.ts b/common/types/src/lcd/kyve/global/v1beta1/tx.ts index 8f4a9bba..054f931a 100644 --- a/common/types/src/lcd/kyve/global/v1beta1/tx.ts +++ b/common/types/src/lcd/kyve/global/v1beta1/tx.ts @@ -31,40 +31,56 @@ export const MsgUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", - payload: isSet(object.payload) ? String(object.payload) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: MsgUpdateParams): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.payload !== undefined && (obj.payload = message.payload); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateParams { const message = createBaseMsgUpdateParams(); message.authority = object.authority ?? ""; @@ -83,16 +99,17 @@ export const MsgUpdateParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -106,6 +123,9 @@ export const MsgUpdateParamsResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateParamsResponse { const message = createBaseMsgUpdateParamsResponse(); return message; @@ -122,18 +142,19 @@ export interface Msg { UpdateParams(request: MsgUpdateParams): Promise; } +export const MsgServiceName = "kyve.global.v1beta1.Msg"; export class MsgClientImpl implements Msg { private readonly rpc: Rpc; private readonly service: string; constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || "kyve.global.v1beta1.Msg"; + this.service = opts?.service || MsgServiceName; 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))); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); } } @@ -144,7 +165,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/pool/v1beta1/events.ts b/common/types/src/lcd/kyve/pool/v1beta1/events.ts index 9e7bf445..de015888 100644 --- a/common/types/src/lcd/kyve/pool/v1beta1/events.ts +++ b/common/types/src/lcd/kyve/pool/v1beta1/events.ts @@ -11,9 +11,13 @@ export const protobufPackage = "kyve.pool.v1beta1"; */ export interface EventUpdateParams { /** old_params is the module's old parameters. */ - old_params?: Params; + old_params?: + | Params + | undefined; /** new_params is the module's new parameters. */ - new_params?: Params; + new_params?: + | Params + | undefined; /** payload is the parameter updates that were performed. */ payload: string; } @@ -251,25 +255,38 @@ export const EventUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.old_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.new_params = Params.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -278,20 +295,27 @@ export const EventUpdateParams = { return { old_params: isSet(object.old_params) ? Params.fromJSON(object.old_params) : undefined, new_params: isSet(object.new_params) ? Params.fromJSON(object.new_params) : undefined, - payload: isSet(object.payload) ? String(object.payload) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: EventUpdateParams): unknown { const obj: any = {}; - message.old_params !== undefined && - (obj.old_params = message.old_params ? Params.toJSON(message.old_params) : undefined); - message.new_params !== undefined && - (obj.new_params = message.new_params ? Params.toJSON(message.new_params) : undefined); - message.payload !== undefined && (obj.payload = message.payload); + if (message.old_params !== undefined) { + obj.old_params = Params.toJSON(message.old_params); + } + if (message.new_params !== undefined) { + obj.new_params = Params.toJSON(message.new_params); + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): EventUpdateParams { + return EventUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateParams { const message = createBaseEventUpdateParams(); message.old_params = (object.old_params !== undefined && object.old_params !== null) @@ -372,100 +396,188 @@ export const EventCreatePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventCreatePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.name = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.runtime = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.logo = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.config = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.start_key = reader.string(); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.upload_interval = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.operating_cost = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.min_delegation = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.max_bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.version = reader.string(); - break; + continue; case 12: + if (tag !== 98) { + break; + } + message.binaries = reader.string(); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 14: + if (tag !== 112) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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, + id: isSet(object.id) ? globalThis.String(object.id) : "0", + name: isSet(object.name) ? globalThis.String(object.name) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + logo: isSet(object.logo) ? globalThis.String(object.logo) : "", + config: isSet(object.config) ? globalThis.String(object.config) : "", + start_key: isSet(object.start_key) ? globalThis.String(object.start_key) : "", + upload_interval: isSet(object.upload_interval) ? globalThis.String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? globalThis.String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? globalThis.String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? globalThis.String(object.max_bundle_size) : "0", + version: isSet(object.version) ? globalThis.String(object.version) : "", + binaries: isSet(object.binaries) ? globalThis.String(object.binaries) : "", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.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)); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.logo !== "") { + obj.logo = message.logo; + } + if (message.config !== "") { + obj.config = message.config; + } + if (message.start_key !== "") { + obj.start_key = message.start_key; + } + if (message.upload_interval !== "0") { + obj.upload_interval = message.upload_interval; + } + if (message.operating_cost !== "0") { + obj.operating_cost = message.operating_cost; + } + if (message.min_delegation !== "0") { + obj.min_delegation = message.min_delegation; + } + if (message.max_bundle_size !== "0") { + obj.max_bundle_size = message.max_bundle_size; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } return obj; }, + create, I>>(base?: I): EventCreatePool { + return EventCreatePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventCreatePool { const message = createBaseEventCreatePool(); message.id = object.id ?? "0"; @@ -499,33 +611,43 @@ export const EventPoolEnabled = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolEnabled { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventPoolEnabled(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventPoolEnabled { - return { id: isSet(object.id) ? String(object.id) : "0" }; + return { id: isSet(object.id) ? globalThis.String(object.id) : "0" }; }, toJSON(message: EventPoolEnabled): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): EventPoolEnabled { + return EventPoolEnabled.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPoolEnabled { const message = createBaseEventPoolEnabled(); message.id = object.id ?? "0"; @@ -546,33 +668,43 @@ export const EventPoolDisabled = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolDisabled { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventPoolDisabled(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventPoolDisabled { - return { id: isSet(object.id) ? String(object.id) : "0" }; + return { id: isSet(object.id) ? globalThis.String(object.id) : "0" }; }, toJSON(message: EventPoolDisabled): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): EventPoolDisabled { + return EventPoolDisabled.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPoolDisabled { const message = createBaseEventPoolDisabled(); message.id = object.id ?? "0"; @@ -610,71 +742,112 @@ export const EventRuntimeUpgradeScheduled = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventRuntimeUpgradeScheduled { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventRuntimeUpgradeScheduled(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.runtime = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.version = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.scheduled_at = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.duration = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.binaries = reader.string(); - break; + continue; case 6: - if ((tag & 7) === 2) { + if (tag === 48) { + message.affected_pools.push(longToString(reader.uint64() as Long)); + + continue; + } + + if (tag === 50) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.affected_pools.push(longToString(reader.uint64() as Long)); } - } else { - message.affected_pools.push(longToString(reader.uint64() as Long)); + + continue; } + break; - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventRuntimeUpgradeScheduled { return { - 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) : "", - affected_pools: Array.isArray(object?.affected_pools) ? object.affected_pools.map((e: any) => String(e)) : [], + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + scheduled_at: isSet(object.scheduled_at) ? globalThis.String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? globalThis.String(object.duration) : "0", + binaries: isSet(object.binaries) ? globalThis.String(object.binaries) : "", + affected_pools: globalThis.Array.isArray(object?.affected_pools) + ? object.affected_pools.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EventRuntimeUpgradeScheduled): unknown { const obj: any = {}; - 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); - if (message.affected_pools) { - obj.affected_pools = message.affected_pools.map((e) => e); - } else { - obj.affected_pools = []; + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.scheduled_at !== "0") { + obj.scheduled_at = message.scheduled_at; + } + if (message.duration !== "0") { + obj.duration = message.duration; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } + if (message.affected_pools?.length) { + obj.affected_pools = message.affected_pools; } return obj; }, + create, I>>(base?: I): EventRuntimeUpgradeScheduled { + return EventRuntimeUpgradeScheduled.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventRuntimeUpgradeScheduled { const message = createBaseEventRuntimeUpgradeScheduled(); message.runtime = object.runtime ?? ""; @@ -705,51 +878,68 @@ export const EventRuntimeUpgradeCancelled = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventRuntimeUpgradeCancelled { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventRuntimeUpgradeCancelled(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.runtime = reader.string(); - break; + continue; case 2: - if ((tag & 7) === 2) { + if (tag === 16) { + message.affected_pools.push(longToString(reader.uint64() as Long)); + + continue; + } + + if (tag === 18) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.affected_pools.push(longToString(reader.uint64() as Long)); } - } else { - message.affected_pools.push(longToString(reader.uint64() as Long)); + + continue; } - break; - default: - reader.skipType(tag & 7); + break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventRuntimeUpgradeCancelled { return { - runtime: isSet(object.runtime) ? String(object.runtime) : "", - affected_pools: Array.isArray(object?.affected_pools) ? object.affected_pools.map((e: any) => String(e)) : [], + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + affected_pools: globalThis.Array.isArray(object?.affected_pools) + ? object.affected_pools.map((e: any) => globalThis.String(e)) + : [], }; }, toJSON(message: EventRuntimeUpgradeCancelled): unknown { const obj: any = {}; - message.runtime !== undefined && (obj.runtime = message.runtime); - if (message.affected_pools) { - obj.affected_pools = message.affected_pools.map((e) => e); - } else { - obj.affected_pools = []; + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.affected_pools?.length) { + obj.affected_pools = message.affected_pools; } return obj; }, + create, I>>(base?: I): EventRuntimeUpgradeCancelled { + return EventRuntimeUpgradeCancelled.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventRuntimeUpgradeCancelled { const message = createBaseEventRuntimeUpgradeCancelled(); message.runtime = object.runtime ?? ""; @@ -817,90 +1007,166 @@ export const EventPoolUpdated = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolUpdated { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventPoolUpdated(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.raw_update_string = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.name = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.runtime = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.logo = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.config = reader.string(); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.upload_interval = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.operating_cost = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.min_delegation = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.max_bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 88) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventPoolUpdated { return { - id: isSet(object.id) ? String(object.id) : "0", - raw_update_string: isSet(object.raw_update_string) ? String(object.raw_update_string) : "", - 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) : "", - 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", - 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, + id: isSet(object.id) ? globalThis.String(object.id) : "0", + raw_update_string: isSet(object.raw_update_string) ? globalThis.String(object.raw_update_string) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + logo: isSet(object.logo) ? globalThis.String(object.logo) : "", + config: isSet(object.config) ? globalThis.String(object.config) : "", + upload_interval: isSet(object.upload_interval) ? globalThis.String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? globalThis.String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? globalThis.String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? globalThis.String(object.max_bundle_size) : "0", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.Number(object.compression_id) : 0, }; }, toJSON(message: EventPoolUpdated): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); - message.raw_update_string !== undefined && (obj.raw_update_string = message.raw_update_string); - 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.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.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)); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.raw_update_string !== "") { + obj.raw_update_string = message.raw_update_string; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.logo !== "") { + obj.logo = message.logo; + } + if (message.config !== "") { + obj.config = message.config; + } + if (message.upload_interval !== "0") { + obj.upload_interval = message.upload_interval; + } + if (message.operating_cost !== "0") { + obj.operating_cost = message.operating_cost; + } + if (message.min_delegation !== "0") { + obj.min_delegation = message.min_delegation; + } + if (message.max_bundle_size !== "0") { + obj.max_bundle_size = message.max_bundle_size; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } return obj; }, + create, I>>(base?: I): EventPoolUpdated { + return EventPoolUpdated.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPoolUpdated { const message = createBaseEventPoolUpdated(); message.id = object.id ?? "0"; @@ -938,45 +1204,67 @@ export const EventFundPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventFundPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.address = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.address !== "") { + obj.address = message.address; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventFundPool { + return EventFundPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventFundPool { const message = createBaseEventFundPool(); message.pool_id = object.pool_id ?? "0"; @@ -1005,45 +1293,67 @@ export const EventDefundPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventDefundPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.address = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.address !== "") { + obj.address = message.address; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventDefundPool { + return EventDefundPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventDefundPool { const message = createBaseEventDefundPool(); message.pool_id = object.pool_id ?? "0"; @@ -1072,45 +1382,67 @@ export const EventPoolFundsSlashed = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolFundsSlashed { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.address = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.address !== "") { + obj.address = message.address; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventPoolFundsSlashed { + return EventPoolFundsSlashed.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPoolFundsSlashed { const message = createBaseEventPoolFundsSlashed(); message.pool_id = object.pool_id ?? "0"; @@ -1133,33 +1465,43 @@ export const EventPoolOutOfFunds = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventPoolOutOfFunds { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventPoolOutOfFunds { - return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + return { pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0" }; }, toJSON(message: EventPoolOutOfFunds): unknown { const obj: any = {}; - message.pool_id !== undefined && (obj.pool_id = message.pool_id); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } return obj; }, + create, I>>(base?: I): EventPoolOutOfFunds { + return EventPoolOutOfFunds.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventPoolOutOfFunds { const message = createBaseEventPoolOutOfFunds(); message.pool_id = object.pool_id ?? "0"; @@ -1170,7 +1512,8 @@ export const EventPoolOutOfFunds = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/pool/v1beta1/genesis.ts b/common/types/src/lcd/kyve/pool/v1beta1/genesis.ts index 31057598..10b7383f 100644 --- a/common/types/src/lcd/kyve/pool/v1beta1/genesis.ts +++ b/common/types/src/lcd/kyve/pool/v1beta1/genesis.ts @@ -9,7 +9,9 @@ export const protobufPackage = "kyve.pool.v1beta1"; /** GenesisState defines the pool module's genesis state. */ export interface GenesisState { /** params ... */ - params?: Params; + params?: + | Params + | undefined; /** pool_list ... */ pool_list: Pool[]; /** pool_count ... */ @@ -35,25 +37,38 @@ export const GenesisState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pool_list.push(Pool.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_count = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -61,23 +76,28 @@ export const GenesisState = { fromJSON(object: any): GenesisState { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - 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", + pool_list: globalThis.Array.isArray(object?.pool_list) ? object.pool_list.map((e: any) => Pool.fromJSON(e)) : [], + pool_count: isSet(object.pool_count) ? globalThis.String(object.pool_count) : "0", }; }, toJSON(message: GenesisState): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); - if (message.pool_list) { - obj.pool_list = message.pool_list.map((e) => e ? Pool.toJSON(e) : undefined); - } else { - obj.pool_list = []; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.pool_list?.length) { + obj.pool_list = message.pool_list.map((e) => Pool.toJSON(e)); + } + if (message.pool_count !== "0") { + obj.pool_count = message.pool_count; } - message.pool_count !== undefined && (obj.pool_count = message.pool_count); return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) @@ -92,7 +112,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/pool/v1beta1/params.ts b/common/types/src/lcd/kyve/pool/v1beta1/params.ts index eef68351..67eb92d7 100644 --- a/common/types/src/lcd/kyve/pool/v1beta1/params.ts +++ b/common/types/src/lcd/kyve/pool/v1beta1/params.ts @@ -27,43 +27,60 @@ export const Params = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.protocol_inflation_share = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pool_inflation_payout_rate = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Params { return { - protocol_inflation_share: isSet(object.protocol_inflation_share) ? String(object.protocol_inflation_share) : "", + protocol_inflation_share: isSet(object.protocol_inflation_share) + ? globalThis.String(object.protocol_inflation_share) + : "", pool_inflation_payout_rate: isSet(object.pool_inflation_payout_rate) - ? String(object.pool_inflation_payout_rate) + ? globalThis.String(object.pool_inflation_payout_rate) : "", }; }, toJSON(message: Params): unknown { const obj: any = {}; - message.protocol_inflation_share !== undefined && (obj.protocol_inflation_share = message.protocol_inflation_share); - message.pool_inflation_payout_rate !== undefined && - (obj.pool_inflation_payout_rate = message.pool_inflation_payout_rate); + if (message.protocol_inflation_share !== "") { + obj.protocol_inflation_share = message.protocol_inflation_share; + } + if (message.pool_inflation_payout_rate !== "") { + obj.pool_inflation_payout_rate = message.pool_inflation_payout_rate; + } return obj; }, + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Params { const message = createBaseParams(); message.protocol_inflation_share = object.protocol_inflation_share ?? ""; @@ -75,7 +92,8 @@ export const Params = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/pool/v1beta1/pool.ts b/common/types/src/lcd/kyve/pool/v1beta1/pool.ts index b9fa8b56..5d73618b 100644 --- a/common/types/src/lcd/kyve/pool/v1beta1/pool.ts +++ b/common/types/src/lcd/kyve/pool/v1beta1/pool.ts @@ -177,9 +177,13 @@ export interface Pool { /** total_funds ... */ total_funds: string; /** protocol ... */ - protocol?: Protocol; + protocol?: + | Protocol + | undefined; /** upgrade_plan ... */ - upgrade_plan?: UpgradePlan; + upgrade_plan?: + | UpgradePlan + | undefined; /** storage_provider_id ... */ current_storage_provider_id: number; /** compression_id ... */ @@ -205,45 +209,67 @@ export const Protocol = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Protocol { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.version = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.binaries = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.last_upgrade = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + version: isSet(object.version) ? globalThis.String(object.version) : "", + binaries: isSet(object.binaries) ? globalThis.String(object.binaries) : "", + last_upgrade: isSet(object.last_upgrade) ? globalThis.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); + if (message.version !== "") { + obj.version = message.version; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } + if (message.last_upgrade !== "0") { + obj.last_upgrade = message.last_upgrade; + } return obj; }, + create, I>>(base?: I): Protocol { + return Protocol.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Protocol { const message = createBaseProtocol(); message.version = object.version ?? ""; @@ -275,50 +301,78 @@ export const UpgradePlan = { }, decode(input: _m0.Reader | Uint8Array, length?: number): UpgradePlan { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.version = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.binaries = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.scheduled_at = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.duration = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + version: isSet(object.version) ? globalThis.String(object.version) : "", + binaries: isSet(object.binaries) ? globalThis.String(object.binaries) : "", + scheduled_at: isSet(object.scheduled_at) ? globalThis.String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? globalThis.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); + if (message.version !== "") { + obj.version = message.version; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } + if (message.scheduled_at !== "0") { + obj.scheduled_at = message.scheduled_at; + } + if (message.duration !== "0") { + obj.duration = message.duration; + } return obj; }, + create, I>>(base?: I): UpgradePlan { + return UpgradePlan.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): UpgradePlan { const message = createBaseUpgradePlan(); message.version = object.version ?? ""; @@ -345,40 +399,56 @@ export const Funder = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Funder { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Funder { return { - address: isSet(object.address) ? String(object.address) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.address !== "") { + obj.address = message.address; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): Funder { + return Funder.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Funder { const message = createBaseFunder(); message.address = object.address ?? ""; @@ -482,144 +552,269 @@ export const Pool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Pool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.name = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.runtime = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.logo = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.config = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.start_key = reader.string(); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.current_key = reader.string(); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.current_summary = reader.string(); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.current_index = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.total_bundles = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 88) { + break; + } + message.upload_interval = longToString(reader.uint64() as Long); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.operating_cost = longToString(reader.uint64() as Long); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.min_delegation = longToString(reader.uint64() as Long); - break; + continue; case 14: + if (tag !== 112) { + break; + } + message.max_bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 15: + if (tag !== 120) { + break; + } + message.disabled = reader.bool(); - break; + continue; case 16: + if (tag !== 130) { + break; + } + message.funders.push(Funder.decode(reader, reader.uint32())); - break; + continue; case 17: + if (tag !== 136) { + break; + } + message.total_funds = longToString(reader.uint64() as Long); - break; + continue; case 18: + if (tag !== 146) { + break; + } + message.protocol = Protocol.decode(reader, reader.uint32()); - break; + continue; case 19: + if (tag !== 154) { + break; + } + message.upgrade_plan = UpgradePlan.decode(reader, reader.uint32()); - break; + continue; case 20: + if (tag !== 160) { + break; + } + message.current_storage_provider_id = reader.uint32(); - break; + continue; case 21: + if (tag !== 168) { + break; + } + message.current_compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", - disabled: isSet(object.disabled) ? Boolean(object.disabled) : 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", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + name: isSet(object.name) ? globalThis.String(object.name) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + logo: isSet(object.logo) ? globalThis.String(object.logo) : "", + config: isSet(object.config) ? globalThis.String(object.config) : "", + start_key: isSet(object.start_key) ? globalThis.String(object.start_key) : "", + current_key: isSet(object.current_key) ? globalThis.String(object.current_key) : "", + current_summary: isSet(object.current_summary) ? globalThis.String(object.current_summary) : "", + current_index: isSet(object.current_index) ? globalThis.String(object.current_index) : "0", + total_bundles: isSet(object.total_bundles) ? globalThis.String(object.total_bundles) : "0", + upload_interval: isSet(object.upload_interval) ? globalThis.String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? globalThis.String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? globalThis.String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? globalThis.String(object.max_bundle_size) : "0", + disabled: isSet(object.disabled) ? globalThis.Boolean(object.disabled) : false, + funders: globalThis.Array.isArray(object?.funders) ? object.funders.map((e: any) => Funder.fromJSON(e)) : [], + total_funds: isSet(object.total_funds) ? globalThis.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) + ? globalThis.Number(object.current_storage_provider_id) + : 0, + current_compression_id: isSet(object.current_compression_id) + ? globalThis.Number(object.current_compression_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.disabled !== undefined && (obj.disabled = message.disabled); - 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)); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.logo !== "") { + obj.logo = message.logo; + } + if (message.config !== "") { + obj.config = message.config; + } + if (message.start_key !== "") { + obj.start_key = message.start_key; + } + if (message.current_key !== "") { + obj.current_key = message.current_key; + } + if (message.current_summary !== "") { + obj.current_summary = message.current_summary; + } + if (message.current_index !== "0") { + obj.current_index = message.current_index; + } + if (message.total_bundles !== "0") { + obj.total_bundles = message.total_bundles; + } + if (message.upload_interval !== "0") { + obj.upload_interval = message.upload_interval; + } + if (message.operating_cost !== "0") { + obj.operating_cost = message.operating_cost; + } + if (message.min_delegation !== "0") { + obj.min_delegation = message.min_delegation; + } + if (message.max_bundle_size !== "0") { + obj.max_bundle_size = message.max_bundle_size; + } + if (message.disabled === true) { + obj.disabled = message.disabled; + } + if (message.funders?.length) { + obj.funders = message.funders.map((e) => Funder.toJSON(e)); + } + if (message.total_funds !== "0") { + obj.total_funds = message.total_funds; + } + if (message.protocol !== undefined) { + obj.protocol = Protocol.toJSON(message.protocol); + } + if (message.upgrade_plan !== undefined) { + obj.upgrade_plan = UpgradePlan.toJSON(message.upgrade_plan); + } + if (message.current_storage_provider_id !== 0) { + obj.current_storage_provider_id = Math.round(message.current_storage_provider_id); + } + if (message.current_compression_id !== 0) { + obj.current_compression_id = Math.round(message.current_compression_id); + } return obj; }, + create, I>>(base?: I): Pool { + return Pool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Pool { const message = createBasePool(); message.id = object.id ?? "0"; @@ -654,7 +849,8 @@ export const Pool = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/pool/v1beta1/query.ts b/common/types/src/lcd/kyve/pool/v1beta1/query.ts index b6783ff7..07d65355 100644 --- a/common/types/src/lcd/kyve/pool/v1beta1/query.ts +++ b/common/types/src/lcd/kyve/pool/v1beta1/query.ts @@ -11,7 +11,7 @@ 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; + params?: Params | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -24,16 +24,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -47,6 +48,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -66,19 +70,24 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -89,10 +98,15 @@ export const QueryParamsResponse = { toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) @@ -108,18 +122,19 @@ export interface Query { Params(request: QueryParamsRequest): Promise; } +export const QueryServiceName = "kyve.pool.v1beta1.Query"; export class QueryClientImpl implements Query { private readonly rpc: Rpc; private readonly service: string; constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || "kyve.pool.v1beta1.Query"; + this.service = opts?.service || QueryServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -130,7 +145,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/pool/v1beta1/tx.ts b/common/types/src/lcd/kyve/pool/v1beta1/tx.ts index 49d2c23c..39300bdb 100644 --- a/common/types/src/lcd/kyve/pool/v1beta1/tx.ts +++ b/common/types/src/lcd/kyve/pool/v1beta1/tx.ts @@ -169,45 +169,67 @@ export const MsgFundPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgFundPool { + return MsgFundPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgFundPool { const message = createBaseMsgFundPool(); message.creator = object.creator ?? ""; @@ -227,16 +249,17 @@ export const MsgFundPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -250,6 +273,9 @@ export const MsgFundPoolResponse = { return obj; }, + create, I>>(base?: I): MsgFundPoolResponse { + return MsgFundPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgFundPoolResponse { const message = createBaseMsgFundPoolResponse(); return message; @@ -275,45 +301,67 @@ export const MsgDefundPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDefundPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgDefundPool { + return MsgDefundPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgDefundPool { const message = createBaseMsgDefundPool(); message.creator = object.creator ?? ""; @@ -333,16 +381,17 @@ export const MsgDefundPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDefundPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -356,6 +405,9 @@ export const MsgDefundPoolResponse = { return obj; }, + create, I>>(base?: I): MsgDefundPoolResponse { + return MsgDefundPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgDefundPoolResponse { const message = createBaseMsgDefundPoolResponse(); return message; @@ -429,100 +481,188 @@ export const MsgCreatePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.name = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.runtime = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.logo = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.config = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.start_key = reader.string(); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.upload_interval = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.operating_cost = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.min_delegation = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.max_bundle_size = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 90) { + break; + } + message.version = reader.string(); - break; + continue; case 12: + if (tag !== 98) { + break; + } + message.binaries = reader.string(); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.storage_provider_id = reader.uint32(); - break; + continue; case 14: + if (tag !== 112) { + break; + } + message.compression_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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, + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + logo: isSet(object.logo) ? globalThis.String(object.logo) : "", + config: isSet(object.config) ? globalThis.String(object.config) : "", + start_key: isSet(object.start_key) ? globalThis.String(object.start_key) : "", + upload_interval: isSet(object.upload_interval) ? globalThis.String(object.upload_interval) : "0", + operating_cost: isSet(object.operating_cost) ? globalThis.String(object.operating_cost) : "0", + min_delegation: isSet(object.min_delegation) ? globalThis.String(object.min_delegation) : "0", + max_bundle_size: isSet(object.max_bundle_size) ? globalThis.String(object.max_bundle_size) : "0", + version: isSet(object.version) ? globalThis.String(object.version) : "", + binaries: isSet(object.binaries) ? globalThis.String(object.binaries) : "", + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.Number(object.storage_provider_id) : 0, + compression_id: isSet(object.compression_id) ? globalThis.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)); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.logo !== "") { + obj.logo = message.logo; + } + if (message.config !== "") { + obj.config = message.config; + } + if (message.start_key !== "") { + obj.start_key = message.start_key; + } + if (message.upload_interval !== "0") { + obj.upload_interval = message.upload_interval; + } + if (message.operating_cost !== "0") { + obj.operating_cost = message.operating_cost; + } + if (message.min_delegation !== "0") { + obj.min_delegation = message.min_delegation; + } + if (message.max_bundle_size !== "0") { + obj.max_bundle_size = message.max_bundle_size; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } + if (message.compression_id !== 0) { + obj.compression_id = Math.round(message.compression_id); + } return obj; }, + create, I>>(base?: I): MsgCreatePool { + return MsgCreatePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgCreatePool { const message = createBaseMsgCreatePool(); message.authority = object.authority ?? ""; @@ -553,16 +693,17 @@ export const MsgCreatePoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreatePoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -576,6 +717,9 @@ export const MsgCreatePoolResponse = { return obj; }, + create, I>>(base?: I): MsgCreatePoolResponse { + return MsgCreatePoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgCreatePoolResponse { const message = createBaseMsgCreatePoolResponse(); return message; @@ -601,45 +745,67 @@ export const MsgUpdatePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdatePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + payload: isSet(object.payload) ? globalThis.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); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdatePool { + return MsgUpdatePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdatePool { const message = createBaseMsgUpdatePool(); message.authority = object.authority ?? ""; @@ -659,16 +825,17 @@ export const MsgUpdatePoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdatePoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -682,6 +849,9 @@ export const MsgUpdatePoolResponse = { return obj; }, + create, I>>(base?: I): MsgUpdatePoolResponse { + return MsgUpdatePoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdatePoolResponse { const message = createBaseMsgUpdatePoolResponse(); return message; @@ -704,40 +874,56 @@ export const MsgDisablePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDisablePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDisablePool(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgDisablePool { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", }; }, toJSON(message: MsgDisablePool): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): MsgDisablePool { + return MsgDisablePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgDisablePool { const message = createBaseMsgDisablePool(); message.authority = object.authority ?? ""; @@ -756,16 +942,17 @@ export const MsgDisablePoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgDisablePoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgDisablePoolResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -779,6 +966,9 @@ export const MsgDisablePoolResponse = { return obj; }, + create, I>>(base?: I): MsgDisablePoolResponse { + return MsgDisablePoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgDisablePoolResponse { const message = createBaseMsgDisablePoolResponse(); return message; @@ -801,40 +991,56 @@ export const MsgEnablePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgEnablePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgEnablePool(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgEnablePool { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", }; }, toJSON(message: MsgEnablePool): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): MsgEnablePool { + return MsgEnablePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgEnablePool { const message = createBaseMsgEnablePool(); message.authority = object.authority ?? ""; @@ -853,16 +1059,17 @@ export const MsgEnablePoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgEnablePoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgEnablePoolResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -876,6 +1083,9 @@ export const MsgEnablePoolResponse = { return obj; }, + create, I>>(base?: I): MsgEnablePoolResponse { + return MsgEnablePoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgEnablePoolResponse { const message = createBaseMsgEnablePoolResponse(); return message; @@ -910,60 +1120,100 @@ export const MsgScheduleRuntimeUpgrade = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgScheduleRuntimeUpgrade { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.runtime = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.version = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.scheduled_at = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.duration = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.binaries = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + scheduled_at: isSet(object.scheduled_at) ? globalThis.String(object.scheduled_at) : "0", + duration: isSet(object.duration) ? globalThis.String(object.duration) : "0", + binaries: isSet(object.binaries) ? globalThis.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); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.scheduled_at !== "0") { + obj.scheduled_at = message.scheduled_at; + } + if (message.duration !== "0") { + obj.duration = message.duration; + } + if (message.binaries !== "") { + obj.binaries = message.binaries; + } return obj; }, + create, I>>(base?: I): MsgScheduleRuntimeUpgrade { + return MsgScheduleRuntimeUpgrade.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgScheduleRuntimeUpgrade { const message = createBaseMsgScheduleRuntimeUpgrade(); message.authority = object.authority ?? ""; @@ -986,16 +1236,17 @@ export const MsgScheduleRuntimeUpgradeResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgScheduleRuntimeUpgradeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -1009,6 +1260,11 @@ export const MsgScheduleRuntimeUpgradeResponse = { return obj; }, + create, I>>( + base?: I, + ): MsgScheduleRuntimeUpgradeResponse { + return MsgScheduleRuntimeUpgradeResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( _: I, ): MsgScheduleRuntimeUpgradeResponse { @@ -1033,40 +1289,56 @@ export const MsgCancelRuntimeUpgrade = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelRuntimeUpgrade { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.runtime = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgCancelRuntimeUpgrade { return { - authority: isSet(object.authority) ? String(object.authority) : "", - runtime: isSet(object.runtime) ? String(object.runtime) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", }; }, toJSON(message: MsgCancelRuntimeUpgrade): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.runtime !== undefined && (obj.runtime = message.runtime); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } return obj; }, + create, I>>(base?: I): MsgCancelRuntimeUpgrade { + return MsgCancelRuntimeUpgrade.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgCancelRuntimeUpgrade { const message = createBaseMsgCancelRuntimeUpgrade(); message.authority = object.authority ?? ""; @@ -1085,16 +1357,17 @@ export const MsgCancelRuntimeUpgradeResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelRuntimeUpgradeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -1108,6 +1381,9 @@ export const MsgCancelRuntimeUpgradeResponse = { return obj; }, + create, I>>(base?: I): MsgCancelRuntimeUpgradeResponse { + return MsgCancelRuntimeUpgradeResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgCancelRuntimeUpgradeResponse { const message = createBaseMsgCancelRuntimeUpgradeResponse(); return message; @@ -1130,40 +1406,56 @@ export const MsgUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", - payload: isSet(object.payload) ? String(object.payload) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: MsgUpdateParams): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.payload !== undefined && (obj.payload = message.payload); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateParams { const message = createBaseMsgUpdateParams(); message.authority = object.authority ?? ""; @@ -1182,16 +1474,17 @@ export const MsgUpdateParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -1205,6 +1498,9 @@ export const MsgUpdateParamsResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateParamsResponse { const message = createBaseMsgUpdateParamsResponse(); return message; @@ -1254,11 +1550,12 @@ export interface Msg { UpdateParams(request: MsgUpdateParams): Promise; } +export const MsgServiceName = "kyve.pool.v1beta1.Msg"; 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.service = opts?.service || MsgServiceName; this.rpc = rpc; this.FundPool = this.FundPool.bind(this); this.DefundPool = this.DefundPool.bind(this); @@ -1273,55 +1570,55 @@ export class MsgClientImpl implements Msg { 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))); + return promise.then((data) => MsgFundPoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgDefundPoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgCreatePoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdatePoolResponse.decode(_m0.Reader.create(data))); } DisablePool(request: MsgDisablePool): Promise { const data = MsgDisablePool.encode(request).finish(); const promise = this.rpc.request(this.service, "DisablePool", data); - return promise.then((data) => MsgDisablePoolResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgDisablePoolResponse.decode(_m0.Reader.create(data))); } EnablePool(request: MsgEnablePool): Promise { const data = MsgEnablePool.encode(request).finish(); const promise = this.rpc.request(this.service, "EnablePool", data); - return promise.then((data) => MsgEnablePoolResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgEnablePoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgScheduleRuntimeUpgradeResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgCancelRuntimeUpgradeResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); } } @@ -1332,7 +1629,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/query/v1beta1/account.ts b/common/types/src/lcd/kyve/query/v1beta1/account.ts index 1a12e74d..b58d92db 100644 --- a/common/types/src/lcd/kyve/query/v1beta1/account.ts +++ b/common/types/src/lcd/kyve/query/v1beta1/account.ts @@ -33,7 +33,9 @@ export interface QueryAccountAssetsResponse { /** QueryAccountFundedListRequest ... */ export interface QueryAccountDelegationUnbondingsRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: + | PageRequest + | undefined; /** address ... */ address: string; } @@ -43,7 +45,7 @@ export interface QueryAccountDelegationUnbondingsResponse { /** balance ... */ unbondings: DelegationUnbonding[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** QueryAccountAssetsResponse is the response type for the Query/AccountAssets RPC method. */ @@ -53,7 +55,7 @@ export interface DelegationUnbonding { /** creation_time */ creation_time: string; /** staker */ - staker?: FullStaker; + staker?: FullStaker | undefined; } /** QueryAccountFundedListRequest is the request type for the account queries with pagination */ @@ -73,7 +75,7 @@ export interface Funded { /** amount ... */ amount: string; /** pool ... */ - pool?: BasicPool; + pool?: BasicPool | undefined; } /** QueryAccountDelegationListRequest ... */ @@ -111,33 +113,43 @@ export const QueryAccountAssetsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountAssetsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountAssetsRequest { - return { address: isSet(object.address) ? String(object.address) : "" }; + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, toJSON(message: QueryAccountAssetsRequest): unknown { const obj: any = {}; - message.address !== undefined && (obj.address = message.address); + if (message.address !== "") { + obj.address = message.address; + } return obj; }, + create, I>>(base?: I): QueryAccountAssetsRequest { + return QueryAccountAssetsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryAccountAssetsRequest { const message = createBaseQueryAccountAssetsRequest(); message.address = object.address ?? ""; @@ -184,71 +196,117 @@ export const QueryAccountAssetsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountAssetsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.balance = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.protocol_self_delegation = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.protocol_self_delegation_unbonding = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.protocol_delegation = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.protocol_delegation_unbonding = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.protocol_rewards = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.protocol_funding = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + balance: isSet(object.balance) ? globalThis.String(object.balance) : "0", + protocol_self_delegation: isSet(object.protocol_self_delegation) + ? globalThis.String(object.protocol_self_delegation) + : "0", protocol_self_delegation_unbonding: isSet(object.protocol_self_delegation_unbonding) - ? String(object.protocol_self_delegation_unbonding) + ? globalThis.String(object.protocol_self_delegation_unbonding) : "0", - protocol_delegation: isSet(object.protocol_delegation) ? String(object.protocol_delegation) : "0", + protocol_delegation: isSet(object.protocol_delegation) ? globalThis.String(object.protocol_delegation) : "0", protocol_delegation_unbonding: isSet(object.protocol_delegation_unbonding) - ? String(object.protocol_delegation_unbonding) + ? globalThis.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", + protocol_rewards: isSet(object.protocol_rewards) ? globalThis.String(object.protocol_rewards) : "0", + protocol_funding: isSet(object.protocol_funding) ? globalThis.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); + if (message.balance !== "0") { + obj.balance = message.balance; + } + if (message.protocol_self_delegation !== "0") { + obj.protocol_self_delegation = message.protocol_self_delegation; + } + if (message.protocol_self_delegation_unbonding !== "0") { + obj.protocol_self_delegation_unbonding = message.protocol_self_delegation_unbonding; + } + if (message.protocol_delegation !== "0") { + obj.protocol_delegation = message.protocol_delegation; + } + if (message.protocol_delegation_unbonding !== "0") { + obj.protocol_delegation_unbonding = message.protocol_delegation_unbonding; + } + if (message.protocol_rewards !== "0") { + obj.protocol_rewards = message.protocol_rewards; + } + if (message.protocol_funding !== "0") { + obj.protocol_funding = message.protocol_funding; + } return obj; }, + create, I>>(base?: I): QueryAccountAssetsResponse { + return QueryAccountAssetsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryAccountAssetsResponse { const message = createBaseQueryAccountAssetsResponse(); message.balance = object.balance ?? "0"; @@ -278,22 +336,31 @@ export const QueryAccountDelegationUnbondingsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountDelegationUnbondingsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -301,18 +368,26 @@ export const QueryAccountDelegationUnbondingsRequest = { fromJSON(object: any): QueryAccountDelegationUnbondingsRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - address: isSet(object.address) ? String(object.address) : "", + address: isSet(object.address) ? globalThis.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); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.address !== "") { + obj.address = message.address; + } return obj; }, + create, I>>( + base?: I, + ): QueryAccountDelegationUnbondingsRequest { + return QueryAccountDelegationUnbondingsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountDelegationUnbondingsRequest { @@ -341,29 +416,38 @@ export const QueryAccountDelegationUnbondingsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountDelegationUnbondingsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.unbondings.push(DelegationUnbonding.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountDelegationUnbondingsResponse { return { - unbondings: Array.isArray(object?.unbondings) + unbondings: globalThis.Array.isArray(object?.unbondings) ? object.unbondings.map((e: any) => DelegationUnbonding.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, @@ -372,16 +456,20 @@ export const QueryAccountDelegationUnbondingsResponse = { toJSON(message: QueryAccountDelegationUnbondingsResponse): unknown { const obj: any = {}; - if (message.unbondings) { - obj.unbondings = message.unbondings.map((e) => e ? DelegationUnbonding.toJSON(e) : undefined); - } else { - obj.unbondings = []; + if (message.unbondings?.length) { + obj.unbondings = message.unbondings.map((e) => DelegationUnbonding.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>( + base?: I, + ): QueryAccountDelegationUnbondingsResponse { + return QueryAccountDelegationUnbondingsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountDelegationUnbondingsResponse { @@ -413,45 +501,67 @@ export const DelegationUnbonding = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegationUnbonding { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.creation_time = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.staker = FullStaker.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + creation_time: isSet(object.creation_time) ? globalThis.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); + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.creation_time !== "0") { + obj.creation_time = message.creation_time; + } + if (message.staker !== undefined) { + obj.staker = FullStaker.toJSON(message.staker); + } return obj; }, + create, I>>(base?: I): DelegationUnbonding { + return DelegationUnbonding.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DelegationUnbonding { const message = createBaseDelegationUnbonding(); message.amount = object.amount ?? "0"; @@ -476,33 +586,43 @@ export const QueryAccountFundedListRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountFundedListRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountFundedListRequest { - return { address: isSet(object.address) ? String(object.address) : "" }; + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, toJSON(message: QueryAccountFundedListRequest): unknown { const obj: any = {}; - message.address !== undefined && (obj.address = message.address); + if (message.address !== "") { + obj.address = message.address; + } return obj; }, + create, I>>(base?: I): QueryAccountFundedListRequest { + return QueryAccountFundedListRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountFundedListRequest { @@ -525,37 +645,45 @@ export const QueryAccountFundedListResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountFundedListResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.funded.push(Funded.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountFundedListResponse { - return { funded: Array.isArray(object?.funded) ? object.funded.map((e: any) => Funded.fromJSON(e)) : [] }; + return { + funded: globalThis.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 = []; + if (message.funded?.length) { + obj.funded = message.funded.map((e) => Funded.toJSON(e)); } return obj; }, + create, I>>(base?: I): QueryAccountFundedListResponse { + return QueryAccountFundedListResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountFundedListResponse { @@ -581,40 +709,56 @@ export const Funded = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Funded { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pool = BasicPool.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Funded { return { - amount: isSet(object.amount) ? String(object.amount) : "0", + amount: isSet(object.amount) ? globalThis.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); + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.pool !== undefined) { + obj.pool = BasicPool.toJSON(message.pool); + } return obj; }, + create, I>>(base?: I): Funded { + return Funded.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Funded { const message = createBaseFunded(); message.amount = object.amount ?? "0"; @@ -636,33 +780,43 @@ export const QueryAccountRedelegationRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRedelegationRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountRedelegationRequest { - return { address: isSet(object.address) ? String(object.address) : "" }; + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, toJSON(message: QueryAccountRedelegationRequest): unknown { const obj: any = {}; - message.address !== undefined && (obj.address = message.address); + if (message.address !== "") { + obj.address = message.address; + } return obj; }, + create, I>>(base?: I): QueryAccountRedelegationRequest { + return QueryAccountRedelegationRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountRedelegationRequest { @@ -688,48 +842,60 @@ export const QueryAccountRedelegationResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRedelegationResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.redelegation_cooldown_entries.push(RedelegationEntry.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.available_slots = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryAccountRedelegationResponse { return { - redelegation_cooldown_entries: Array.isArray(object?.redelegation_cooldown_entries) + redelegation_cooldown_entries: globalThis.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", + available_slots: isSet(object.available_slots) ? globalThis.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); + if (message.redelegation_cooldown_entries?.length) { + obj.redelegation_cooldown_entries = message.redelegation_cooldown_entries.map((e) => RedelegationEntry.toJSON(e)); + } + if (message.available_slots !== "0") { + obj.available_slots = message.available_slots; + } return obj; }, + create, I>>( + base?: I, + ): QueryAccountRedelegationResponse { + return QueryAccountRedelegationResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryAccountRedelegationResponse { @@ -757,40 +923,56 @@ export const RedelegationEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.creation_date = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.finish_date = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creation_date: isSet(object.creation_date) ? globalThis.String(object.creation_date) : "0", + finish_date: isSet(object.finish_date) ? globalThis.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); + if (message.creation_date !== "0") { + obj.creation_date = message.creation_date; + } + if (message.finish_date !== "0") { + obj.finish_date = message.finish_date; + } return obj; }, + create, I>>(base?: I): RedelegationEntry { + return RedelegationEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): RedelegationEntry { const message = createBaseRedelegationEntry(); message.creation_date = object.creation_date ?? "0"; @@ -813,11 +995,12 @@ export interface QueryAccount { AccountRedelegation(request: QueryAccountRedelegationRequest): Promise; } +export const QueryAccountServiceName = "kyve.query.v1beta1.QueryAccount"; 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.service = opts?.service || QueryAccountServiceName; this.rpc = rpc; this.AccountAssets = this.AccountAssets.bind(this); this.AccountDelegationUnbondings = this.AccountDelegationUnbondings.bind(this); @@ -827,7 +1010,7 @@ export class QueryAccountClientImpl implements QueryAccount { 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))); + return promise.then((data) => QueryAccountAssetsResponse.decode(_m0.Reader.create(data))); } AccountDelegationUnbondings( @@ -835,19 +1018,19 @@ export class QueryAccountClientImpl implements QueryAccount { ): 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))); + return promise.then((data) => QueryAccountDelegationUnbondingsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryAccountFundedListResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryAccountRedelegationResponse.decode(_m0.Reader.create(data))); } } @@ -858,7 +1041,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/query/v1beta1/bundles.ts b/common/types/src/lcd/kyve/query/v1beta1/bundles.ts index fa32d124..bce7c561 100644 --- a/common/types/src/lcd/kyve/query/v1beta1/bundles.ts +++ b/common/types/src/lcd/kyve/query/v1beta1/bundles.ts @@ -2,16 +2,78 @@ 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"; +/** FinalizedBundle represents the latest version of a valid bundle of a pool */ +export interface FinalizedBundle { + /** pool_id in which the bundle was created */ + pool_id: string; + /** id is is integrated with each valid bundle produced. */ + id: string; + /** storage_id is the id with which the data can be retrieved from the configured data provider */ + 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; + /** from_key is the key of the first data item in the bundle proposal */ + from_key: string; + /** to_key the key of the last data item in the bundle */ + to_key: string; + /** bundle_summary is a summary of the bundle. */ + bundle_summary: string; + /** data_hash is a sha256 hash of the uploaded data. */ + data_hash: string; + /** finalized_at contains details of the block that finalized this bundle. */ + finalized_at?: + | FinalizedAt + | undefined; + /** storage_provider_id the id of the storage provider where the bundle is stored */ + storage_provider_id: string; + /** compression_id the id of the compression type with which the data was compressed */ + compression_id: string; + /** + * stake_security defines the amount of stake which was present in the pool during the finalization of the bundle. + * This field was added in schema version 2. Bundles finalized before that return `null`. + */ + stake_security?: StakeSecurity | undefined; +} + +/** FinalizedAt stores information about finalization block and time. */ +export interface FinalizedAt { + /** height is the block height in which the bundle got finalized. */ + height: string; + /** timestamp is the UNIX timestamp of the block in which the bundle got finalized. */ + timestamp: string; +} + +/** StakeSecurity represents the relative security of a finalized bundle */ +export interface StakeSecurity { + /** valid_vote_power gives the amount of $KYVE stake that voted `valid`. */ + valid_vote_power: string; + /** + * total_vote_power gives the amount of total $KYVE stake that was present in the pool + * during finalization. + */ + total_vote_power: string; +} + /** QueryFinalizedBundlesRequest is the request type for the Query/Staker RPC method. */ export interface QueryFinalizedBundlesRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: + | PageRequest + | undefined; /** pool_id ... */ pool_id: string; + /** + * index is an optional parameter which tells the server to only show + * the bundle with the given index. This can not be combined with pagination. + */ + index: string; } /** QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. */ @@ -19,7 +81,7 @@ export interface QueryFinalizedBundlesResponse { /** finalized_bundles ... */ finalized_bundles: FinalizedBundle[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** QueryFinalizedBundleRequest is the request type for the Query/Staker RPC method. */ @@ -32,22 +94,8 @@ export interface QueryFinalizedBundleRequest { /** 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; + /** finalized_bundles ... */ + finalized_bundles?: FinalizedBundle | undefined; } /** QueryCurrentVoteStatusRequest is the request type for the Query/Staker RPC method. */ @@ -124,8 +172,429 @@ export interface QueryCanVoteResponse { reason: string; } +function createBaseFinalizedBundle(): FinalizedBundle { + return { + pool_id: "0", + id: "0", + storage_id: "", + uploader: "", + from_index: "0", + to_index: "0", + from_key: "", + to_key: "", + bundle_summary: "", + data_hash: "", + finalized_at: undefined, + storage_provider_id: "0", + compression_id: "0", + stake_security: undefined, + }; +} + +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.from_key !== "") { + writer.uint32(90).string(message.from_key); + } + 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 !== undefined) { + FinalizedAt.encode(message.finalized_at, writer.uint32(82).fork()).ldelim(); + } + if (message.storage_provider_id !== "0") { + writer.uint32(96).uint64(message.storage_provider_id); + } + if (message.compression_id !== "0") { + writer.uint32(104).uint64(message.compression_id); + } + if (message.stake_security !== undefined) { + StakeSecurity.encode(message.stake_security, writer.uint32(114).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FinalizedBundle { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + + message.pool_id = longToString(reader.uint64() as Long); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.id = longToString(reader.uint64() as Long); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.storage_id = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.uploader = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.from_index = longToString(reader.uint64() as Long); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.to_index = longToString(reader.uint64() as Long); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.from_key = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.to_key = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.bundle_summary = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.data_hash = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.finalized_at = FinalizedAt.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.storage_provider_id = longToString(reader.uint64() as Long); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.compression_id = longToString(reader.uint64() as Long); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.stake_security = StakeSecurity.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FinalizedBundle { + return { + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + storage_id: isSet(object.storage_id) ? globalThis.String(object.storage_id) : "", + uploader: isSet(object.uploader) ? globalThis.String(object.uploader) : "", + from_index: isSet(object.from_index) ? globalThis.String(object.from_index) : "0", + to_index: isSet(object.to_index) ? globalThis.String(object.to_index) : "0", + from_key: isSet(object.from_key) ? globalThis.String(object.from_key) : "", + to_key: isSet(object.to_key) ? globalThis.String(object.to_key) : "", + bundle_summary: isSet(object.bundle_summary) ? globalThis.String(object.bundle_summary) : "", + data_hash: isSet(object.data_hash) ? globalThis.String(object.data_hash) : "", + finalized_at: isSet(object.finalized_at) ? FinalizedAt.fromJSON(object.finalized_at) : undefined, + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.String(object.storage_provider_id) : "0", + compression_id: isSet(object.compression_id) ? globalThis.String(object.compression_id) : "0", + stake_security: isSet(object.stake_security) ? StakeSecurity.fromJSON(object.stake_security) : undefined, + }; + }, + + toJSON(message: FinalizedBundle): unknown { + const obj: any = {}; + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } + if (message.uploader !== "") { + obj.uploader = message.uploader; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } + if (message.to_index !== "0") { + obj.to_index = message.to_index; + } + if (message.from_key !== "") { + obj.from_key = message.from_key; + } + if (message.to_key !== "") { + obj.to_key = message.to_key; + } + if (message.bundle_summary !== "") { + obj.bundle_summary = message.bundle_summary; + } + if (message.data_hash !== "") { + obj.data_hash = message.data_hash; + } + if (message.finalized_at !== undefined) { + obj.finalized_at = FinalizedAt.toJSON(message.finalized_at); + } + if (message.storage_provider_id !== "0") { + obj.storage_provider_id = message.storage_provider_id; + } + if (message.compression_id !== "0") { + obj.compression_id = message.compression_id; + } + if (message.stake_security !== undefined) { + obj.stake_security = StakeSecurity.toJSON(message.stake_security); + } + return obj; + }, + + create, I>>(base?: I): FinalizedBundle { + return FinalizedBundle.fromPartial(base ?? ({} as any)); + }, + 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.from_key = object.from_key ?? ""; + message.to_key = object.to_key ?? ""; + message.bundle_summary = object.bundle_summary ?? ""; + message.data_hash = object.data_hash ?? ""; + message.finalized_at = (object.finalized_at !== undefined && object.finalized_at !== null) + ? FinalizedAt.fromPartial(object.finalized_at) + : undefined; + message.storage_provider_id = object.storage_provider_id ?? "0"; + message.compression_id = object.compression_id ?? "0"; + message.stake_security = (object.stake_security !== undefined && object.stake_security !== null) + ? StakeSecurity.fromPartial(object.stake_security) + : undefined; + return message; + }, +}; + +function createBaseFinalizedAt(): FinalizedAt { + return { height: "", timestamp: "" }; +} + +export const FinalizedAt = { + encode(message: FinalizedAt, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.height !== "") { + writer.uint32(10).string(message.height); + } + if (message.timestamp !== "") { + writer.uint32(18).string(message.timestamp); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FinalizedAt { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFinalizedAt(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.height = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.timestamp = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FinalizedAt { + return { + height: isSet(object.height) ? globalThis.String(object.height) : "", + timestamp: isSet(object.timestamp) ? globalThis.String(object.timestamp) : "", + }; + }, + + toJSON(message: FinalizedAt): unknown { + const obj: any = {}; + if (message.height !== "") { + obj.height = message.height; + } + if (message.timestamp !== "") { + obj.timestamp = message.timestamp; + } + return obj; + }, + + create, I>>(base?: I): FinalizedAt { + return FinalizedAt.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FinalizedAt { + const message = createBaseFinalizedAt(); + message.height = object.height ?? ""; + message.timestamp = object.timestamp ?? ""; + return message; + }, +}; + +function createBaseStakeSecurity(): StakeSecurity { + return { valid_vote_power: "", total_vote_power: "" }; +} + +export const StakeSecurity = { + encode(message: StakeSecurity, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.valid_vote_power !== "") { + writer.uint32(10).string(message.valid_vote_power); + } + if (message.total_vote_power !== "") { + writer.uint32(18).string(message.total_vote_power); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StakeSecurity { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeSecurity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.valid_vote_power = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total_vote_power = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeSecurity { + return { + valid_vote_power: isSet(object.valid_vote_power) ? globalThis.String(object.valid_vote_power) : "", + total_vote_power: isSet(object.total_vote_power) ? globalThis.String(object.total_vote_power) : "", + }; + }, + + toJSON(message: StakeSecurity): unknown { + const obj: any = {}; + if (message.valid_vote_power !== "") { + obj.valid_vote_power = message.valid_vote_power; + } + if (message.total_vote_power !== "") { + obj.total_vote_power = message.total_vote_power; + } + return obj; + }, + + create, I>>(base?: I): StakeSecurity { + return StakeSecurity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeSecurity { + const message = createBaseStakeSecurity(); + message.valid_vote_power = object.valid_vote_power ?? ""; + message.total_vote_power = object.total_vote_power ?? ""; + return message; + }, +}; + function createBaseQueryFinalizedBundlesRequest(): QueryFinalizedBundlesRequest { - return { pagination: undefined, pool_id: "0" }; + return { pagination: undefined, pool_id: "0", index: "" }; } export const QueryFinalizedBundlesRequest = { @@ -136,26 +605,45 @@ export const QueryFinalizedBundlesRequest = { if (message.pool_id !== "0") { writer.uint32(16).uint64(message.pool_id); } + if (message.index !== "") { + writer.uint32(26).string(message.index); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.index = reader.string(); + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -163,24 +651,35 @@ export const QueryFinalizedBundlesRequest = { 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + index: isSet(object.index) ? globalThis.String(object.index) : "", }; }, 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); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.index !== "") { + obj.index = message.index; + } return obj; }, + create, I>>(base?: I): QueryFinalizedBundlesRequest { + return QueryFinalizedBundlesRequest.fromPartial(base ?? ({} as any)); + }, 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"; + message.index = object.index ?? ""; return message; }, }; @@ -201,29 +700,38 @@ export const QueryFinalizedBundlesResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundlesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.finalized_bundles.push(FinalizedBundle.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryFinalizedBundlesResponse { return { - finalized_bundles: Array.isArray(object?.finalized_bundles) + finalized_bundles: globalThis.Array.isArray(object?.finalized_bundles) ? object.finalized_bundles.map((e: any) => FinalizedBundle.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, @@ -232,16 +740,18 @@ export const QueryFinalizedBundlesResponse = { 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 = []; + if (message.finalized_bundles?.length) { + obj.finalized_bundles = message.finalized_bundles.map((e) => FinalizedBundle.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryFinalizedBundlesResponse { + return QueryFinalizedBundlesResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryFinalizedBundlesResponse { @@ -270,40 +780,56 @@ export const QueryFinalizedBundleRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryFinalizedBundleRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + id: isSet(object.id) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): QueryFinalizedBundleRequest { + return QueryFinalizedBundleRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryFinalizedBundleRequest { const message = createBaseQueryFinalizedBundleRequest(); message.pool_id = object.pool_id ?? "0"; @@ -313,166 +839,63 @@ export const QueryFinalizedBundleRequest = { }; function createBaseQueryFinalizedBundleResponse(): QueryFinalizedBundleResponse { - return { finalized_bundle: undefined }; + return { finalized_bundles: 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(); + if (message.finalized_bundles !== undefined) { + FinalizedBundle.encode(message.finalized_bundles, 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); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; + if (tag !== 10) { + break; + } + + message.finalized_bundles = FinalizedBundle.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryFinalizedBundleResponse { return { - finalized_bundle: isSet(object.finalized_bundle) ? FinalizedBundle.fromJSON(object.finalized_bundle) : undefined, + finalized_bundles: isSet(object.finalized_bundles) + ? FinalizedBundle.fromJSON(object.finalized_bundles) + : 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.finalized_bundles !== undefined) { + obj.finalized_bundles = FinalizedBundle.toJSON(message.finalized_bundles); } - 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, - }; + create, I>>(base?: I): QueryFinalizedBundleResponse { + return QueryFinalizedBundleResponse.fromPartial(base ?? ({} as any)); }, - - 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) + fromPartial, I>>(object: I): QueryFinalizedBundleResponse { + const message = createBaseQueryFinalizedBundleResponse(); + message.finalized_bundles = (object.finalized_bundles !== undefined && object.finalized_bundles !== null) + ? FinalizedBundle.fromPartial(object.finalized_bundles) : undefined; return message; }, @@ -491,33 +914,43 @@ export const QueryCurrentVoteStatusRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentVoteStatusRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryCurrentVoteStatusRequest { - return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + return { pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0" }; }, toJSON(message: QueryCurrentVoteStatusRequest): unknown { const obj: any = {}; - message.pool_id !== undefined && (obj.pool_id = message.pool_id); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } return obj; }, + create, I>>(base?: I): QueryCurrentVoteStatusRequest { + return QueryCurrentVoteStatusRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryCurrentVoteStatusRequest { @@ -549,50 +982,78 @@ export const QueryCurrentVoteStatusResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentVoteStatusResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.valid = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.invalid = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.abstain = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.total = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + valid: isSet(object.valid) ? globalThis.String(object.valid) : "0", + invalid: isSet(object.invalid) ? globalThis.String(object.invalid) : "0", + abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "0", + total: isSet(object.total) ? globalThis.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); + if (message.valid !== "0") { + obj.valid = message.valid; + } + if (message.invalid !== "0") { + obj.invalid = message.invalid; + } + if (message.abstain !== "0") { + obj.abstain = message.abstain; + } + if (message.total !== "0") { + obj.total = message.total; + } return obj; }, + create, I>>(base?: I): QueryCurrentVoteStatusResponse { + return QueryCurrentVoteStatusResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryCurrentVoteStatusResponse { @@ -621,40 +1082,56 @@ export const QueryCanValidateRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanValidateRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.valaddress = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + valaddress: isSet(object.valaddress) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.valaddress !== "") { + obj.valaddress = message.valaddress; + } return obj; }, + create, I>>(base?: I): QueryCanValidateRequest { + return QueryCanValidateRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanValidateRequest { const message = createBaseQueryCanValidateRequest(); message.pool_id = object.pool_id ?? "0"; @@ -679,40 +1156,56 @@ export const QueryCanValidateResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanValidateResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.possible = reader.bool(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.reason = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryCanValidateResponse { return { - possible: isSet(object.possible) ? Boolean(object.possible) : false, - reason: isSet(object.reason) ? String(object.reason) : "", + possible: isSet(object.possible) ? globalThis.Boolean(object.possible) : false, + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", }; }, toJSON(message: QueryCanValidateResponse): unknown { const obj: any = {}; - message.possible !== undefined && (obj.possible = message.possible); - message.reason !== undefined && (obj.reason = message.reason); + if (message.possible === true) { + obj.possible = message.possible; + } + if (message.reason !== "") { + obj.reason = message.reason; + } return obj; }, + create, I>>(base?: I): QueryCanValidateResponse { + return QueryCanValidateResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanValidateResponse { const message = createBaseQueryCanValidateResponse(); message.possible = object.possible ?? false; @@ -743,50 +1236,78 @@ export const QueryCanProposeRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanProposeRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.proposer = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.from_index = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + from_index: isSet(object.from_index) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.from_index !== "0") { + obj.from_index = message.from_index; + } return obj; }, + create, I>>(base?: I): QueryCanProposeRequest { + return QueryCanProposeRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanProposeRequest { const message = createBaseQueryCanProposeRequest(); message.pool_id = object.pool_id ?? "0"; @@ -813,40 +1334,56 @@ export const QueryCanProposeResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanProposeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.possible = reader.bool(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.reason = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryCanProposeResponse { return { - possible: isSet(object.possible) ? Boolean(object.possible) : false, - reason: isSet(object.reason) ? String(object.reason) : "", + possible: isSet(object.possible) ? globalThis.Boolean(object.possible) : false, + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", }; }, toJSON(message: QueryCanProposeResponse): unknown { const obj: any = {}; - message.possible !== undefined && (obj.possible = message.possible); - message.reason !== undefined && (obj.reason = message.reason); + if (message.possible === true) { + obj.possible = message.possible; + } + if (message.reason !== "") { + obj.reason = message.reason; + } return obj; }, + create, I>>(base?: I): QueryCanProposeResponse { + return QueryCanProposeResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanProposeResponse { const message = createBaseQueryCanProposeResponse(); message.possible = object.possible ?? false; @@ -877,50 +1414,78 @@ export const QueryCanVoteRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanVoteRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.voter = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.storage_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + storage_id: isSet(object.storage_id) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.storage_id !== "") { + obj.storage_id = message.storage_id; + } return obj; }, + create, I>>(base?: I): QueryCanVoteRequest { + return QueryCanVoteRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanVoteRequest { const message = createBaseQueryCanVoteRequest(); message.pool_id = object.pool_id ?? "0"; @@ -947,40 +1512,56 @@ export const QueryCanVoteResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCanVoteResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.possible = reader.bool(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.reason = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryCanVoteResponse { return { - possible: isSet(object.possible) ? Boolean(object.possible) : false, - reason: isSet(object.reason) ? String(object.reason) : "", + possible: isSet(object.possible) ? globalThis.Boolean(object.possible) : false, + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", }; }, toJSON(message: QueryCanVoteResponse): unknown { const obj: any = {}; - message.possible !== undefined && (obj.possible = message.possible); - message.reason !== undefined && (obj.reason = message.reason); + if (message.possible === true) { + obj.possible = message.possible; + } + if (message.reason !== "") { + obj.reason = message.reason; + } return obj; }, + create, I>>(base?: I): QueryCanVoteResponse { + return QueryCanVoteResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryCanVoteResponse { const message = createBaseQueryCanVoteResponse(); message.possible = object.possible ?? false; @@ -992,13 +1573,9 @@ export const QueryCanVoteResponse = { /** QueryDelegation contains all rpc requests related to direct delegation data */ export interface QueryBundles { /** FinalizedBundles ... */ - FinalizedBundles(request: QueryFinalizedBundlesRequest): Promise; + FinalizedBundlesQuery(request: QueryFinalizedBundlesRequest): Promise; /** FinalizedBundle ... */ - FinalizedBundle(request: QueryFinalizedBundleRequest): Promise; - /** Queries the bundle which contains the data given height */ - FinalizedBundlesByHeight( - request: QueryFinalizedBundlesByHeightRequest, - ): Promise; + FinalizedBundleQuery(request: QueryFinalizedBundleRequest): Promise; /** CurrentVoteStatus ... */ CurrentVoteStatus(request: QueryCurrentVoteStatusRequest): Promise; /** CanValidate ... */ @@ -1009,62 +1586,54 @@ export interface QueryBundles { CanVote(request: QueryCanVoteRequest): Promise; } +export const QueryBundlesServiceName = "kyve.query.v1beta1.QueryBundles"; 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.service = opts?.service || QueryBundlesServiceName; this.rpc = rpc; - this.FinalizedBundles = this.FinalizedBundles.bind(this); - this.FinalizedBundle = this.FinalizedBundle.bind(this); - this.FinalizedBundlesByHeight = this.FinalizedBundlesByHeight.bind(this); + this.FinalizedBundlesQuery = this.FinalizedBundlesQuery.bind(this); + this.FinalizedBundleQuery = this.FinalizedBundleQuery.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 { + FinalizedBundlesQuery(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))); + const promise = this.rpc.request(this.service, "FinalizedBundlesQuery", data); + return promise.then((data) => QueryFinalizedBundlesResponse.decode(_m0.Reader.create(data))); } - FinalizedBundle(request: QueryFinalizedBundleRequest): Promise { + FinalizedBundleQuery(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))); + const promise = this.rpc.request(this.service, "FinalizedBundleQuery", data); + return promise.then((data) => FinalizedBundle.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryCurrentVoteStatusResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryCanValidateResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryCanProposeResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryCanVoteResponse.decode(_m0.Reader.create(data))); } } @@ -1075,7 +1644,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/query/v1beta1/delegation.ts b/common/types/src/lcd/kyve/query/v1beta1/delegation.ts index 5c87d5b4..853a9025 100644 --- a/common/types/src/lcd/kyve/query/v1beta1/delegation.ts +++ b/common/types/src/lcd/kyve/query/v1beta1/delegation.ts @@ -17,7 +17,7 @@ export interface QueryDelegatorRequest { /** QueryDelegatorResponse is the response type for the Query/Delegator RPC method. */ export interface QueryDelegatorResponse { /** delegator ... */ - delegator?: StakerDelegatorResponse; + delegator?: StakerDelegatorResponse | undefined; } /** StakerDelegatorResponse ... */ @@ -35,7 +35,9 @@ export interface StakerDelegatorResponse { /** QueryDelegatorsByStakerRequest ... */ export interface QueryDelegatorsByStakerRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: + | PageRequest + | undefined; /** staker ... */ staker: string; } @@ -49,13 +51,15 @@ export interface QueryDelegatorsByStakerResponse { /** total_delegation ... */ total_delegator_count: string; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** QueryStakersByDelegatorRequest ... */ export interface QueryStakersByDelegatorRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: + | PageRequest + | undefined; /** delegator ... */ delegator: string; } @@ -67,13 +71,15 @@ export interface QueryStakersByDelegatorResponse { /** stakers ... */ stakers: DelegationForStakerResponse[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** DelegationForStakerResponse ... */ export interface DelegationForStakerResponse { /** staker ... */ - staker?: FullStaker; + staker?: + | FullStaker + | undefined; /** current_reward ... */ current_reward: string; /** delegation_amount ... */ @@ -96,40 +102,56 @@ export const QueryDelegatorRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.delegator = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryDelegatorRequest { return { - staker: isSet(object.staker) ? String(object.staker) : "", - delegator: isSet(object.delegator) ? String(object.delegator) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + delegator: isSet(object.delegator) ? globalThis.String(object.delegator) : "", }; }, toJSON(message: QueryDelegatorRequest): unknown { const obj: any = {}; - message.staker !== undefined && (obj.staker = message.staker); - message.delegator !== undefined && (obj.delegator = message.delegator); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.delegator !== "") { + obj.delegator = message.delegator; + } return obj; }, + create, I>>(base?: I): QueryDelegatorRequest { + return QueryDelegatorRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDelegatorRequest { const message = createBaseQueryDelegatorRequest(); message.staker = object.staker ?? ""; @@ -151,19 +173,24 @@ export const QueryDelegatorResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.delegator = StakerDelegatorResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -174,11 +201,15 @@ export const QueryDelegatorResponse = { toJSON(message: QueryDelegatorResponse): unknown { const obj: any = {}; - message.delegator !== undefined && - (obj.delegator = message.delegator ? StakerDelegatorResponse.toJSON(message.delegator) : undefined); + if (message.delegator !== undefined) { + obj.delegator = StakerDelegatorResponse.toJSON(message.delegator); + } return obj; }, + create, I>>(base?: I): QueryDelegatorResponse { + return QueryDelegatorResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryDelegatorResponse { const message = createBaseQueryDelegatorResponse(); message.delegator = (object.delegator !== undefined && object.delegator !== null) @@ -210,50 +241,78 @@ export const StakerDelegatorResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): StakerDelegatorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.delegator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.current_reward = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.delegation_amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.staker = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + delegator: isSet(object.delegator) ? globalThis.String(object.delegator) : "", + current_reward: isSet(object.current_reward) ? globalThis.String(object.current_reward) : "0", + delegation_amount: isSet(object.delegation_amount) ? globalThis.String(object.delegation_amount) : "0", + staker: isSet(object.staker) ? globalThis.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); + if (message.delegator !== "") { + obj.delegator = message.delegator; + } + if (message.current_reward !== "0") { + obj.current_reward = message.current_reward; + } + if (message.delegation_amount !== "0") { + obj.delegation_amount = message.delegation_amount; + } + if (message.staker !== "") { + obj.staker = message.staker; + } return obj; }, + create, I>>(base?: I): StakerDelegatorResponse { + return StakerDelegatorResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): StakerDelegatorResponse { const message = createBaseStakerDelegatorResponse(); message.delegator = object.delegator ?? ""; @@ -280,22 +339,31 @@ export const QueryDelegatorsByStakerRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorsByStakerRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -303,18 +371,24 @@ export const QueryDelegatorsByStakerRequest = { fromJSON(object: any): QueryDelegatorsByStakerRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - staker: isSet(object.staker) ? String(object.staker) : "", + staker: isSet(object.staker) ? globalThis.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); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.staker !== "") { + obj.staker = message.staker; + } return obj; }, + create, I>>(base?: I): QueryDelegatorsByStakerRequest { + return QueryDelegatorsByStakerRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryDelegatorsByStakerRequest { @@ -349,57 +423,82 @@ export const QueryDelegatorsByStakerResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorsByStakerResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.delegators.push(StakerDelegatorResponse.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.total_delegation = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.total_delegator_count = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryDelegatorsByStakerResponse { return { - delegators: Array.isArray(object?.delegators) + delegators: globalThis.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", + total_delegation: isSet(object.total_delegation) ? globalThis.String(object.total_delegation) : "0", + total_delegator_count: isSet(object.total_delegator_count) + ? globalThis.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); + if (message.delegators?.length) { + obj.delegators = message.delegators.map((e) => StakerDelegatorResponse.toJSON(e)); + } + if (message.total_delegation !== "0") { + obj.total_delegation = message.total_delegation; + } + if (message.total_delegator_count !== "0") { + obj.total_delegator_count = message.total_delegator_count; + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryDelegatorsByStakerResponse { + return QueryDelegatorsByStakerResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryDelegatorsByStakerResponse { @@ -430,22 +529,31 @@ export const QueryStakersByDelegatorRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByDelegatorRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.delegator = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -453,18 +561,24 @@ export const QueryStakersByDelegatorRequest = { fromJSON(object: any): QueryStakersByDelegatorRequest { return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - delegator: isSet(object.delegator) ? String(object.delegator) : "", + delegator: isSet(object.delegator) ? globalThis.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); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.delegator !== "") { + obj.delegator = message.delegator; + } return obj; }, + create, I>>(base?: I): QueryStakersByDelegatorRequest { + return QueryStakersByDelegatorRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryStakersByDelegatorRequest { @@ -496,33 +610,46 @@ export const QueryStakersByDelegatorResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByDelegatorResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.delegator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.stakers.push(DelegationForStakerResponse.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakersByDelegatorResponse { return { - delegator: isSet(object.delegator) ? String(object.delegator) : "", - stakers: Array.isArray(object?.stakers) + delegator: isSet(object.delegator) ? globalThis.String(object.delegator) : "", + stakers: globalThis.Array.isArray(object?.stakers) ? object.stakers.map((e: any) => DelegationForStakerResponse.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, @@ -531,17 +658,21 @@ export const QueryStakersByDelegatorResponse = { 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); + if (message.delegator !== "") { + obj.delegator = message.delegator; + } + if (message.stakers?.length) { + obj.stakers = message.stakers.map((e) => DelegationForStakerResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryStakersByDelegatorResponse { + return QueryStakersByDelegatorResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryStakersByDelegatorResponse { @@ -574,25 +705,38 @@ export const DelegationForStakerResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegationForStakerResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = FullStaker.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.current_reward = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.delegation_amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -600,19 +744,28 @@ export const DelegationForStakerResponse = { 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", + current_reward: isSet(object.current_reward) ? globalThis.String(object.current_reward) : "0", + delegation_amount: isSet(object.delegation_amount) ? globalThis.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); + if (message.staker !== undefined) { + obj.staker = FullStaker.toJSON(message.staker); + } + if (message.current_reward !== "0") { + obj.current_reward = message.current_reward; + } + if (message.delegation_amount !== "0") { + obj.delegation_amount = message.delegation_amount; + } return obj; }, + create, I>>(base?: I): DelegationForStakerResponse { + return DelegationForStakerResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): DelegationForStakerResponse { const message = createBaseDelegationForStakerResponse(); message.staker = (object.staker !== undefined && object.staker !== null) @@ -640,11 +793,12 @@ export interface QueryDelegation { StakersByDelegator(request: QueryStakersByDelegatorRequest): Promise; } +export const QueryDelegationServiceName = "kyve.query.v1beta1.QueryDelegation"; 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.service = opts?.service || QueryDelegationServiceName; this.rpc = rpc; this.Delegator = this.Delegator.bind(this); this.DelegatorsByStaker = this.DelegatorsByStaker.bind(this); @@ -653,19 +807,19 @@ export class QueryDelegationClientImpl implements QueryDelegation { 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))); + return promise.then((data) => QueryDelegatorResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryDelegatorsByStakerResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryStakersByDelegatorResponse.decode(_m0.Reader.create(data))); } } @@ -676,7 +830,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/query/v1beta1/params.ts b/common/types/src/lcd/kyve/query/v1beta1/params.ts index b163cc6a..d8345941 100644 --- a/common/types/src/lcd/kyve/query/v1beta1/params.ts +++ b/common/types/src/lcd/kyve/query/v1beta1/params.ts @@ -16,17 +16,27 @@ export interface QueryParamsRequest { /** QueryParamsResponse ... */ export interface QueryParamsResponse { /** bundles_params ... */ - bundles_params?: Params; + bundles_params?: + | Params + | undefined; /** delegation_params ... */ - delegation_params?: Params1; + delegation_params?: + | Params1 + | undefined; /** global_params ... */ - global_params?: Params2; + global_params?: + | Params2 + | undefined; /** gov_params ... */ - gov_params?: QueryParamsResponse3; + gov_params?: + | QueryParamsResponse3 + | undefined; /** stakers_params ... */ - stakers_params?: Params4; + stakers_params?: + | Params4 + | undefined; /** pool_params ... */ - pool_params?: Params5; + pool_params?: Params5 | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -39,16 +49,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -62,6 +73,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -103,34 +117,59 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.bundles_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.delegation_params = Params1.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.global_params = Params2.decode(reader, reader.uint32()); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.gov_params = QueryParamsResponse3.decode(reader, reader.uint32()); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.stakers_params = Params4.decode(reader, reader.uint32()); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.pool_params = Params5.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -148,21 +187,30 @@ export const QueryParamsResponse = { 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.global_params !== undefined && - (obj.global_params = message.global_params ? Params2.toJSON(message.global_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); - message.pool_params !== undefined && - (obj.pool_params = message.pool_params ? Params5.toJSON(message.pool_params) : undefined); + if (message.bundles_params !== undefined) { + obj.bundles_params = Params.toJSON(message.bundles_params); + } + if (message.delegation_params !== undefined) { + obj.delegation_params = Params1.toJSON(message.delegation_params); + } + if (message.global_params !== undefined) { + obj.global_params = Params2.toJSON(message.global_params); + } + if (message.gov_params !== undefined) { + obj.gov_params = QueryParamsResponse3.toJSON(message.gov_params); + } + if (message.stakers_params !== undefined) { + obj.stakers_params = Params4.toJSON(message.stakers_params); + } + if (message.pool_params !== undefined) { + obj.pool_params = Params5.toJSON(message.pool_params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.bundles_params = (object.bundles_params !== undefined && object.bundles_params !== null) @@ -193,18 +241,19 @@ export interface QueryParams { Params(request: QueryParamsRequest): Promise; } +export const QueryParamsServiceName = "kyve.query.v1beta1.QueryParams"; 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.service = opts?.service || QueryParamsServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -215,7 +264,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/query/v1beta1/pools.ts b/common/types/src/lcd/kyve/query/v1beta1/pools.ts index 951a4aec..085151ff 100644 --- a/common/types/src/lcd/kyve/query/v1beta1/pools.ts +++ b/common/types/src/lcd/kyve/query/v1beta1/pools.ts @@ -10,7 +10,9 @@ 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; + pagination?: + | PageRequest + | undefined; /** search ... */ search: string; /** runtime ... */ @@ -26,7 +28,7 @@ export interface QueryPoolsResponse { /** pools ... */ pools: PoolResponse[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** PoolResponse ... */ @@ -34,9 +36,13 @@ export interface PoolResponse { /** id ... */ id: string; /** data ... */ - data?: Pool; + data?: + | Pool + | undefined; /** bundle_proposal ... */ - bundle_proposal?: BundleProposal; + bundle_proposal?: + | BundleProposal + | undefined; /** stakers ... */ stakers: string[]; /** total_stake ... */ @@ -60,7 +66,7 @@ export interface QueryPoolRequest { /** QueryPoolResponse is the response type for the Query/Pool RPC method. */ export interface QueryPoolResponse { /** pool ... */ - pool?: PoolResponse; + pool?: PoolResponse | undefined; } function createBaseQueryPoolsRequest(): QueryPoolsRequest { @@ -88,31 +94,52 @@ export const QueryPoolsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.search = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.runtime = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.disabled = reader.bool(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.storage_provider_id = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -120,24 +147,36 @@ export const QueryPoolsRequest = { 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) : "", - disabled: isSet(object.disabled) ? Boolean(object.disabled) : false, - storage_provider_id: isSet(object.storage_provider_id) ? Number(object.storage_provider_id) : 0, + search: isSet(object.search) ? globalThis.String(object.search) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + disabled: isSet(object.disabled) ? globalThis.Boolean(object.disabled) : false, + storage_provider_id: isSet(object.storage_provider_id) ? globalThis.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.disabled !== undefined && (obj.disabled = message.disabled); - message.storage_provider_id !== undefined && (obj.storage_provider_id = Math.round(message.storage_provider_id)); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.search !== "") { + obj.search = message.search; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.disabled === true) { + obj.disabled = message.disabled; + } + if (message.storage_provider_id !== 0) { + obj.storage_provider_id = Math.round(message.storage_provider_id); + } return obj; }, + create, I>>(base?: I): QueryPoolsRequest { + return QueryPoolsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryPoolsRequest { const message = createBaseQueryPoolsRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) @@ -167,45 +206,56 @@ export const QueryPoolsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pools.push(PoolResponse.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryPoolsResponse { return { - pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => PoolResponse.fromJSON(e)) : [], + pools: globalThis.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 = []; + if (message.pools?.length) { + obj.pools = message.pools.map((e) => PoolResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryPoolsResponse { + return QueryPoolsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryPoolsResponse { const message = createBaseQueryPoolsResponse(); message.pools = object.pools?.map((e) => PoolResponse.fromPartial(e)) || []; @@ -263,80 +313,135 @@ export const PoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): PoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.data = Pool.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.bundle_proposal = BundleProposal.decode(reader, reader.uint32()); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.stakers.push(reader.string()); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.total_self_delegation = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.total_delegation = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.status = poolStatusFromJSON(reader.int32()); - break; + continue; case 8: + if (tag !== 66) { + break; + } + message.account = reader.string(); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.account_balance = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): PoolResponse { return { - id: isSet(object.id) ? String(object.id) : "0", + id: isSet(object.id) ? globalThis.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", + stakers: globalThis.Array.isArray(object?.stakers) ? object.stakers.map((e: any) => globalThis.String(e)) : [], + total_self_delegation: isSet(object.total_self_delegation) + ? globalThis.String(object.total_self_delegation) + : "0", + total_delegation: isSet(object.total_delegation) ? globalThis.String(object.total_delegation) : "0", status: isSet(object.status) ? poolStatusFromJSON(object.status) : PoolStatus.POOL_STATUS_UNSPECIFIED, - account: isSet(object.account) ? String(object.account) : "", - account_balance: isSet(object.account_balance) ? String(object.account_balance) : "0", + account: isSet(object.account) ? globalThis.String(object.account) : "", + account_balance: isSet(object.account_balance) ? globalThis.String(object.account_balance) : "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)); - message.account !== undefined && (obj.account = message.account); - message.account_balance !== undefined && (obj.account_balance = message.account_balance); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.data !== undefined) { + obj.data = Pool.toJSON(message.data); + } + if (message.bundle_proposal !== undefined) { + obj.bundle_proposal = BundleProposal.toJSON(message.bundle_proposal); + } + if (message.stakers?.length) { + obj.stakers = message.stakers; + } + if (message.total_self_delegation !== "0") { + obj.total_self_delegation = message.total_self_delegation; + } + if (message.total_delegation !== "0") { + obj.total_delegation = message.total_delegation; + } + if (message.status !== PoolStatus.POOL_STATUS_UNSPECIFIED) { + obj.status = poolStatusToJSON(message.status); + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.account_balance !== "0") { + obj.account_balance = message.account_balance; + } return obj; }, + create, I>>(base?: I): PoolResponse { + return PoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): PoolResponse { const message = createBasePoolResponse(); message.id = object.id ?? "0"; @@ -367,33 +472,43 @@ export const QueryPoolRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryPoolRequest { - return { id: isSet(object.id) ? String(object.id) : "0" }; + return { id: isSet(object.id) ? globalThis.String(object.id) : "0" }; }, toJSON(message: QueryPoolRequest): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): QueryPoolRequest { + return QueryPoolRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryPoolRequest { const message = createBaseQueryPoolRequest(); message.id = object.id ?? "0"; @@ -414,19 +529,24 @@ export const QueryPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pool = PoolResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -437,10 +557,15 @@ export const QueryPoolResponse = { toJSON(message: QueryPoolResponse): unknown { const obj: any = {}; - message.pool !== undefined && (obj.pool = message.pool ? PoolResponse.toJSON(message.pool) : undefined); + if (message.pool !== undefined) { + obj.pool = PoolResponse.toJSON(message.pool); + } return obj; }, + create, I>>(base?: I): QueryPoolResponse { + return QueryPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryPoolResponse { const message = createBaseQueryPoolResponse(); message.pool = (object.pool !== undefined && object.pool !== null) @@ -458,11 +583,12 @@ export interface QueryPool { Pool(request: QueryPoolRequest): Promise; } +export const QueryPoolServiceName = "kyve.query.v1beta1.QueryPool"; 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.service = opts?.service || QueryPoolServiceName; this.rpc = rpc; this.Pools = this.Pools.bind(this); this.Pool = this.Pool.bind(this); @@ -470,13 +596,13 @@ export class QueryPoolClientImpl implements QueryPool { 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))); + return promise.then((data) => QueryPoolsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryPoolResponse.decode(_m0.Reader.create(data))); } } @@ -487,7 +613,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/query/v1beta1/query.ts b/common/types/src/lcd/kyve/query/v1beta1/query.ts index 0b95e348..eec2eb72 100644 --- a/common/types/src/lcd/kyve/query/v1beta1/query.ts +++ b/common/types/src/lcd/kyve/query/v1beta1/query.ts @@ -48,7 +48,9 @@ export interface FullStaker { /** address of the staker */ address: string; /** metadata as logo, moniker, etc. */ - metadata?: StakerMetadata; + metadata?: + | StakerMetadata + | undefined; /** amount the staker has delegated to himself */ self_delegation: string; /** @@ -105,7 +107,9 @@ export interface StakerMetadata { * the commission is applied. Users have time to redelegate * if they not agree with the new commission. */ - pending_commission_change?: CommissionChangeEntry; + pending_commission_change?: + | CommissionChangeEntry + | undefined; /** commission_rewards are the rewards in $KYVE earned through commission */ commission_rewards: string; } @@ -133,7 +137,9 @@ export interface CommissionChangeEntry { */ export interface PoolMembership { /** pool contains useful information about the pool */ - pool?: BasicPool; + pool?: + | BasicPool + | undefined; /** * points indicates if the staker is inactive * If the staker misses a vote, a point is added. @@ -208,75 +214,133 @@ export const BasicPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): BasicPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.name = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.runtime = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.logo = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.operating_cost = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.upload_interval = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.total_funds = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.total_delegation = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.status = poolStatusFromJSON(reader.int32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + name: isSet(object.name) ? globalThis.String(object.name) : "", + runtime: isSet(object.runtime) ? globalThis.String(object.runtime) : "", + logo: isSet(object.logo) ? globalThis.String(object.logo) : "", + operating_cost: isSet(object.operating_cost) ? globalThis.String(object.operating_cost) : "0", + upload_interval: isSet(object.upload_interval) ? globalThis.String(object.upload_interval) : "0", + total_funds: isSet(object.total_funds) ? globalThis.String(object.total_funds) : "0", + total_delegation: isSet(object.total_delegation) ? globalThis.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)); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.logo !== "") { + obj.logo = message.logo; + } + if (message.operating_cost !== "0") { + obj.operating_cost = message.operating_cost; + } + if (message.upload_interval !== "0") { + obj.upload_interval = message.upload_interval; + } + if (message.total_funds !== "0") { + obj.total_funds = message.total_funds; + } + if (message.total_delegation !== "0") { + obj.total_delegation = message.total_delegation; + } + if (message.status !== PoolStatus.POOL_STATUS_UNSPECIFIED) { + obj.status = poolStatusToJSON(message.status); + } return obj; }, + create, I>>(base?: I): BasicPool { + return BasicPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): BasicPool { const message = createBaseBasicPool(); message.id = object.id ?? "0"; @@ -331,73 +395,113 @@ export const FullStaker = { }, decode(input: _m0.Reader | Uint8Array, length?: number): FullStaker { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.metadata = StakerMetadata.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.self_delegation = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.self_delegation_unbonding = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.total_delegation = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.delegator_count = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.pools.push(PoolMembership.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): FullStaker { return { - address: isSet(object.address) ? String(object.address) : "", + address: isSet(object.address) ? globalThis.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: isSet(object.self_delegation) ? globalThis.String(object.self_delegation) : "0", self_delegation_unbonding: isSet(object.self_delegation_unbonding) - ? String(object.self_delegation_unbonding) + ? globalThis.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)) : [], + total_delegation: isSet(object.total_delegation) ? globalThis.String(object.total_delegation) : "0", + delegator_count: isSet(object.delegator_count) ? globalThis.String(object.delegator_count) : "0", + pools: globalThis.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 = []; + if (message.address !== "") { + obj.address = message.address; + } + if (message.metadata !== undefined) { + obj.metadata = StakerMetadata.toJSON(message.metadata); + } + if (message.self_delegation !== "0") { + obj.self_delegation = message.self_delegation; + } + if (message.self_delegation_unbonding !== "0") { + obj.self_delegation_unbonding = message.self_delegation_unbonding; + } + if (message.total_delegation !== "0") { + obj.total_delegation = message.total_delegation; + } + if (message.delegator_count !== "0") { + obj.delegator_count = message.delegator_count; + } + if (message.pools?.length) { + obj.pools = message.pools.map((e) => PoolMembership.toJSON(e)); } return obj; }, + create, I>>(base?: I): FullStaker { + return FullStaker.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): FullStaker { const message = createBaseFullStaker(); message.address = object.address ?? ""; @@ -456,75 +560,124 @@ export const StakerMetadata = { }, decode(input: _m0.Reader | Uint8Array, length?: number): StakerMetadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.commission = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.moniker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.website = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.identity = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.security_contact = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.details = reader.string(); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.pending_commission_change = CommissionChangeEntry.decode(reader, reader.uint32()); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.commission_rewards = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", - identity: isSet(object.identity) ? String(object.identity) : "", - security_contact: isSet(object.security_contact) ? String(object.security_contact) : "", - details: isSet(object.details) ? String(object.details) : "", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + security_contact: isSet(object.security_contact) ? globalThis.String(object.security_contact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", pending_commission_change: isSet(object.pending_commission_change) ? CommissionChangeEntry.fromJSON(object.pending_commission_change) : undefined, - commission_rewards: isSet(object.commission_rewards) ? String(object.commission_rewards) : "0", + commission_rewards: isSet(object.commission_rewards) ? globalThis.String(object.commission_rewards) : "0", }; }, 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.identity !== undefined && (obj.identity = message.identity); - message.security_contact !== undefined && (obj.security_contact = message.security_contact); - message.details !== undefined && (obj.details = message.details); - message.pending_commission_change !== undefined && - (obj.pending_commission_change = message.pending_commission_change - ? CommissionChangeEntry.toJSON(message.pending_commission_change) - : undefined); - message.commission_rewards !== undefined && (obj.commission_rewards = message.commission_rewards); + if (message.commission !== "") { + obj.commission = message.commission; + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.security_contact !== "") { + obj.security_contact = message.security_contact; + } + if (message.details !== "") { + obj.details = message.details; + } + if (message.pending_commission_change !== undefined) { + obj.pending_commission_change = CommissionChangeEntry.toJSON(message.pending_commission_change); + } + if (message.commission_rewards !== "0") { + obj.commission_rewards = message.commission_rewards; + } return obj; }, + create, I>>(base?: I): StakerMetadata { + return StakerMetadata.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): StakerMetadata { const message = createBaseStakerMetadata(); message.commission = object.commission ?? ""; @@ -558,40 +711,56 @@ export const CommissionChangeEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.commission = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.creation_date = longToString(reader.int64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", + creation_date: isSet(object.creation_date) ? globalThis.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); + if (message.commission !== "") { + obj.commission = message.commission; + } + if (message.creation_date !== "0") { + obj.creation_date = message.creation_date; + } return obj; }, + create, I>>(base?: I): CommissionChangeEntry { + return CommissionChangeEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): CommissionChangeEntry { const message = createBaseCommissionChangeEntry(); message.commission = object.commission ?? ""; @@ -625,31 +794,52 @@ export const PoolMembership = { }, decode(input: _m0.Reader | Uint8Array, length?: number): PoolMembership { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pool = BasicPool.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.points = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.is_leaving = reader.bool(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.valaddress = reader.string(); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.balance = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -657,23 +847,36 @@ export const PoolMembership = { 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", + points: isSet(object.points) ? globalThis.String(object.points) : "0", + is_leaving: isSet(object.is_leaving) ? globalThis.Boolean(object.is_leaving) : false, + valaddress: isSet(object.valaddress) ? globalThis.String(object.valaddress) : "", + balance: isSet(object.balance) ? globalThis.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); + if (message.pool !== undefined) { + obj.pool = BasicPool.toJSON(message.pool); + } + if (message.points !== "0") { + obj.points = message.points; + } + if (message.is_leaving === true) { + obj.is_leaving = message.is_leaving; + } + if (message.valaddress !== "") { + obj.valaddress = message.valaddress; + } + if (message.balance !== "0") { + obj.balance = message.balance; + } return obj; }, + create, I>>(base?: I): PoolMembership { + return PoolMembership.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): PoolMembership { const message = createBasePoolMembership(); message.pool = (object.pool !== undefined && object.pool !== null) ? BasicPool.fromPartial(object.pool) : undefined; @@ -688,7 +891,8 @@ export const PoolMembership = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/query/v1beta1/stakers.ts b/common/types/src/lcd/kyve/query/v1beta1/stakers.ts index c123c10f..54e64955 100644 --- a/common/types/src/lcd/kyve/query/v1beta1/stakers.ts +++ b/common/types/src/lcd/kyve/query/v1beta1/stakers.ts @@ -67,7 +67,9 @@ export function stakerStatusToNumber(object: StakerStatus): number { /** QueryStakersRequest is the request type for the Query/Stakers RPC method. */ export interface QueryStakersRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: + | PageRequest + | undefined; /** status looks whether a staker is participating in pools or not */ status: StakerStatus; /** search searches for moniker OR address */ @@ -79,7 +81,7 @@ export interface QueryStakersResponse { /** stakers ... */ stakers: FullStaker[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } /** QueryStakerRequest is the request type for the Query/Staker RPC method. */ @@ -91,7 +93,7 @@ export interface QueryStakerRequest { /** QueryStakerResponse is the response type for the Query/Staker RPC method. */ export interface QueryStakerResponse { /** staker ... */ - staker?: FullStaker; + staker?: FullStaker | undefined; } /** QueryStakersByPoolRequest is the request type for the Query/Staker RPC method. */ @@ -109,15 +111,17 @@ export interface QueryStakersByPoolResponse { /** StakerPoolResponse ... */ export interface StakerPoolResponse { /** staker ... */ - staker?: FullStaker; + staker?: + | FullStaker + | undefined; /** valaccount ... */ - valaccount?: Valaccount; + valaccount?: Valaccount | undefined; } /** QueryStakersByPoolCountRequest ... */ export interface QueryStakersByPoolCountRequest { /** pagination defines an optional pagination for the request. */ - pagination?: PageRequest; + pagination?: PageRequest | undefined; } /** QueryStakersByPoolCountResponse ... */ @@ -125,7 +129,7 @@ export interface QueryStakersByPoolCountResponse { /** stakers ... */ stakers: FullStaker[]; /** pagination defines the pagination in the response. */ - pagination?: PageResponse; + pagination?: PageResponse | undefined; } function createBaseQueryStakersRequest(): QueryStakersRequest { @@ -147,25 +151,38 @@ export const QueryStakersRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.status = stakerStatusFromJSON(reader.int32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.search = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -174,19 +191,27 @@ export const 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) : "", + search: isSet(object.search) ? globalThis.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); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.status !== StakerStatus.STAKER_STATUS_UNSPECIFIED) { + obj.status = stakerStatusToJSON(message.status); + } + if (message.search !== "") { + obj.search = message.search; + } return obj; }, + create, I>>(base?: I): QueryStakersRequest { + return QueryStakersRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakersRequest { const message = createBaseQueryStakersRequest(); message.pagination = (object.pagination !== undefined && object.pagination !== null) @@ -214,45 +239,56 @@ export const QueryStakersResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.stakers.push(FullStaker.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakersResponse { return { - stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => FullStaker.fromJSON(e)) : [], + stakers: globalThis.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 = []; + if (message.stakers?.length) { + obj.stakers = message.stakers.map((e) => FullStaker.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryStakersResponse { + return QueryStakersResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakersResponse { const message = createBaseQueryStakersResponse(); message.stakers = object.stakers?.map((e) => FullStaker.fromPartial(e)) || []; @@ -276,33 +312,43 @@ export const QueryStakerRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakerRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakerRequest { - return { address: isSet(object.address) ? String(object.address) : "" }; + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; }, toJSON(message: QueryStakerRequest): unknown { const obj: any = {}; - message.address !== undefined && (obj.address = message.address); + if (message.address !== "") { + obj.address = message.address; + } return obj; }, + create, I>>(base?: I): QueryStakerRequest { + return QueryStakerRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakerRequest { const message = createBaseQueryStakerRequest(); message.address = object.address ?? ""; @@ -323,19 +369,24 @@ export const QueryStakerResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakerResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = FullStaker.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -346,10 +397,15 @@ export const QueryStakerResponse = { toJSON(message: QueryStakerResponse): unknown { const obj: any = {}; - message.staker !== undefined && (obj.staker = message.staker ? FullStaker.toJSON(message.staker) : undefined); + if (message.staker !== undefined) { + obj.staker = FullStaker.toJSON(message.staker); + } return obj; }, + create, I>>(base?: I): QueryStakerResponse { + return QueryStakerResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakerResponse { const message = createBaseQueryStakerResponse(); message.staker = (object.staker !== undefined && object.staker !== null) @@ -372,33 +428,43 @@ export const QueryStakersByPoolRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakersByPoolRequest { - return { pool_id: isSet(object.pool_id) ? String(object.pool_id) : "0" }; + return { pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0" }; }, toJSON(message: QueryStakersByPoolRequest): unknown { const obj: any = {}; - message.pool_id !== undefined && (obj.pool_id = message.pool_id); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } return obj; }, + create, I>>(base?: I): QueryStakersByPoolRequest { + return QueryStakersByPoolRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakersByPoolRequest { const message = createBaseQueryStakersByPoolRequest(); message.pool_id = object.pool_id ?? "0"; @@ -419,39 +485,47 @@ export const QueryStakersByPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.stakers.push(StakerPoolResponse.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakersByPoolResponse { return { - stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => StakerPoolResponse.fromJSON(e)) : [], + stakers: globalThis.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 = []; + if (message.stakers?.length) { + obj.stakers = message.stakers.map((e) => StakerPoolResponse.toJSON(e)); } return obj; }, + create, I>>(base?: I): QueryStakersByPoolResponse { + return QueryStakersByPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryStakersByPoolResponse { const message = createBaseQueryStakersByPoolResponse(); message.stakers = object.stakers?.map((e) => StakerPoolResponse.fromPartial(e)) || []; @@ -475,22 +549,31 @@ export const StakerPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): StakerPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = FullStaker.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.valaccount = Valaccount.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -504,12 +587,18 @@ export const StakerPoolResponse = { 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); + if (message.staker !== undefined) { + obj.staker = FullStaker.toJSON(message.staker); + } + if (message.valaccount !== undefined) { + obj.valaccount = Valaccount.toJSON(message.valaccount); + } return obj; }, + create, I>>(base?: I): StakerPoolResponse { + return StakerPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): StakerPoolResponse { const message = createBaseStakerPoolResponse(); message.staker = (object.staker !== undefined && object.staker !== null) @@ -535,19 +624,24 @@ export const QueryStakersByPoolCountRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolCountRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -558,11 +652,15 @@ export const QueryStakersByPoolCountRequest = { toJSON(message: QueryStakersByPoolCountRequest): unknown { const obj: any = {}; - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } return obj; }, + create, I>>(base?: I): QueryStakersByPoolCountRequest { + return QueryStakersByPoolCountRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryStakersByPoolCountRequest { @@ -590,45 +688,56 @@ export const QueryStakersByPoolCountResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryStakersByPoolCountResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.stakers.push(FullStaker.decode(reader, reader.uint32())); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryStakersByPoolCountResponse { return { - stakers: Array.isArray(object?.stakers) ? object.stakers.map((e: any) => FullStaker.fromJSON(e)) : [], + stakers: globalThis.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 = []; + if (message.stakers?.length) { + obj.stakers = message.stakers.map((e) => FullStaker.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + create, I>>(base?: I): QueryStakersByPoolCountResponse { + return QueryStakersByPoolCountResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryStakersByPoolCountResponse { @@ -656,11 +765,12 @@ export interface QueryStakers { StakersByPoolCount(request: QueryStakersByPoolCountRequest): Promise; } +export const QueryStakersServiceName = "kyve.query.v1beta1.QueryStakers"; 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.service = opts?.service || QueryStakersServiceName; this.rpc = rpc; this.Stakers = this.Stakers.bind(this); this.Staker = this.Staker.bind(this); @@ -670,25 +780,25 @@ export class QueryStakersClientImpl implements QueryStakers { 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))); + return promise.then((data) => QueryStakersResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryStakerResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryStakersByPoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => QueryStakersByPoolCountResponse.decode(_m0.Reader.create(data))); } } @@ -699,7 +809,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/events.ts b/common/types/src/lcd/kyve/stakers/v1beta1/events.ts index 4ab8cfda..71eed8b1 100644 --- a/common/types/src/lcd/kyve/stakers/v1beta1/events.ts +++ b/common/types/src/lcd/kyve/stakers/v1beta1/events.ts @@ -11,9 +11,13 @@ export const protobufPackage = "kyve.stakers.v1beta1"; */ export interface EventUpdateParams { /** old_params is the module's old parameters. */ - old_params?: Params; + old_params?: + | Params + | undefined; /** new_params is the module's new parameters. */ - new_params?: Params; + new_params?: + | Params + | undefined; /** payload is the parameter updates that were performed. */ payload: string; } @@ -120,25 +124,38 @@ export const EventUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.old_params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.new_params = Params.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -147,20 +164,27 @@ export const EventUpdateParams = { return { old_params: isSet(object.old_params) ? Params.fromJSON(object.old_params) : undefined, new_params: isSet(object.new_params) ? Params.fromJSON(object.new_params) : undefined, - payload: isSet(object.payload) ? String(object.payload) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: EventUpdateParams): unknown { const obj: any = {}; - message.old_params !== undefined && - (obj.old_params = message.old_params ? Params.toJSON(message.old_params) : undefined); - message.new_params !== undefined && - (obj.new_params = message.new_params ? Params.toJSON(message.new_params) : undefined); - message.payload !== undefined && (obj.payload = message.payload); + if (message.old_params !== undefined) { + obj.old_params = Params.toJSON(message.old_params); + } + if (message.new_params !== undefined) { + obj.new_params = Params.toJSON(message.new_params); + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): EventUpdateParams { + return EventUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateParams { const message = createBaseEventUpdateParams(); message.old_params = (object.old_params !== undefined && object.old_params !== null) @@ -193,45 +217,67 @@ export const EventCreateStaker = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateStaker { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.commission = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventCreateStaker { return { - staker: isSet(object.staker) ? String(object.staker) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", - commission: isSet(object.commission) ? String(object.commission) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", }; }, toJSON(message: EventCreateStaker): unknown { const obj: any = {}; - message.staker !== undefined && (obj.staker = message.staker); - message.amount !== undefined && (obj.amount = message.amount); - message.commission !== undefined && (obj.commission = message.commission); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.commission !== "") { + obj.commission = message.commission; + } return obj; }, + create, I>>(base?: I): EventCreateStaker { + return EventCreateStaker.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventCreateStaker { const message = createBaseEventCreateStaker(); message.staker = object.staker ?? ""; @@ -269,60 +315,100 @@ export const EventUpdateMetadata = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateMetadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.moniker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.website = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.identity = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.security_contact = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.details = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", - identity: isSet(object.identity) ? String(object.identity) : "", - security_contact: isSet(object.security_contact) ? String(object.security_contact) : "", - details: isSet(object.details) ? String(object.details) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + security_contact: isSet(object.security_contact) ? globalThis.String(object.security_contact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", }; }, 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.identity !== undefined && (obj.identity = message.identity); - message.security_contact !== undefined && (obj.security_contact = message.security_contact); - message.details !== undefined && (obj.details = message.details); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.security_contact !== "") { + obj.security_contact = message.security_contact; + } + if (message.details !== "") { + obj.details = message.details; + } return obj; }, + create, I>>(base?: I): EventUpdateMetadata { + return EventUpdateMetadata.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateMetadata { const message = createBaseEventUpdateMetadata(); message.staker = object.staker ?? ""; @@ -351,40 +437,56 @@ export const EventUpdateCommission = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventUpdateCommission { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.commission = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventUpdateCommission { return { - staker: isSet(object.staker) ? String(object.staker) : "", - commission: isSet(object.commission) ? String(object.commission) : "", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", }; }, toJSON(message: EventUpdateCommission): unknown { const obj: any = {}; - message.staker !== undefined && (obj.staker = message.staker); - message.commission !== undefined && (obj.commission = message.commission); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.commission !== "") { + obj.commission = message.commission; + } return obj; }, + create, I>>(base?: I): EventUpdateCommission { + return EventUpdateCommission.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventUpdateCommission { const message = createBaseEventUpdateCommission(); message.staker = object.staker ?? ""; @@ -409,40 +511,56 @@ export const EventClaimCommissionRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimCommissionRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventClaimCommissionRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.staker = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventClaimCommissionRewards { return { - staker: isSet(object.staker) ? String(object.staker) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", }; }, toJSON(message: EventClaimCommissionRewards): unknown { const obj: any = {}; - message.staker !== undefined && (obj.staker = message.staker); - message.amount !== undefined && (obj.amount = message.amount); + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventClaimCommissionRewards { + return EventClaimCommissionRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClaimCommissionRewards { const message = createBaseEventClaimCommissionRewards(); message.staker = object.staker ?? ""; @@ -473,50 +591,78 @@ export const EventJoinPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventJoinPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.valaddress = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + valaddress: isSet(object.valaddress) ? globalThis.String(object.valaddress) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.valaddress !== "") { + obj.valaddress = message.valaddress; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventJoinPool { + return EventJoinPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventJoinPool { const message = createBaseEventJoinPool(); message.pool_id = object.pool_id ?? "0"; @@ -543,40 +689,56 @@ export const EventLeavePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventLeavePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } return obj; }, + create, I>>(base?: I): EventLeavePool { + return EventLeavePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventLeavePool { const message = createBaseEventLeavePool(); message.pool_id = object.pool_id ?? "0"; @@ -588,7 +750,8 @@ export const EventLeavePool = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/genesis.ts b/common/types/src/lcd/kyve/stakers/v1beta1/genesis.ts index 792284ab..43c09bab 100644 --- a/common/types/src/lcd/kyve/stakers/v1beta1/genesis.ts +++ b/common/types/src/lcd/kyve/stakers/v1beta1/genesis.ts @@ -8,7 +8,9 @@ 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; + params?: + | Params + | undefined; /** staker_list ... */ staker_list: Staker[]; /** valaccount_list ... */ @@ -16,11 +18,13 @@ export interface GenesisState { /** commission_change_entries ... */ commission_change_entries: CommissionChangeEntry[]; /** queue_state_commission ... */ - queue_state_commission?: QueueState; + queue_state_commission?: + | QueueState + | undefined; /** leave_pool_entries ... */ leave_pool_entries: LeavePoolEntry[]; /** queue_state_leave ... */ - queue_state_leave?: QueueState; + queue_state_leave?: QueueState | undefined; } function createBaseGenesisState(): GenesisState { @@ -62,37 +66,66 @@ export const GenesisState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker_list.push(Staker.decode(reader, reader.uint32())); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.valaccount_list.push(Valaccount.decode(reader, reader.uint32())); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.commission_change_entries.push(CommissionChangeEntry.decode(reader, reader.uint32())); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.queue_state_commission = QueueState.decode(reader, reader.uint32()); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.leave_pool_entries.push(LeavePoolEntry.decode(reader, reader.uint32())); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.queue_state_leave = QueueState.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -100,17 +133,19 @@ export const GenesisState = { 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) + staker_list: globalThis.Array.isArray(object?.staker_list) + ? object.staker_list.map((e: any) => Staker.fromJSON(e)) + : [], + valaccount_list: globalThis.Array.isArray(object?.valaccount_list) ? object.valaccount_list.map((e: any) => Valaccount.fromJSON(e)) : [], - commission_change_entries: Array.isArray(object?.commission_change_entries) + commission_change_entries: globalThis.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) + leave_pool_entries: globalThis.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, @@ -119,37 +154,33 @@ export const GenesisState = { 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.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.staker_list?.length) { + obj.staker_list = message.staker_list.map((e) => Staker.toJSON(e)); + } + if (message.valaccount_list?.length) { + obj.valaccount_list = message.valaccount_list.map((e) => Valaccount.toJSON(e)); } - 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?.length) { + obj.commission_change_entries = message.commission_change_entries.map((e) => CommissionChangeEntry.toJSON(e)); } - 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 = []; + if (message.queue_state_commission !== undefined) { + obj.queue_state_commission = QueueState.toJSON(message.queue_state_commission); + } + if (message.leave_pool_entries?.length) { + obj.leave_pool_entries = message.leave_pool_entries.map((e) => LeavePoolEntry.toJSON(e)); } - 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 = []; + if (message.queue_state_leave !== undefined) { + obj.queue_state_leave = QueueState.toJSON(message.queue_state_leave); } - message.queue_state_leave !== undefined && - (obj.queue_state_leave = message.queue_state_leave ? QueueState.toJSON(message.queue_state_leave) : undefined); return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) @@ -174,7 +205,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/params.ts b/common/types/src/lcd/kyve/stakers/v1beta1/params.ts index a7917aaa..fdd4bcdc 100644 --- a/common/types/src/lcd/kyve/stakers/v1beta1/params.ts +++ b/common/types/src/lcd/kyve/stakers/v1beta1/params.ts @@ -28,40 +28,58 @@ export const Params = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.commission_change_time = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.leave_pool_time = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + commission_change_time: isSet(object.commission_change_time) + ? globalThis.String(object.commission_change_time) + : "0", + leave_pool_time: isSet(object.leave_pool_time) ? globalThis.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); + if (message.commission_change_time !== "0") { + obj.commission_change_time = message.commission_change_time; + } + if (message.leave_pool_time !== "0") { + obj.leave_pool_time = message.leave_pool_time; + } return obj; }, + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Params { const message = createBaseParams(); message.commission_change_time = object.commission_change_time ?? "0"; @@ -73,7 +91,8 @@ export const Params = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/query.ts b/common/types/src/lcd/kyve/stakers/v1beta1/query.ts index cea644b1..99186d74 100644 --- a/common/types/src/lcd/kyve/stakers/v1beta1/query.ts +++ b/common/types/src/lcd/kyve/stakers/v1beta1/query.ts @@ -11,7 +11,7 @@ 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; + params?: Params | undefined; } function createBaseQueryParamsRequest(): QueryParamsRequest { @@ -24,16 +24,17 @@ export const QueryParamsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -47,6 +48,9 @@ export const QueryParamsRequest = { return obj; }, + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryParamsRequest { const message = createBaseQueryParamsRequest(); return message; @@ -66,19 +70,24 @@ export const QueryParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, @@ -89,10 +98,15 @@ export const QueryParamsResponse = { toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } return obj; }, + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) @@ -108,18 +122,19 @@ export interface Query { Params(request: QueryParamsRequest): Promise; } +export const QueryServiceName = "kyve.stakers.v1beta1.Query"; 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.service = opts?.service || QueryServiceName; 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))); + return promise.then((data) => QueryParamsResponse.decode(_m0.Reader.create(data))); } } @@ -130,7 +145,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/stakers.ts b/common/types/src/lcd/kyve/stakers/v1beta1/stakers.ts index 0ea61915..2ea1decc 100644 --- a/common/types/src/lcd/kyve/stakers/v1beta1/stakers.ts +++ b/common/types/src/lcd/kyve/stakers/v1beta1/stakers.ts @@ -162,70 +162,122 @@ export const Staker = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Staker { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.address = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.commission = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.moniker = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.website = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.identity = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.security_contact = reader.string(); - break; + continue; case 7: + if (tag !== 58) { + break; + } + message.details = reader.string(); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.commission_rewards = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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) : "", - identity: isSet(object.identity) ? String(object.identity) : "", - security_contact: isSet(object.security_contact) ? String(object.security_contact) : "", - details: isSet(object.details) ? String(object.details) : "", - commission_rewards: isSet(object.commission_rewards) ? String(object.commission_rewards) : "0", + address: isSet(object.address) ? globalThis.String(object.address) : "", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + security_contact: isSet(object.security_contact) ? globalThis.String(object.security_contact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", + commission_rewards: isSet(object.commission_rewards) ? globalThis.String(object.commission_rewards) : "0", }; }, 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.identity !== undefined && (obj.identity = message.identity); - message.security_contact !== undefined && (obj.security_contact = message.security_contact); - message.details !== undefined && (obj.details = message.details); - message.commission_rewards !== undefined && (obj.commission_rewards = message.commission_rewards); + if (message.address !== "") { + obj.address = message.address; + } + if (message.commission !== "") { + obj.commission = message.commission; + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.security_contact !== "") { + obj.security_contact = message.security_contact; + } + if (message.details !== "") { + obj.details = message.details; + } + if (message.commission_rewards !== "0") { + obj.commission_rewards = message.commission_rewards; + } return obj; }, + create, I>>(base?: I): Staker { + return Staker.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Staker { const message = createBaseStaker(); message.address = object.address ?? ""; @@ -265,55 +317,89 @@ export const Valaccount = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Valaccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.valaddress = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.points = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.is_leaving = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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, + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + valaddress: isSet(object.valaddress) ? globalThis.String(object.valaddress) : "", + points: isSet(object.points) ? globalThis.String(object.points) : "0", + is_leaving: isSet(object.is_leaving) ? globalThis.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); + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.valaddress !== "") { + obj.valaddress = message.valaddress; + } + if (message.points !== "0") { + obj.points = message.points; + } + if (message.is_leaving === true) { + obj.is_leaving = message.is_leaving; + } return obj; }, + create, I>>(base?: I): Valaccount { + return Valaccount.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Valaccount { const message = createBaseValaccount(); message.pool_id = object.pool_id ?? "0"; @@ -347,50 +433,78 @@ export const CommissionChangeEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): CommissionChangeEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.index = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.commission = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.creation_date = longToString(reader.int64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + index: isSet(object.index) ? globalThis.String(object.index) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", + creation_date: isSet(object.creation_date) ? globalThis.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); + if (message.index !== "0") { + obj.index = message.index; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.commission !== "") { + obj.commission = message.commission; + } + if (message.creation_date !== "0") { + obj.creation_date = message.creation_date; + } return obj; }, + create, I>>(base?: I): CommissionChangeEntry { + return CommissionChangeEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): CommissionChangeEntry { const message = createBaseCommissionChangeEntry(); message.index = object.index ?? "0"; @@ -423,50 +537,78 @@ export const LeavePoolEntry = { }, decode(input: _m0.Reader | Uint8Array, length?: number): LeavePoolEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.index = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.staker = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.creation_date = longToString(reader.int64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + index: isSet(object.index) ? globalThis.String(object.index) : "0", + staker: isSet(object.staker) ? globalThis.String(object.staker) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + creation_date: isSet(object.creation_date) ? globalThis.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); + if (message.index !== "0") { + obj.index = message.index; + } + if (message.staker !== "") { + obj.staker = message.staker; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.creation_date !== "0") { + obj.creation_date = message.creation_date; + } return obj; }, + create, I>>(base?: I): LeavePoolEntry { + return LeavePoolEntry.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): LeavePoolEntry { const message = createBaseLeavePoolEntry(); message.index = object.index ?? "0"; @@ -493,40 +635,56 @@ export const QueueState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueueState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 8) { + break; + } + message.low_index = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.high_index = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } 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", + low_index: isSet(object.low_index) ? globalThis.String(object.low_index) : "0", + high_index: isSet(object.high_index) ? globalThis.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); + if (message.low_index !== "0") { + obj.low_index = message.low_index; + } + if (message.high_index !== "0") { + obj.high_index = message.high_index; + } return obj; }, + create, I>>(base?: I): QueueState { + return QueueState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueueState { const message = createBaseQueueState(); message.low_index = object.low_index ?? "0"; @@ -538,7 +696,8 @@ export const QueueState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/stakers/v1beta1/tx.ts b/common/types/src/lcd/kyve/stakers/v1beta1/tx.ts index 7321b97a..c5e641ad 100644 --- a/common/types/src/lcd/kyve/stakers/v1beta1/tx.ts +++ b/common/types/src/lcd/kyve/stakers/v1beta1/tx.ts @@ -124,45 +124,67 @@ export const MsgCreateStaker = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateStaker { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.commission = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgCreateStaker { return { - creator: isSet(object.creator) ? String(object.creator) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", - commission: isSet(object.commission) ? String(object.commission) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", }; }, toJSON(message: MsgCreateStaker): unknown { const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.amount !== undefined && (obj.amount = message.amount); - message.commission !== undefined && (obj.commission = message.commission); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.commission !== "") { + obj.commission = message.commission; + } return obj; }, + create, I>>(base?: I): MsgCreateStaker { + return MsgCreateStaker.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgCreateStaker { const message = createBaseMsgCreateStaker(); message.creator = object.creator ?? ""; @@ -182,16 +204,17 @@ export const MsgCreateStakerResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateStakerResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -205,6 +228,9 @@ export const MsgCreateStakerResponse = { return obj; }, + create, I>>(base?: I): MsgCreateStakerResponse { + return MsgCreateStakerResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgCreateStakerResponse { const message = createBaseMsgCreateStakerResponse(); return message; @@ -239,60 +265,100 @@ export const MsgUpdateMetadata = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateMetadata { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.moniker = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.website = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.identity = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.security_contact = reader.string(); - break; + continue; case 6: + if (tag !== 50) { + break; + } + message.details = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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) : "", - identity: isSet(object.identity) ? String(object.identity) : "", - security_contact: isSet(object.security_contact) ? String(object.security_contact) : "", - details: isSet(object.details) ? String(object.details) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + security_contact: isSet(object.security_contact) ? globalThis.String(object.security_contact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", }; }, 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.identity !== undefined && (obj.identity = message.identity); - message.security_contact !== undefined && (obj.security_contact = message.security_contact); - message.details !== undefined && (obj.details = message.details); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.security_contact !== "") { + obj.security_contact = message.security_contact; + } + if (message.details !== "") { + obj.details = message.details; + } return obj; }, + create, I>>(base?: I): MsgUpdateMetadata { + return MsgUpdateMetadata.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateMetadata { const message = createBaseMsgUpdateMetadata(); message.creator = object.creator ?? ""; @@ -315,16 +381,17 @@ export const MsgUpdateMetadataResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateMetadataResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -338,6 +405,9 @@ export const MsgUpdateMetadataResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateMetadataResponse { + return MsgUpdateMetadataResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateMetadataResponse { const message = createBaseMsgUpdateMetadataResponse(); return message; @@ -360,40 +430,56 @@ export const MsgUpdateCommission = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateCommission { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.commission = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateCommission { return { - creator: isSet(object.creator) ? String(object.creator) : "", - commission: isSet(object.commission) ? String(object.commission) : "", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + commission: isSet(object.commission) ? globalThis.String(object.commission) : "", }; }, toJSON(message: MsgUpdateCommission): unknown { const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.commission !== undefined && (obj.commission = message.commission); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.commission !== "") { + obj.commission = message.commission; + } return obj; }, + create, I>>(base?: I): MsgUpdateCommission { + return MsgUpdateCommission.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateCommission { const message = createBaseMsgUpdateCommission(); message.creator = object.creator ?? ""; @@ -412,16 +498,17 @@ export const MsgUpdateCommissionResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateCommissionResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -435,6 +522,9 @@ export const MsgUpdateCommissionResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateCommissionResponse { + return MsgUpdateCommissionResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateCommissionResponse { const message = createBaseMsgUpdateCommissionResponse(); return message; @@ -457,40 +547,56 @@ export const MsgClaimCommissionRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimCommissionRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimCommissionRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgClaimCommissionRewards { return { - creator: isSet(object.creator) ? String(object.creator) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", }; }, toJSON(message: MsgClaimCommissionRewards): unknown { const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.amount !== undefined && (obj.amount = message.amount); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgClaimCommissionRewards { + return MsgClaimCommissionRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClaimCommissionRewards { const message = createBaseMsgClaimCommissionRewards(); message.creator = object.creator ?? ""; @@ -509,16 +615,17 @@ export const MsgClaimCommissionRewardsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimCommissionRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimCommissionRewardsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -532,6 +639,11 @@ export const MsgClaimCommissionRewardsResponse = { return obj; }, + create, I>>( + base?: I, + ): MsgClaimCommissionRewardsResponse { + return MsgClaimCommissionRewardsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( _: I, ): MsgClaimCommissionRewardsResponse { @@ -562,50 +674,78 @@ export const MsgJoinPool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgJoinPool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.valaddress = reader.string(); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + pool_id: isSet(object.pool_id) ? globalThis.String(object.pool_id) : "0", + valaddress: isSet(object.valaddress) ? globalThis.String(object.valaddress) : "", + amount: isSet(object.amount) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } + if (message.valaddress !== "") { + obj.valaddress = message.valaddress; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): MsgJoinPool { + return MsgJoinPool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgJoinPool { const message = createBaseMsgJoinPool(); message.creator = object.creator ?? ""; @@ -626,16 +766,17 @@ export const MsgJoinPoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgJoinPoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -649,6 +790,9 @@ export const MsgJoinPoolResponse = { return obj; }, + create, I>>(base?: I): MsgJoinPoolResponse { + return MsgJoinPoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgJoinPoolResponse { const message = createBaseMsgJoinPoolResponse(); return message; @@ -671,40 +815,56 @@ export const MsgLeavePool = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeavePool { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.creator = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.pool_id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } 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", + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + pool_id: isSet(object.pool_id) ? globalThis.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); + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.pool_id !== "0") { + obj.pool_id = message.pool_id; + } return obj; }, + create, I>>(base?: I): MsgLeavePool { + return MsgLeavePool.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgLeavePool { const message = createBaseMsgLeavePool(); message.creator = object.creator ?? ""; @@ -723,16 +883,17 @@ export const MsgLeavePoolResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgLeavePoolResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -746,6 +907,9 @@ export const MsgLeavePoolResponse = { return obj; }, + create, I>>(base?: I): MsgLeavePoolResponse { + return MsgLeavePoolResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgLeavePoolResponse { const message = createBaseMsgLeavePoolResponse(); return message; @@ -768,40 +932,56 @@ export const MsgUpdateParams = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.payload = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgUpdateParams { return { - authority: isSet(object.authority) ? String(object.authority) : "", - payload: isSet(object.payload) ? String(object.payload) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + payload: isSet(object.payload) ? globalThis.String(object.payload) : "", }; }, toJSON(message: MsgUpdateParams): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.payload !== undefined && (obj.payload = message.payload); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.payload !== "") { + obj.payload = message.payload; + } return obj; }, + create, I>>(base?: I): MsgUpdateParams { + return MsgUpdateParams.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgUpdateParams { const message = createBaseMsgUpdateParams(); message.authority = object.authority ?? ""; @@ -820,16 +1000,17 @@ export const MsgUpdateParamsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -843,6 +1024,9 @@ export const MsgUpdateParamsResponse = { return obj; }, + create, I>>(base?: I): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgUpdateParamsResponse { const message = createBaseMsgUpdateParamsResponse(); return message; @@ -870,11 +1054,12 @@ export interface Msg { UpdateParams(request: MsgUpdateParams): Promise; } +export const MsgServiceName = "kyve.stakers.v1beta1.Msg"; 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.service = opts?.service || MsgServiceName; this.rpc = rpc; this.CreateStaker = this.CreateStaker.bind(this); this.UpdateMetadata = this.UpdateMetadata.bind(this); @@ -887,43 +1072,43 @@ export class MsgClientImpl implements Msg { 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))); + return promise.then((data) => MsgCreateStakerResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateMetadataResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateCommissionResponse.decode(_m0.Reader.create(data))); } ClaimCommissionRewards(request: MsgClaimCommissionRewards): Promise { const data = MsgClaimCommissionRewards.encode(request).finish(); const promise = this.rpc.request(this.service, "ClaimCommissionRewards", data); - return promise.then((data) => MsgClaimCommissionRewardsResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgClaimCommissionRewardsResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgJoinPoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgLeavePoolResponse.decode(_m0.Reader.create(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))); + return promise.then((data) => MsgUpdateParamsResponse.decode(_m0.Reader.create(data))); } } @@ -934,7 +1119,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/team/v1beta1/events.ts b/common/types/src/lcd/kyve/team/v1beta1/events.ts index c96f773e..30dbe829 100644 --- a/common/types/src/lcd/kyve/team/v1beta1/events.ts +++ b/common/types/src/lcd/kyve/team/v1beta1/events.ts @@ -102,50 +102,78 @@ export const EventCreateTeamVestingAccount = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventCreateTeamVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventCreateTeamVestingAccount(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.total_allocation = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.commencement = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventCreateTeamVestingAccount { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - total_allocation: isSet(object.total_allocation) ? String(object.total_allocation) : "0", - commencement: isSet(object.commencement) ? String(object.commencement) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + total_allocation: isSet(object.total_allocation) ? globalThis.String(object.total_allocation) : "0", + commencement: isSet(object.commencement) ? globalThis.String(object.commencement) : "0", }; }, toJSON(message: EventCreateTeamVestingAccount): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.total_allocation !== undefined && (obj.total_allocation = message.total_allocation); - message.commencement !== undefined && (obj.commencement = message.commencement); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.total_allocation !== "0") { + obj.total_allocation = message.total_allocation; + } + if (message.commencement !== "0") { + obj.commencement = message.commencement; + } return obj; }, + create, I>>(base?: I): EventCreateTeamVestingAccount { + return EventCreateTeamVestingAccount.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): EventCreateTeamVestingAccount { @@ -180,50 +208,78 @@ export const EventClawback = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClawback { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventClawback(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.clawback = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventClawback { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - clawback: isSet(object.clawback) ? String(object.clawback) : "0", - amount: isSet(object.amount) ? String(object.amount) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + clawback: isSet(object.clawback) ? globalThis.String(object.clawback) : "0", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", }; }, toJSON(message: EventClawback): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.clawback !== undefined && (obj.clawback = message.clawback); - message.amount !== undefined && (obj.amount = message.amount); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.clawback !== "0") { + obj.clawback = message.clawback; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } return obj; }, + create, I>>(base?: I): EventClawback { + return EventClawback.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClawback { const message = createBaseEventClawback(); message.authority = object.authority ?? ""; @@ -256,50 +312,78 @@ export const EventClaimedUnlocked = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimedUnlocked { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventClaimedUnlocked(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventClaimedUnlocked { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: EventClaimedUnlocked): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): EventClaimedUnlocked { + return EventClaimedUnlocked.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClaimedUnlocked { const message = createBaseEventClaimedUnlocked(); message.authority = object.authority ?? ""; @@ -332,50 +416,78 @@ export const EventClaimInflationRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimInflationRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventClaimInflationRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventClaimInflationRewards { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: EventClaimInflationRewards): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): EventClaimInflationRewards { + return EventClaimInflationRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClaimInflationRewards { const message = createBaseEventClaimInflationRewards(); message.authority = object.authority ?? ""; @@ -405,45 +517,67 @@ export const EventClaimAuthorityRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): EventClaimAuthorityRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEventClaimAuthorityRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): EventClaimAuthorityRewards { return { - authority: isSet(object.authority) ? String(object.authority) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: EventClaimAuthorityRewards): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): EventClaimAuthorityRewards { + return EventClaimAuthorityRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): EventClaimAuthorityRewards { const message = createBaseEventClaimAuthorityRewards(); message.authority = object.authority ?? ""; @@ -456,7 +590,8 @@ export const EventClaimAuthorityRewards = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/team/v1beta1/genesis.ts b/common/types/src/lcd/kyve/team/v1beta1/genesis.ts index 7e8223ae..7f61d5e0 100644 --- a/common/types/src/lcd/kyve/team/v1beta1/genesis.ts +++ b/common/types/src/lcd/kyve/team/v1beta1/genesis.ts @@ -8,7 +8,9 @@ export const protobufPackage = "kyve.team.v1beta1"; /** GenesisState defines the team module's genesis state. */ export interface GenesisState { /** authority ... */ - authority?: Authority; + authority?: + | Authority + | undefined; /** account_list ... */ account_list: TeamVestingAccount[]; /** account_count ... */ @@ -34,25 +36,38 @@ export const GenesisState = { }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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: + if (tag !== 18) { + break; + } + message.authority = Authority.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.account_list.push(TeamVestingAccount.decode(reader, reader.uint32())); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.account_count = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -60,26 +75,30 @@ export const GenesisState = { fromJSON(object: any): GenesisState { return { authority: isSet(object.authority) ? Authority.fromJSON(object.authority) : undefined, - account_list: Array.isArray(object?.account_list) + account_list: globalThis.Array.isArray(object?.account_list) ? object.account_list.map((e: any) => TeamVestingAccount.fromJSON(e)) : [], - account_count: isSet(object.account_count) ? String(object.account_count) : "0", + account_count: isSet(object.account_count) ? globalThis.String(object.account_count) : "0", }; }, toJSON(message: GenesisState): unknown { const obj: any = {}; - message.authority !== undefined && - (obj.authority = message.authority ? Authority.toJSON(message.authority) : undefined); - if (message.account_list) { - obj.account_list = message.account_list.map((e) => e ? TeamVestingAccount.toJSON(e) : undefined); - } else { - obj.account_list = []; + if (message.authority !== undefined) { + obj.authority = Authority.toJSON(message.authority); + } + if (message.account_list?.length) { + obj.account_list = message.account_list.map((e) => TeamVestingAccount.toJSON(e)); + } + if (message.account_count !== "0") { + obj.account_count = message.account_count; } - message.account_count !== undefined && (obj.account_count = message.account_count); return obj; }, + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): GenesisState { const message = createBaseGenesisState(); message.authority = (object.authority !== undefined && object.authority !== null) @@ -94,7 +113,8 @@ export const GenesisState = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/team/v1beta1/query.ts b/common/types/src/lcd/kyve/team/v1beta1/query.ts index fae0f0d0..aac3427b 100644 --- a/common/types/src/lcd/kyve/team/v1beta1/query.ts +++ b/common/types/src/lcd/kyve/team/v1beta1/query.ts @@ -67,7 +67,7 @@ export interface QueryTeamVestingAccountRequest { /** QueryTeamVestingAccountResponse is the response type for the Query/TeamVestingAccount RPC method. */ export interface QueryTeamVestingAccountResponse { /** account holds the requested team vesting account */ - account?: TeamVestingAccount; + account?: TeamVestingAccount | undefined; } /** QueryTeamCurrentVestingStatusRequest is request type for the Query/TeamCurrentVestingStatus RPC method. */ @@ -81,9 +81,11 @@ export interface QueryTeamVestingStatusResponse { /** request_date .. */ request_date: string; /** plan ... */ - plan?: QueryVestingPlan; + plan?: + | QueryVestingPlan + | undefined; /** status .. */ - status?: QueryVestingStatus; + status?: QueryVestingStatus | undefined; } /** QueryTeamVestingStatusByTimeRequest is request type for the Query/TeamCurrentVestingByTimeStatus RPC method. */ @@ -99,9 +101,11 @@ export interface QueryTeamVestingStatusByTimeResponse { /** request_date .. */ request_date: string; /** plan ... */ - plan?: QueryVestingPlan; + plan?: + | QueryVestingPlan + | undefined; /** status .. */ - status?: QueryVestingStatus; + status?: QueryVestingStatus | undefined; } /** QueryVestingStatus is a type holding information about the account's vesting progress */ @@ -156,16 +160,17 @@ export const QueryTeamInfoRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamInfoRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamInfoRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -179,6 +184,9 @@ export const QueryTeamInfoRequest = { return obj; }, + create, I>>(base?: I): QueryTeamInfoRequest { + return QueryTeamInfoRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryTeamInfoRequest { const message = createBaseQueryTeamInfoRequest(); return message; @@ -248,107 +256,197 @@ export const QueryTeamInfoResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamInfoResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamInfoResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.foundation_authority = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.bcp_authority = reader.string(); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.total_team_allocation = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.issued_team_allocation = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.available_team_allocation = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.total_authority_rewards = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.claimed_authority_rewards = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.available_authority_rewards = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.total_account_rewards = longToString(reader.uint64() as Long); - break; + continue; case 10: + if (tag !== 80) { + break; + } + message.claimed_account_rewards = longToString(reader.uint64() as Long); - break; + continue; case 11: + if (tag !== 88) { + break; + } + message.available_account_rewards = longToString(reader.uint64() as Long); - break; + continue; case 12: + if (tag !== 96) { + break; + } + message.required_module_balance = longToString(reader.uint64() as Long); - break; + continue; case 13: + if (tag !== 104) { + break; + } + message.team_module_balance = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamInfoResponse { return { - foundation_authority: isSet(object.foundation_authority) ? String(object.foundation_authority) : "", - bcp_authority: isSet(object.bcp_authority) ? String(object.bcp_authority) : "", - total_team_allocation: isSet(object.total_team_allocation) ? String(object.total_team_allocation) : "0", - issued_team_allocation: isSet(object.issued_team_allocation) ? String(object.issued_team_allocation) : "0", + foundation_authority: isSet(object.foundation_authority) ? globalThis.String(object.foundation_authority) : "", + bcp_authority: isSet(object.bcp_authority) ? globalThis.String(object.bcp_authority) : "", + total_team_allocation: isSet(object.total_team_allocation) + ? globalThis.String(object.total_team_allocation) + : "0", + issued_team_allocation: isSet(object.issued_team_allocation) + ? globalThis.String(object.issued_team_allocation) + : "0", available_team_allocation: isSet(object.available_team_allocation) - ? String(object.available_team_allocation) + ? globalThis.String(object.available_team_allocation) + : "0", + total_authority_rewards: isSet(object.total_authority_rewards) + ? globalThis.String(object.total_authority_rewards) : "0", - total_authority_rewards: isSet(object.total_authority_rewards) ? String(object.total_authority_rewards) : "0", claimed_authority_rewards: isSet(object.claimed_authority_rewards) - ? String(object.claimed_authority_rewards) + ? globalThis.String(object.claimed_authority_rewards) : "0", available_authority_rewards: isSet(object.available_authority_rewards) - ? String(object.available_authority_rewards) + ? globalThis.String(object.available_authority_rewards) + : "0", + total_account_rewards: isSet(object.total_account_rewards) + ? globalThis.String(object.total_account_rewards) + : "0", + claimed_account_rewards: isSet(object.claimed_account_rewards) + ? globalThis.String(object.claimed_account_rewards) : "0", - total_account_rewards: isSet(object.total_account_rewards) ? String(object.total_account_rewards) : "0", - claimed_account_rewards: isSet(object.claimed_account_rewards) ? String(object.claimed_account_rewards) : "0", available_account_rewards: isSet(object.available_account_rewards) - ? String(object.available_account_rewards) + ? globalThis.String(object.available_account_rewards) : "0", - required_module_balance: isSet(object.required_module_balance) ? String(object.required_module_balance) : "0", - team_module_balance: isSet(object.team_module_balance) ? String(object.team_module_balance) : "0", + required_module_balance: isSet(object.required_module_balance) + ? globalThis.String(object.required_module_balance) + : "0", + team_module_balance: isSet(object.team_module_balance) ? globalThis.String(object.team_module_balance) : "0", }; }, toJSON(message: QueryTeamInfoResponse): unknown { const obj: any = {}; - message.foundation_authority !== undefined && (obj.foundation_authority = message.foundation_authority); - message.bcp_authority !== undefined && (obj.bcp_authority = message.bcp_authority); - message.total_team_allocation !== undefined && (obj.total_team_allocation = message.total_team_allocation); - message.issued_team_allocation !== undefined && (obj.issued_team_allocation = message.issued_team_allocation); - message.available_team_allocation !== undefined && - (obj.available_team_allocation = message.available_team_allocation); - message.total_authority_rewards !== undefined && (obj.total_authority_rewards = message.total_authority_rewards); - message.claimed_authority_rewards !== undefined && - (obj.claimed_authority_rewards = message.claimed_authority_rewards); - message.available_authority_rewards !== undefined && - (obj.available_authority_rewards = message.available_authority_rewards); - message.total_account_rewards !== undefined && (obj.total_account_rewards = message.total_account_rewards); - message.claimed_account_rewards !== undefined && (obj.claimed_account_rewards = message.claimed_account_rewards); - message.available_account_rewards !== undefined && - (obj.available_account_rewards = message.available_account_rewards); - message.required_module_balance !== undefined && (obj.required_module_balance = message.required_module_balance); - message.team_module_balance !== undefined && (obj.team_module_balance = message.team_module_balance); + if (message.foundation_authority !== "") { + obj.foundation_authority = message.foundation_authority; + } + if (message.bcp_authority !== "") { + obj.bcp_authority = message.bcp_authority; + } + if (message.total_team_allocation !== "0") { + obj.total_team_allocation = message.total_team_allocation; + } + if (message.issued_team_allocation !== "0") { + obj.issued_team_allocation = message.issued_team_allocation; + } + if (message.available_team_allocation !== "0") { + obj.available_team_allocation = message.available_team_allocation; + } + if (message.total_authority_rewards !== "0") { + obj.total_authority_rewards = message.total_authority_rewards; + } + if (message.claimed_authority_rewards !== "0") { + obj.claimed_authority_rewards = message.claimed_authority_rewards; + } + if (message.available_authority_rewards !== "0") { + obj.available_authority_rewards = message.available_authority_rewards; + } + if (message.total_account_rewards !== "0") { + obj.total_account_rewards = message.total_account_rewards; + } + if (message.claimed_account_rewards !== "0") { + obj.claimed_account_rewards = message.claimed_account_rewards; + } + if (message.available_account_rewards !== "0") { + obj.available_account_rewards = message.available_account_rewards; + } + if (message.required_module_balance !== "0") { + obj.required_module_balance = message.required_module_balance; + } + if (message.team_module_balance !== "0") { + obj.team_module_balance = message.team_module_balance; + } return obj; }, + create, I>>(base?: I): QueryTeamInfoResponse { + return QueryTeamInfoResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryTeamInfoResponse { const message = createBaseQueryTeamInfoResponse(); message.foundation_authority = object.foundation_authority ?? ""; @@ -378,16 +476,17 @@ export const QueryTeamVestingAccountsRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingAccountsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingAccountsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -401,6 +500,9 @@ export const QueryTeamVestingAccountsRequest = { return obj; }, + create, I>>(base?: I): QueryTeamVestingAccountsRequest { + return QueryTeamVestingAccountsRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): QueryTeamVestingAccountsRequest { const message = createBaseQueryTeamVestingAccountsRequest(); return message; @@ -420,39 +522,49 @@ export const QueryTeamVestingAccountsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingAccountsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingAccountsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.accounts.push(TeamVestingAccount.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingAccountsResponse { return { - accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => TeamVestingAccount.fromJSON(e)) : [], + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e: any) => TeamVestingAccount.fromJSON(e)) + : [], }; }, toJSON(message: QueryTeamVestingAccountsResponse): unknown { const obj: any = {}; - if (message.accounts) { - obj.accounts = message.accounts.map((e) => e ? TeamVestingAccount.toJSON(e) : undefined); - } else { - obj.accounts = []; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => TeamVestingAccount.toJSON(e)); } return obj; }, + create, I>>( + base?: I, + ): QueryTeamVestingAccountsResponse { + return QueryTeamVestingAccountsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingAccountsResponse { @@ -475,33 +587,43 @@ export const QueryTeamVestingAccountRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingAccountRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingAccountRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingAccountRequest { - return { id: isSet(object.id) ? String(object.id) : "0" }; + return { id: isSet(object.id) ? globalThis.String(object.id) : "0" }; }, toJSON(message: QueryTeamVestingAccountRequest): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): QueryTeamVestingAccountRequest { + return QueryTeamVestingAccountRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingAccountRequest { @@ -524,19 +646,24 @@ export const QueryTeamVestingAccountResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingAccountResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingAccountResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.account = TeamVestingAccount.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -547,11 +674,15 @@ export const QueryTeamVestingAccountResponse = { toJSON(message: QueryTeamVestingAccountResponse): unknown { const obj: any = {}; - message.account !== undefined && - (obj.account = message.account ? TeamVestingAccount.toJSON(message.account) : undefined); + if (message.account !== undefined) { + obj.account = TeamVestingAccount.toJSON(message.account); + } return obj; }, + create, I>>(base?: I): QueryTeamVestingAccountResponse { + return QueryTeamVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingAccountResponse { @@ -576,33 +707,43 @@ export const QueryTeamVestingStatusRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingStatusRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingStatusRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingStatusRequest { - return { id: isSet(object.id) ? String(object.id) : "0" }; + return { id: isSet(object.id) ? globalThis.String(object.id) : "0" }; }, toJSON(message: QueryTeamVestingStatusRequest): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); + if (message.id !== "0") { + obj.id = message.id; + } return obj; }, + create, I>>(base?: I): QueryTeamVestingStatusRequest { + return QueryTeamVestingStatusRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingStatusRequest { @@ -631,32 +772,45 @@ export const QueryTeamVestingStatusResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingStatusResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingStatusResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.request_date = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.plan = QueryVestingPlan.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.status = QueryVestingStatus.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingStatusResponse { return { - request_date: isSet(object.request_date) ? String(object.request_date) : "", + request_date: isSet(object.request_date) ? globalThis.String(object.request_date) : "", plan: isSet(object.plan) ? QueryVestingPlan.fromJSON(object.plan) : undefined, status: isSet(object.status) ? QueryVestingStatus.fromJSON(object.status) : undefined, }; @@ -664,13 +818,21 @@ export const QueryTeamVestingStatusResponse = { toJSON(message: QueryTeamVestingStatusResponse): unknown { const obj: any = {}; - message.request_date !== undefined && (obj.request_date = message.request_date); - message.plan !== undefined && (obj.plan = message.plan ? QueryVestingPlan.toJSON(message.plan) : undefined); - message.status !== undefined && - (obj.status = message.status ? QueryVestingStatus.toJSON(message.status) : undefined); + if (message.request_date !== "") { + obj.request_date = message.request_date; + } + if (message.plan !== undefined) { + obj.plan = QueryVestingPlan.toJSON(message.plan); + } + if (message.status !== undefined) { + obj.status = QueryVestingStatus.toJSON(message.status); + } return obj; }, + create, I>>(base?: I): QueryTeamVestingStatusResponse { + return QueryTeamVestingStatusResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingStatusResponse { @@ -702,37 +864,58 @@ export const QueryTeamVestingStatusByTimeRequest = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingStatusByTimeRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingStatusByTimeRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.time = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingStatusByTimeRequest { - return { id: isSet(object.id) ? String(object.id) : "0", time: isSet(object.time) ? String(object.time) : "0" }; + return { + id: isSet(object.id) ? globalThis.String(object.id) : "0", + time: isSet(object.time) ? globalThis.String(object.time) : "0", + }; }, toJSON(message: QueryTeamVestingStatusByTimeRequest): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); - message.time !== undefined && (obj.time = message.time); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.time !== "0") { + obj.time = message.time; + } return obj; }, + create, I>>( + base?: I, + ): QueryTeamVestingStatusByTimeRequest { + return QueryTeamVestingStatusByTimeRequest.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingStatusByTimeRequest { @@ -762,32 +945,45 @@ export const QueryTeamVestingStatusByTimeResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryTeamVestingStatusByTimeResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryTeamVestingStatusByTimeResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.request_date = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.plan = QueryVestingPlan.decode(reader, reader.uint32()); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.status = QueryVestingStatus.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryTeamVestingStatusByTimeResponse { return { - request_date: isSet(object.request_date) ? String(object.request_date) : "", + request_date: isSet(object.request_date) ? globalThis.String(object.request_date) : "", plan: isSet(object.plan) ? QueryVestingPlan.fromJSON(object.plan) : undefined, status: isSet(object.status) ? QueryVestingStatus.fromJSON(object.status) : undefined, }; @@ -795,13 +991,23 @@ export const QueryTeamVestingStatusByTimeResponse = { toJSON(message: QueryTeamVestingStatusByTimeResponse): unknown { const obj: any = {}; - message.request_date !== undefined && (obj.request_date = message.request_date); - message.plan !== undefined && (obj.plan = message.plan ? QueryVestingPlan.toJSON(message.plan) : undefined); - message.status !== undefined && - (obj.status = message.status ? QueryVestingStatus.toJSON(message.status) : undefined); + if (message.request_date !== "") { + obj.request_date = message.request_date; + } + if (message.plan !== undefined) { + obj.plan = QueryVestingPlan.toJSON(message.plan); + } + if (message.status !== undefined) { + obj.status = QueryVestingStatus.toJSON(message.status); + } return obj; }, + create, I>>( + base?: I, + ): QueryTeamVestingStatusByTimeResponse { + return QueryTeamVestingStatusByTimeResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( object: I, ): QueryTeamVestingStatusByTimeResponse { @@ -864,78 +1070,139 @@ export const QueryVestingStatus = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVestingStatus { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVestingStatus(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.total_vested_amount = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.total_unlocked_amount = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.current_claimable_amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.locked_vested_amount = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.remaining_unvested_amount = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.claimed_amount = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.total_rewards = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.claimed_rewards = longToString(reader.uint64() as Long); - break; + continue; case 9: + if (tag !== 72) { + break; + } + message.available_rewards = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryVestingStatus { return { - total_vested_amount: isSet(object.total_vested_amount) ? String(object.total_vested_amount) : "0", - total_unlocked_amount: isSet(object.total_unlocked_amount) ? String(object.total_unlocked_amount) : "0", - current_claimable_amount: isSet(object.current_claimable_amount) ? String(object.current_claimable_amount) : "0", - locked_vested_amount: isSet(object.locked_vested_amount) ? String(object.locked_vested_amount) : "0", + total_vested_amount: isSet(object.total_vested_amount) ? globalThis.String(object.total_vested_amount) : "0", + total_unlocked_amount: isSet(object.total_unlocked_amount) + ? globalThis.String(object.total_unlocked_amount) + : "0", + current_claimable_amount: isSet(object.current_claimable_amount) + ? globalThis.String(object.current_claimable_amount) + : "0", + locked_vested_amount: isSet(object.locked_vested_amount) ? globalThis.String(object.locked_vested_amount) : "0", remaining_unvested_amount: isSet(object.remaining_unvested_amount) - ? String(object.remaining_unvested_amount) + ? globalThis.String(object.remaining_unvested_amount) : "0", - claimed_amount: isSet(object.claimed_amount) ? String(object.claimed_amount) : "0", - total_rewards: isSet(object.total_rewards) ? String(object.total_rewards) : "0", - claimed_rewards: isSet(object.claimed_rewards) ? String(object.claimed_rewards) : "0", - available_rewards: isSet(object.available_rewards) ? String(object.available_rewards) : "0", + claimed_amount: isSet(object.claimed_amount) ? globalThis.String(object.claimed_amount) : "0", + total_rewards: isSet(object.total_rewards) ? globalThis.String(object.total_rewards) : "0", + claimed_rewards: isSet(object.claimed_rewards) ? globalThis.String(object.claimed_rewards) : "0", + available_rewards: isSet(object.available_rewards) ? globalThis.String(object.available_rewards) : "0", }; }, toJSON(message: QueryVestingStatus): unknown { const obj: any = {}; - message.total_vested_amount !== undefined && (obj.total_vested_amount = message.total_vested_amount); - message.total_unlocked_amount !== undefined && (obj.total_unlocked_amount = message.total_unlocked_amount); - message.current_claimable_amount !== undefined && (obj.current_claimable_amount = message.current_claimable_amount); - message.locked_vested_amount !== undefined && (obj.locked_vested_amount = message.locked_vested_amount); - message.remaining_unvested_amount !== undefined && - (obj.remaining_unvested_amount = message.remaining_unvested_amount); - message.claimed_amount !== undefined && (obj.claimed_amount = message.claimed_amount); - message.total_rewards !== undefined && (obj.total_rewards = message.total_rewards); - message.claimed_rewards !== undefined && (obj.claimed_rewards = message.claimed_rewards); - message.available_rewards !== undefined && (obj.available_rewards = message.available_rewards); + if (message.total_vested_amount !== "0") { + obj.total_vested_amount = message.total_vested_amount; + } + if (message.total_unlocked_amount !== "0") { + obj.total_unlocked_amount = message.total_unlocked_amount; + } + if (message.current_claimable_amount !== "0") { + obj.current_claimable_amount = message.current_claimable_amount; + } + if (message.locked_vested_amount !== "0") { + obj.locked_vested_amount = message.locked_vested_amount; + } + if (message.remaining_unvested_amount !== "0") { + obj.remaining_unvested_amount = message.remaining_unvested_amount; + } + if (message.claimed_amount !== "0") { + obj.claimed_amount = message.claimed_amount; + } + if (message.total_rewards !== "0") { + obj.total_rewards = message.total_rewards; + } + if (message.claimed_rewards !== "0") { + obj.claimed_rewards = message.claimed_rewards; + } + if (message.available_rewards !== "0") { + obj.available_rewards = message.available_rewards; + } return obj; }, + create, I>>(base?: I): QueryVestingStatus { + return QueryVestingStatus.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVestingStatus { const message = createBaseQueryVestingStatus(); message.total_vested_amount = object.total_vested_amount ?? "0"; @@ -994,70 +1261,126 @@ export const QueryVestingPlan = { }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryVestingPlan { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryVestingPlan(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.commencement = reader.string(); - break; + continue; case 2: + if (tag !== 18) { + break; + } + message.token_vesting_start = reader.string(); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.token_vesting_finished = reader.string(); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.token_unlock_start = reader.string(); - break; + continue; case 5: + if (tag !== 42) { + break; + } + message.token_unlock_finished = reader.string(); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.clawback = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.clawback_amount = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.maximum_vesting_amount = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): QueryVestingPlan { return { - commencement: isSet(object.commencement) ? String(object.commencement) : "", - token_vesting_start: isSet(object.token_vesting_start) ? String(object.token_vesting_start) : "", - token_vesting_finished: isSet(object.token_vesting_finished) ? String(object.token_vesting_finished) : "", - token_unlock_start: isSet(object.token_unlock_start) ? String(object.token_unlock_start) : "", - token_unlock_finished: isSet(object.token_unlock_finished) ? String(object.token_unlock_finished) : "", - clawback: isSet(object.clawback) ? String(object.clawback) : "0", - clawback_amount: isSet(object.clawback_amount) ? String(object.clawback_amount) : "0", - maximum_vesting_amount: isSet(object.maximum_vesting_amount) ? String(object.maximum_vesting_amount) : "0", + commencement: isSet(object.commencement) ? globalThis.String(object.commencement) : "", + token_vesting_start: isSet(object.token_vesting_start) ? globalThis.String(object.token_vesting_start) : "", + token_vesting_finished: isSet(object.token_vesting_finished) + ? globalThis.String(object.token_vesting_finished) + : "", + token_unlock_start: isSet(object.token_unlock_start) ? globalThis.String(object.token_unlock_start) : "", + token_unlock_finished: isSet(object.token_unlock_finished) ? globalThis.String(object.token_unlock_finished) : "", + clawback: isSet(object.clawback) ? globalThis.String(object.clawback) : "0", + clawback_amount: isSet(object.clawback_amount) ? globalThis.String(object.clawback_amount) : "0", + maximum_vesting_amount: isSet(object.maximum_vesting_amount) + ? globalThis.String(object.maximum_vesting_amount) + : "0", }; }, toJSON(message: QueryVestingPlan): unknown { const obj: any = {}; - message.commencement !== undefined && (obj.commencement = message.commencement); - message.token_vesting_start !== undefined && (obj.token_vesting_start = message.token_vesting_start); - message.token_vesting_finished !== undefined && (obj.token_vesting_finished = message.token_vesting_finished); - message.token_unlock_start !== undefined && (obj.token_unlock_start = message.token_unlock_start); - message.token_unlock_finished !== undefined && (obj.token_unlock_finished = message.token_unlock_finished); - message.clawback !== undefined && (obj.clawback = message.clawback); - message.clawback_amount !== undefined && (obj.clawback_amount = message.clawback_amount); - message.maximum_vesting_amount !== undefined && (obj.maximum_vesting_amount = message.maximum_vesting_amount); + if (message.commencement !== "") { + obj.commencement = message.commencement; + } + if (message.token_vesting_start !== "") { + obj.token_vesting_start = message.token_vesting_start; + } + if (message.token_vesting_finished !== "") { + obj.token_vesting_finished = message.token_vesting_finished; + } + if (message.token_unlock_start !== "") { + obj.token_unlock_start = message.token_unlock_start; + } + if (message.token_unlock_finished !== "") { + obj.token_unlock_finished = message.token_unlock_finished; + } + if (message.clawback !== "0") { + obj.clawback = message.clawback; + } + if (message.clawback_amount !== "0") { + obj.clawback_amount = message.clawback_amount; + } + if (message.maximum_vesting_amount !== "0") { + obj.maximum_vesting_amount = message.maximum_vesting_amount; + } return obj; }, + create, I>>(base?: I): QueryVestingPlan { + return QueryVestingPlan.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): QueryVestingPlan { const message = createBaseQueryVestingPlan(); message.commencement = object.commencement ?? ""; @@ -1086,11 +1409,12 @@ export interface Query { TeamVestingStatusByTime(request: QueryTeamVestingStatusByTimeRequest): Promise; } +export const QueryServiceName = "kyve.team.v1beta1.Query"; export class QueryClientImpl implements Query { private readonly rpc: Rpc; private readonly service: string; constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || "kyve.team.v1beta1.Query"; + this.service = opts?.service || QueryServiceName; this.rpc = rpc; this.TeamInfo = this.TeamInfo.bind(this); this.TeamVestingAccounts = this.TeamVestingAccounts.bind(this); @@ -1101,31 +1425,31 @@ export class QueryClientImpl implements Query { TeamInfo(request: QueryTeamInfoRequest): Promise { const data = QueryTeamInfoRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "TeamInfo", data); - return promise.then((data) => QueryTeamInfoResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryTeamInfoResponse.decode(_m0.Reader.create(data))); } TeamVestingAccounts(request: QueryTeamVestingAccountsRequest): Promise { const data = QueryTeamVestingAccountsRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "TeamVestingAccounts", data); - return promise.then((data) => QueryTeamVestingAccountsResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryTeamVestingAccountsResponse.decode(_m0.Reader.create(data))); } TeamVestingAccount(request: QueryTeamVestingAccountRequest): Promise { const data = QueryTeamVestingAccountRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "TeamVestingAccount", data); - return promise.then((data) => QueryTeamVestingAccountResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryTeamVestingAccountResponse.decode(_m0.Reader.create(data))); } TeamVestingStatus(request: QueryTeamVestingStatusRequest): Promise { const data = QueryTeamVestingStatusRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "TeamVestingStatus", data); - return promise.then((data) => QueryTeamVestingStatusResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryTeamVestingStatusResponse.decode(_m0.Reader.create(data))); } TeamVestingStatusByTime(request: QueryTeamVestingStatusByTimeRequest): Promise { const data = QueryTeamVestingStatusByTimeRequest.encode(request).finish(); const promise = this.rpc.request(this.service, "TeamVestingStatusByTime", data); - return promise.then((data) => QueryTeamVestingStatusByTimeResponse.decode(new _m0.Reader(data))); + return promise.then((data) => QueryTeamVestingStatusByTimeResponse.decode(_m0.Reader.create(data))); } } @@ -1136,7 +1460,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/team/v1beta1/team.ts b/common/types/src/lcd/kyve/team/v1beta1/team.ts index c96e4d32..34e956ac 100644 --- a/common/types/src/lcd/kyve/team/v1beta1/team.ts +++ b/common/types/src/lcd/kyve/team/v1beta1/team.ts @@ -51,40 +51,56 @@ export const Authority = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Authority { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAuthority(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.total_rewards = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.rewards_claimed = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): Authority { return { - total_rewards: isSet(object.total_rewards) ? String(object.total_rewards) : "0", - rewards_claimed: isSet(object.rewards_claimed) ? String(object.rewards_claimed) : "0", + total_rewards: isSet(object.total_rewards) ? globalThis.String(object.total_rewards) : "0", + rewards_claimed: isSet(object.rewards_claimed) ? globalThis.String(object.rewards_claimed) : "0", }; }, toJSON(message: Authority): unknown { const obj: any = {}; - message.total_rewards !== undefined && (obj.total_rewards = message.total_rewards); - message.rewards_claimed !== undefined && (obj.rewards_claimed = message.rewards_claimed); + if (message.total_rewards !== "0") { + obj.total_rewards = message.total_rewards; + } + if (message.rewards_claimed !== "0") { + obj.rewards_claimed = message.rewards_claimed; + } return obj; }, + create, I>>(base?: I): Authority { + return Authority.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): Authority { const message = createBaseAuthority(); message.total_rewards = object.total_rewards ?? "0"; @@ -136,70 +152,122 @@ export const TeamVestingAccount = { }, decode(input: _m0.Reader | Uint8Array, length?: number): TeamVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTeamVestingAccount(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 8) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.total_allocation = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.commencement = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 32) { + break; + } + message.clawback = longToString(reader.uint64() as Long); - break; + continue; case 5: + if (tag !== 40) { + break; + } + message.unlocked_claimed = longToString(reader.uint64() as Long); - break; + continue; case 6: + if (tag !== 48) { + break; + } + message.last_claimed_time = longToString(reader.uint64() as Long); - break; + continue; case 7: + if (tag !== 56) { + break; + } + message.total_rewards = longToString(reader.uint64() as Long); - break; + continue; case 8: + if (tag !== 64) { + break; + } + message.rewards_claimed = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): TeamVestingAccount { return { - id: isSet(object.id) ? String(object.id) : "0", - total_allocation: isSet(object.total_allocation) ? String(object.total_allocation) : "0", - commencement: isSet(object.commencement) ? String(object.commencement) : "0", - clawback: isSet(object.clawback) ? String(object.clawback) : "0", - unlocked_claimed: isSet(object.unlocked_claimed) ? String(object.unlocked_claimed) : "0", - last_claimed_time: isSet(object.last_claimed_time) ? String(object.last_claimed_time) : "0", - total_rewards: isSet(object.total_rewards) ? String(object.total_rewards) : "0", - rewards_claimed: isSet(object.rewards_claimed) ? String(object.rewards_claimed) : "0", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + total_allocation: isSet(object.total_allocation) ? globalThis.String(object.total_allocation) : "0", + commencement: isSet(object.commencement) ? globalThis.String(object.commencement) : "0", + clawback: isSet(object.clawback) ? globalThis.String(object.clawback) : "0", + unlocked_claimed: isSet(object.unlocked_claimed) ? globalThis.String(object.unlocked_claimed) : "0", + last_claimed_time: isSet(object.last_claimed_time) ? globalThis.String(object.last_claimed_time) : "0", + total_rewards: isSet(object.total_rewards) ? globalThis.String(object.total_rewards) : "0", + rewards_claimed: isSet(object.rewards_claimed) ? globalThis.String(object.rewards_claimed) : "0", }; }, toJSON(message: TeamVestingAccount): unknown { const obj: any = {}; - message.id !== undefined && (obj.id = message.id); - message.total_allocation !== undefined && (obj.total_allocation = message.total_allocation); - message.commencement !== undefined && (obj.commencement = message.commencement); - message.clawback !== undefined && (obj.clawback = message.clawback); - message.unlocked_claimed !== undefined && (obj.unlocked_claimed = message.unlocked_claimed); - message.last_claimed_time !== undefined && (obj.last_claimed_time = message.last_claimed_time); - message.total_rewards !== undefined && (obj.total_rewards = message.total_rewards); - message.rewards_claimed !== undefined && (obj.rewards_claimed = message.rewards_claimed); + if (message.id !== "0") { + obj.id = message.id; + } + if (message.total_allocation !== "0") { + obj.total_allocation = message.total_allocation; + } + if (message.commencement !== "0") { + obj.commencement = message.commencement; + } + if (message.clawback !== "0") { + obj.clawback = message.clawback; + } + if (message.unlocked_claimed !== "0") { + obj.unlocked_claimed = message.unlocked_claimed; + } + if (message.last_claimed_time !== "0") { + obj.last_claimed_time = message.last_claimed_time; + } + if (message.total_rewards !== "0") { + obj.total_rewards = message.total_rewards; + } + if (message.rewards_claimed !== "0") { + obj.rewards_claimed = message.rewards_claimed; + } return obj; }, + create, I>>(base?: I): TeamVestingAccount { + return TeamVestingAccount.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): TeamVestingAccount { const message = createBaseTeamVestingAccount(); message.id = object.id ?? "0"; @@ -217,7 +285,8 @@ export const TeamVestingAccount = { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/kyve/team/v1beta1/tx.ts b/common/types/src/lcd/kyve/team/v1beta1/tx.ts index 5d65e616..cfc7ff57 100644 --- a/common/types/src/lcd/kyve/team/v1beta1/tx.ts +++ b/common/types/src/lcd/kyve/team/v1beta1/tx.ts @@ -100,50 +100,78 @@ export const MsgClaimUnlocked = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUnlocked { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimUnlocked(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgClaimUnlocked { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: MsgClaimUnlocked): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): MsgClaimUnlocked { + return MsgClaimUnlocked.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClaimUnlocked { const message = createBaseMsgClaimUnlocked(); message.authority = object.authority ?? ""; @@ -164,16 +192,17 @@ export const MsgClaimUnlockedResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimUnlockedResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimUnlockedResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -187,6 +216,9 @@ export const MsgClaimUnlockedResponse = { return obj; }, + create, I>>(base?: I): MsgClaimUnlockedResponse { + return MsgClaimUnlockedResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgClaimUnlockedResponse { const message = createBaseMsgClaimUnlockedResponse(); return message; @@ -212,45 +244,67 @@ export const MsgClaimAuthorityRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimAuthorityRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimAuthorityRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 26) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgClaimAuthorityRewards { return { - authority: isSet(object.authority) ? String(object.authority) : "", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: MsgClaimAuthorityRewards): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): MsgClaimAuthorityRewards { + return MsgClaimAuthorityRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClaimAuthorityRewards { const message = createBaseMsgClaimAuthorityRewards(); message.authority = object.authority ?? ""; @@ -270,16 +324,17 @@ export const MsgClaimAuthorityRewardsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimAuthorityRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimAuthorityRewardsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -293,6 +348,11 @@ export const MsgClaimAuthorityRewardsResponse = { return obj; }, + create, I>>( + base?: I, + ): MsgClaimAuthorityRewardsResponse { + return MsgClaimAuthorityRewardsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( _: I, ): MsgClaimAuthorityRewardsResponse { @@ -323,50 +383,78 @@ export const MsgClaimAccountRewards = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimAccountRewards { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimAccountRewards(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.amount = longToString(reader.uint64() as Long); - break; + continue; case 4: + if (tag !== 34) { + break; + } + message.recipient = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgClaimAccountRewards { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - amount: isSet(object.amount) ? String(object.amount) : "0", - recipient: isSet(object.recipient) ? String(object.recipient) : "", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "0", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", }; }, toJSON(message: MsgClaimAccountRewards): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.amount !== undefined && (obj.amount = message.amount); - message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.amount !== "0") { + obj.amount = message.amount; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } return obj; }, + create, I>>(base?: I): MsgClaimAccountRewards { + return MsgClaimAccountRewards.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClaimAccountRewards { const message = createBaseMsgClaimAccountRewards(); message.authority = object.authority ?? ""; @@ -387,16 +475,17 @@ export const MsgClaimAccountRewardsResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClaimAccountRewardsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClaimAccountRewardsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -410,6 +499,9 @@ export const MsgClaimAccountRewardsResponse = { return obj; }, + create, I>>(base?: I): MsgClaimAccountRewardsResponse { + return MsgClaimAccountRewardsResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgClaimAccountRewardsResponse { const message = createBaseMsgClaimAccountRewardsResponse(); return message; @@ -435,45 +527,67 @@ export const MsgClawback = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClawback { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClawback(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.id = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.clawback = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgClawback { return { - authority: isSet(object.authority) ? String(object.authority) : "", - id: isSet(object.id) ? String(object.id) : "0", - clawback: isSet(object.clawback) ? String(object.clawback) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "0", + clawback: isSet(object.clawback) ? globalThis.String(object.clawback) : "0", }; }, toJSON(message: MsgClawback): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.id !== undefined && (obj.id = message.id); - message.clawback !== undefined && (obj.clawback = message.clawback); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.id !== "0") { + obj.id = message.id; + } + if (message.clawback !== "0") { + obj.clawback = message.clawback; + } return obj; }, + create, I>>(base?: I): MsgClawback { + return MsgClawback.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgClawback { const message = createBaseMsgClawback(); message.authority = object.authority ?? ""; @@ -493,16 +607,17 @@ export const MsgClawbackResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClawbackResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgClawbackResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -516,6 +631,9 @@ export const MsgClawbackResponse = { return obj; }, + create, I>>(base?: I): MsgClawbackResponse { + return MsgClawbackResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(_: I): MsgClawbackResponse { const message = createBaseMsgClawbackResponse(); return message; @@ -541,45 +659,67 @@ export const MsgCreateTeamVestingAccount = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateTeamVestingAccount { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateTeamVestingAccount(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: + if (tag !== 10) { + break; + } + message.authority = reader.string(); - break; + continue; case 2: + if (tag !== 16) { + break; + } + message.total_allocation = longToString(reader.uint64() as Long); - break; + continue; case 3: + if (tag !== 24) { + break; + } + message.commencement = longToString(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; + continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, fromJSON(object: any): MsgCreateTeamVestingAccount { return { - authority: isSet(object.authority) ? String(object.authority) : "", - total_allocation: isSet(object.total_allocation) ? String(object.total_allocation) : "0", - commencement: isSet(object.commencement) ? String(object.commencement) : "0", + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + total_allocation: isSet(object.total_allocation) ? globalThis.String(object.total_allocation) : "0", + commencement: isSet(object.commencement) ? globalThis.String(object.commencement) : "0", }; }, toJSON(message: MsgCreateTeamVestingAccount): unknown { const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.total_allocation !== undefined && (obj.total_allocation = message.total_allocation); - message.commencement !== undefined && (obj.commencement = message.commencement); + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.total_allocation !== "0") { + obj.total_allocation = message.total_allocation; + } + if (message.commencement !== "0") { + obj.commencement = message.commencement; + } return obj; }, + create, I>>(base?: I): MsgCreateTeamVestingAccount { + return MsgCreateTeamVestingAccount.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>(object: I): MsgCreateTeamVestingAccount { const message = createBaseMsgCreateTeamVestingAccount(); message.authority = object.authority ?? ""; @@ -599,16 +739,17 @@ export const MsgCreateTeamVestingAccountResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateTeamVestingAccountResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgCreateTeamVestingAccountResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); } return message; }, @@ -622,6 +763,11 @@ export const MsgCreateTeamVestingAccountResponse = { return obj; }, + create, I>>( + base?: I, + ): MsgCreateTeamVestingAccountResponse { + return MsgCreateTeamVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, fromPartial, I>>( _: I, ): MsgCreateTeamVestingAccountResponse { @@ -644,11 +790,12 @@ export interface Msg { ClaimAccountRewards(request: MsgClaimAccountRewards): Promise; } +export const MsgServiceName = "kyve.team.v1beta1.Msg"; export class MsgClientImpl implements Msg { private readonly rpc: Rpc; private readonly service: string; constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || "kyve.team.v1beta1.Msg"; + this.service = opts?.service || MsgServiceName; this.rpc = rpc; this.ClaimUnlocked = this.ClaimUnlocked.bind(this); this.Clawback = this.Clawback.bind(this); @@ -659,31 +806,31 @@ export class MsgClientImpl implements Msg { ClaimUnlocked(request: MsgClaimUnlocked): Promise { const data = MsgClaimUnlocked.encode(request).finish(); const promise = this.rpc.request(this.service, "ClaimUnlocked", data); - return promise.then((data) => MsgClaimUnlockedResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgClaimUnlockedResponse.decode(_m0.Reader.create(data))); } Clawback(request: MsgClawback): Promise { const data = MsgClawback.encode(request).finish(); const promise = this.rpc.request(this.service, "Clawback", data); - return promise.then((data) => MsgClawbackResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgClawbackResponse.decode(_m0.Reader.create(data))); } CreateTeamVestingAccount(request: MsgCreateTeamVestingAccount): Promise { const data = MsgCreateTeamVestingAccount.encode(request).finish(); const promise = this.rpc.request(this.service, "CreateTeamVestingAccount", data); - return promise.then((data) => MsgCreateTeamVestingAccountResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgCreateTeamVestingAccountResponse.decode(_m0.Reader.create(data))); } ClaimAuthorityRewards(request: MsgClaimAuthorityRewards): Promise { const data = MsgClaimAuthorityRewards.encode(request).finish(); const promise = this.rpc.request(this.service, "ClaimAuthorityRewards", data); - return promise.then((data) => MsgClaimAuthorityRewardsResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgClaimAuthorityRewardsResponse.decode(_m0.Reader.create(data))); } ClaimAccountRewards(request: MsgClaimAccountRewards): Promise { const data = MsgClaimAccountRewards.encode(request).finish(); const promise = this.rpc.request(this.service, "ClaimAccountRewards", data); - return promise.then((data) => MsgClaimAccountRewardsResponse.decode(new _m0.Reader(data))); + return promise.then((data) => MsgClaimAccountRewardsResponse.decode(_m0.Reader.create(data))); } } @@ -694,7 +841,8 @@ interface Rpc { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; diff --git a/common/types/src/lcd/tendermint/abci/types.ts b/common/types/src/lcd/tendermint/abci/types.ts deleted file mode 100644 index 2e4eb345..00000000 --- a/common/types/src/lcd/tendermint/abci/types.ts +++ /dev/null @@ -1,4193 +0,0 @@ -/* 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 deleted file mode 100644 index a3f5f88f..00000000 --- a/common/types/src/lcd/tendermint/crypto/keys.ts +++ /dev/null @@ -1,129 +0,0 @@ -/* 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 deleted file mode 100644 index 5c9e78de..00000000 --- a/common/types/src/lcd/tendermint/crypto/proof.ts +++ /dev/null @@ -1,436 +0,0 @@ -/* 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 deleted file mode 100644 index ddef8ae2..00000000 --- a/common/types/src/lcd/tendermint/libs/bits/types.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* 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 deleted file mode 100644 index 8c8f4f0c..00000000 --- a/common/types/src/lcd/tendermint/p2p/types.ts +++ /dev/null @@ -1,532 +0,0 @@ -/* 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 deleted file mode 100644 index beb4c40b..00000000 --- a/common/types/src/lcd/tendermint/types/block.ts +++ /dev/null @@ -1,112 +0,0 @@ -/* 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 deleted file mode 100644 index d4d5ed66..00000000 --- a/common/types/src/lcd/tendermint/types/evidence.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* 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 deleted file mode 100644 index c5e07f0b..00000000 --- a/common/types/src/lcd/tendermint/types/params.ts +++ /dev/null @@ -1,492 +0,0 @@ -/* 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 deleted file mode 100644 index d094251a..00000000 --- a/common/types/src/lcd/tendermint/types/types.ts +++ /dev/null @@ -1,1484 +0,0 @@ -/* 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 deleted file mode 100644 index 41b2d2dc..00000000 --- a/common/types/src/lcd/tendermint/types/validator.ts +++ /dev/null @@ -1,305 +0,0 @@ -/* 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 deleted file mode 100644 index 3eda3af6..00000000 --- a/common/types/src/lcd/tendermint/version/types.ts +++ /dev/null @@ -1,165 +0,0 @@ -/* 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/version.ts b/common/types/src/version.ts index 01b5ae35..4b1de27b 100644 --- a/common/types/src/version.ts +++ b/common/types/src/version.ts @@ -1 +1 @@ -export const version = "v1.3.0"; +export const version = "v1.3.0" diff --git a/yarn.lock b/yarn.lock index d087bec5..d5ff4283 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1898,6 +1898,17 @@ big-integer "^1.6.48" utility-types "^3.10.0" +"@kyvejs/types@1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@kyvejs/types/-/types-1.0.3.tgz#58b2cb854dd4722287e6cc67a9dcc4cb6ea56de5" + integrity sha512-y7uFE6ARMcRnM11ls8zHv/JWx9HyMF96Isce0ivRJ0Lwqqgv6+2ChnvkVoVdfIelq68NtGxorM+v1PDDq0Nrhw== + 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" + "@lerna/child-process@7.1.4": version "7.1.4" resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-7.1.4.tgz#5ab64540b01a339ecc6787f4f06d29aee99d71d5"